Changeset ea0e8cb for fedd/federation


Ignore:
Timestamp:
Mar 3, 2014 10:16:51 AM (11 years ago)
Author:
Ted Faber <faber@…>
Branches:
master
Children:
26821ac, 2c16731, 7862660
Parents:
0608d96
Message:

More routing options

File:
1 edited

Legend:

Unmodified
Added
Removed
  • fedd/federation/desktop_access.py

    r0608d96 rea0e8cb  
    6868        # File containing the routing entries for external networks
    6969        self.external_networks = config.get('access', 'external_networks')
     70        # Comma-separated list of interfaces to export (may be empty)
     71        self.export_interfaces = config.get('access', 'export_interfaces')
     72        if self.export_interfaces is not None:
     73            self.export_interfaces = \
     74                    [ x.strip() for x in self.export_interfaces.split(',')]
     75        else:
     76            self.export_interfaces = []
     77
     78        # Comma separated list of connected nets to export - these won't work
     79        # in external_networks
     80        self.export_networks = config.get('access', 'export_networks')
     81        if self.export_networks is not None:
     82            self.export_networks = \
     83                    [ x.strip() for x in self.export_networks.split(',')]
     84        else:
     85            self.export_networks = []
     86
    7087        # values for locations of zebra and ospfd.
    7188        self.zebra = config.get('access', 'zebra')
     
    454471            print >>f, 'hostname %s' % my_name
    455472            print >>f, 'interface tap0'
     473            for i in self.export_interfaces:
     474                print >>f, 'interface %s' % i
    456475            if  self.external_networks is not None:
    457476                try:
     
    471490            print >>f, ' redistribute static'
    472491            print >>f, ' network %s/24 area 0.0.0.2' % my_addr
     492            for i in self.export_networks:
     493                print >>f, ' network %s area 0.0.0.2' % i
    473494        except EnvironmentError, e:
    474495            raise service_error(service_error.internal,
    475496                    'Cannot create connect %s: %s' % (e.filename, e.strerror))
    476497        script_log = open('/tmp/connect.log', 'w')
    477         subprocess.Popen(['sudo', '/bin/sh', cscript], stdout=script_log, stderr=script_log)
     498        subprocess.Popen(['sudo', '/bin/sh', cscript], stdout=script_log,
     499                stderr=script_log)
    478500        return True
    479501
Note: See TracChangeset for help on using the changeset viewer.