Created
October 12, 2015 15:58
-
-
Save yottatsa/8282e670da16934960b3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- router_info.py 2015-10-12 15:56:54.571650341 +0000 | |
+++ /usr/lib/python2.7/dist-packages/neutron/agent/l3/router_info.py 2015-10-12 15:28:24.090577334 +0000 | |
@@ -361,7 +361,9 @@ | |
LOG.debug('Spawning radvd daemon in router device: %s', self.router_id) | |
if not internal_ports: | |
internal_ports = self.internal_ports | |
- self.radvd.enable(internal_ports) | |
+ ex_gw_port = self.get_ex_gw_port() | |
+ ext_interface = self.get_external_device_interface_name(ex_gw_port) | |
+ self.radvd.enable(internal_ports, ext_interface) | |
def disable_radvd(self): | |
LOG.debug('Terminating radvd daemon in router device: %s', | |
--- ra.py 2015-10-12 15:56:34.227913432 +0000 | |
+++ /usr/lib/python2.7/dist-packages/neutron/agent/linux/ra.py 2015-10-12 15:31:32.636061178 +0000 | |
@@ -51,6 +51,10 @@ | |
AdvManagedFlag on; | |
{% endif %} | |
+ {% if interface_name.startswith('qg-') %} | |
+ AdvDefaultLifetime 0; | |
+ {% endif %} | |
+ | |
{% for prefix in prefixes %} | |
prefix {{ prefix }} | |
{ | |
@@ -58,6 +62,11 @@ | |
AdvAutonomous on; | |
}; | |
{% endfor %} | |
+ {% for route in routes %} | |
+ route {{ route }} | |
+ { | |
+ }; | |
+ {% endfor %} | |
}; | |
""") | |
@@ -71,16 +80,18 @@ | |
self._process_monitor = process_monitor | |
self._dev_name_helper = dev_name_helper | |
- def _generate_radvd_conf(self, router_ports): | |
+ def _generate_radvd_conf(self, router_ports, ext_interface): | |
radvd_conf = utils.get_conf_file_name(cfg.CONF.ra_confs, | |
self._router_id, | |
'radvd.conf', | |
True) | |
buf = six.StringIO() | |
+ adv_subnets = [] | |
for p in router_ports: | |
subnets = p.get('subnets', []) | |
v6_subnets = [subnet for subnet in subnets if | |
netaddr.IPNetwork(subnet['cidr']).version == 6] | |
+ adv_subnets.extend(v6_subnets) | |
if not v6_subnets: | |
continue | |
ra_modes = {subnet['ipv6_ra_mode'] for subnet in v6_subnets} | |
@@ -94,6 +105,11 @@ | |
prefixes=auto_config_prefixes, | |
constants=constants)) | |
+ buf.write('%s' % CONFIG_TEMPLATE.render( | |
+ interface_name=ext_interface, | |
+ routes=[subnet['cidr'] for subnet in adv_subnets], | |
+ ra_modes=[], | |
+ constants=[])) | |
utils.replace_file(radvd_conf, buf.getvalue()) | |
return radvd_conf | |
@@ -126,12 +142,12 @@ | |
monitored_process=pm) | |
LOG.debug("radvd enabled for router %s", self._router_id) | |
- def enable(self, router_ports): | |
+ def enable(self, router_ports, ext_interface): | |
for p in router_ports: | |
for subnet in p['subnets']: | |
if netaddr.IPNetwork(subnet['cidr']).version == 6: | |
LOG.debug("Enable IPv6 RA for router %s", self._router_id) | |
- radvd_conf = self._generate_radvd_conf(router_ports) | |
+ radvd_conf = self._generate_radvd_conf(router_ports, ext_interface) | |
self._spawn_radvd(radvd_conf) | |
return |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment