DHCP agent: advertise SLAAC prefixes
Advertise IPv6 SLAAC prefixes via router advertisements with router lifetime of zero so prefix can be discovered on isolated networks. Since the router lifetime of these RAs is zero, they will not be used as a next hop. Implementing this now so Octavia can use an isolated IPv6 network. Change-Id: I4a9c2018606d1729465612206f8e8e2fc4922516 Closes-bug: #1498987 Related-bug: #1407573
This commit is contained in:
parent
e08e06fa22
commit
11c3f0cafd
|
@ -332,6 +332,8 @@ class Dnsmasq(DhcpLocalProcess):
|
|||
'--dhcp-optsfile=%s' % self.get_conf_file_name('opts'),
|
||||
'--dhcp-leasefile=%s' % self.get_conf_file_name('leases'),
|
||||
'--dhcp-match=set:ipxe,175',
|
||||
'--enable-ra',
|
||||
'--ra-param=%s,0,0' % self.interface_name,
|
||||
]
|
||||
if self.device_manager.driver.bridged:
|
||||
cmd += [
|
||||
|
@ -363,6 +365,8 @@ class Dnsmasq(DhcpLocalProcess):
|
|||
constants.DHCPV6_STATELESS] or
|
||||
not addr_mode and not ra_mode):
|
||||
mode = 'static'
|
||||
elif addr_mode == constants.IPV6_SLAAC:
|
||||
mode = 'slaac'
|
||||
|
||||
cidr = netaddr.IPNetwork(subnet.cidr)
|
||||
|
||||
|
|
|
@ -1075,6 +1075,8 @@ class TestDnsmasq(TestBase):
|
|||
'--dhcp-optsfile=/dhcp/%s/opts' % network.id,
|
||||
'--dhcp-leasefile=/dhcp/%s/leases' % network.id,
|
||||
'--dhcp-match=set:ipxe,175',
|
||||
'--enable-ra',
|
||||
'--ra-param=tap0,0,0',
|
||||
'--bind-interfaces',
|
||||
'--interface=tap0',
|
||||
]
|
||||
|
@ -1090,17 +1092,22 @@ class TestDnsmasq(TestBase):
|
|||
else:
|
||||
prefix = '--dhcp-range=set:tag%d,%s,%s%s'
|
||||
prefix6 = '--dhcp-range=set:tag%d,%s,%s,%s%s'
|
||||
prefix6slaac = '--dhcp-range=set:tag%d,%s,slaac,%s,%s%s'
|
||||
possible_leases = 0
|
||||
for i, s in enumerate(network.subnets):
|
||||
if (s.ip_version != 6
|
||||
or s.ipv6_address_mode == constants.DHCPV6_STATEFUL):
|
||||
if s.ip_version == 4:
|
||||
expected.extend([prefix % (
|
||||
i, s.cidr.split('/')[0], lease_duration, seconds)])
|
||||
else:
|
||||
if s.ip_version == 4:
|
||||
expected.extend([prefix % (
|
||||
i, s.cidr.split('/')[0], lease_duration, seconds)])
|
||||
possible_leases += netaddr.IPNetwork(s.cidr).size
|
||||
elif s.ip_version == 6:
|
||||
if s.ipv6_address_mode == constants.DHCPV6_STATEFUL:
|
||||
expected.extend([prefix6 % (
|
||||
i, s.cidr.split('/')[0], s.cidr.split('/')[1],
|
||||
lease_duration, seconds)])
|
||||
elif s.ipv6_address_mode == constants.IPV6_SLAAC:
|
||||
expected.extend([prefix6slaac % (
|
||||
i, s.cidr.split('/')[0], s.cidr.split('/')[1],
|
||||
lease_duration, seconds)])
|
||||
possible_leases += netaddr.IPNetwork(s.cidr).size
|
||||
|
||||
if cfg.CONF.advertise_mtu:
|
||||
|
@ -1163,7 +1170,7 @@ class TestDnsmasq(TestBase):
|
|||
self.safe.assert_has_calls([mock.call(exp_host_name, exp_host_data),
|
||||
mock.call(exp_addn_name, exp_addn_data)])
|
||||
|
||||
def test_spawn_no_dhcp_range(self):
|
||||
def test_spawn_slaac_dhcp_range(self):
|
||||
network = FakeV6Network()
|
||||
subnet = FakeV6SubnetSlaac()
|
||||
network.subnets = [subnet]
|
||||
|
|
Loading…
Reference in New Issue