Merge "Correct fix for IPv6 auto address interfaces" into stable/newton

This commit is contained in:
Jenkins 2016-09-27 20:42:53 +00:00 committed by Gerrit Code Review
commit c9a54002f2
3 changed files with 14 additions and 11 deletions

View File

@ -894,10 +894,10 @@ class Dnsmasq(DhcpLocalProcess):
# Add host routes for isolated network segments
if (self.conf.force_metadata or
(isolated_subnets[subnet.id] and
self.conf.enable_isolated_metadata and
subnet.ip_version == 4)):
if ((self.conf.force_metadata or
(isolated_subnets[subnet.id] and
self.conf.enable_isolated_metadata)) and
subnet.ip_version == 4):
subnet_dhcp_ip = subnet_to_interface_ip[subnet.id]
host_routes.append(
'%s/32,%s' % (METADATA_DEFAULT_IP, subnet_dhcp_ip)
@ -1373,7 +1373,7 @@ class DeviceManager(object):
ip_cidrs = []
for fixed_ip in port.fixed_ips:
subnet = fixed_ip.subnet
if not ipv6_utils.is_slaac_subnet(subnet):
if not ipv6_utils.is_auto_address_subnet(subnet):
net = netaddr.IPNetwork(subnet.cidr)
ip_cidr = '%s/%s' % (fixed_ip.ip_address, net.prefixlen)
ip_cidrs.append(ip_cidr)

View File

@ -76,12 +76,6 @@ def is_auto_address_subnet(subnet):
or subnet['ipv6_ra_mode'] in modes)
def is_slaac_subnet(subnet):
"""Check if subnet is a slaac subnet."""
return (subnet['ipv6_address_mode'] == const.IPV6_SLAAC
or subnet['ipv6_ra_mode'] == const.IPV6_SLAAC)
def is_eui64_address(ip_address):
"""Check if ip address is EUI64."""
ip = netaddr.IPAddress(ip_address)

View File

@ -1572,6 +1572,15 @@ class TestDnsmasq(TestBase):
self._test_output_opts_file(expected, FakeV6Network())
def test_output_opts_file_ipv6_address_force_metadata(self):
fake_v6 = '2001:0200:feed:7ac0::1'
expected = (
'tag:tag0,option6:dns-server,%s\n'
'tag:tag0,option6:domain-search,openstacklocal').lstrip() % (
'[' + fake_v6 + ']')
self.conf.force_metadata = True
self._test_output_opts_file(expected, FakeV6Network())
@property
def _test_no_dhcp_domain_alloc_data(self):
exp_host_name = '/dhcp/cccccccc-cccc-cccc-cccc-cccccccccccc/host'