mirror of
https://github.com/systemd/systemd.git
synced 2024-12-23 21:35:11 +03:00
tests: Add test for IPv6 source routing
The test is a bit messy because it must be done on a device that enforces a tentative state for IPv6 addresses, and it appears that the dummy device does not. So we use a bond instead. Signed-off-by: Daniel Axtens <dja@axtens.net>
This commit is contained in:
parent
6aa5773bff
commit
20ca06a669
16
test/test-network/conf/25-route-ipv6-src.network
Normal file
16
test/test-network/conf/25-route-ipv6-src.network
Normal file
@ -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
|
@ -538,6 +538,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',
|
||||
@ -770,6 +771,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()
|
||||
|
Loading…
Reference in New Issue
Block a user