Merge pull request #11375 from daxtens/issue5882

network: Fix IPv6 PreferredSource routes
This commit is contained in:
Lennart Poettering
2019-01-17 18:08:01 +01:00
committed by GitHub
4 changed files with 99 additions and 59 deletions
@@ -0,0 +1,16 @@
# This test cannot use a dummy interface: IPv6 addresses
# are added without having to go through tentative state
[Match]
Name=bond199
[Network]
LinkLocalAddressing=ipv6
Address=2001:1234:56:8f63::1/64
Address=2001:1234:56:8f63::2/64
IPv6AcceptRA=no
[Route]
Destination=abcd::/16
Gateway=2001:1234:56:8f63::1:1
PreferredSource=2001:1234:56:8f63::2
@@ -551,6 +551,7 @@ class NetworkdNetWorkTests(unittest.TestCase, Utilities):
'25-link-section-unmanaged.network',
'25-route-gateway.network',
'25-route-gateway-on-link.network',
'25-route-ipv6-src.network',
'25-route-reverse-order.network',
'25-route-section.network',
'25-route-tcp-window-settings.network',
@@ -784,6 +785,22 @@ class NetworkdNetWorkTests(unittest.TestCase, Utilities):
self.assertRegex(output, 'scope')
self.assertRegex(output, 'link')
def test_ip_route_ipv6_src_route(self):
# a dummy device does not make the addresses go through tentative state, so we
# reuse a bond from an earlier test, which does make the addresses go through
# tentative state, and do our test on that
self.copy_unit_to_networkd_unit_path('23-active-slave.network', '25-route-ipv6-src.network', '25-bond-active-backup-slave.netdev', '12-dummy.netdev')
self.start_networkd()
self.assertTrue(self.link_exits('dummy98'))
self.assertTrue(self.link_exits('bond199'))
output = subprocess.check_output(['ip', '-6', 'route', 'list', 'dev', 'bond199']).rstrip().decode('utf-8')
print(output)
self.assertRegex(output, 'abcd::/16')
self.assertRegex(output, 'src')
self.assertRegex(output, '2001:1234:56:8f63::2')
def test_ip_link_mac_address(self):
self.copy_unit_to_networkd_unit_path('25-address-link-section.network', '12-dummy.netdev')
self.start_networkd()