test-network: add test for static route with preferred source

This adds possible reproducer for issue #28009 (though, the issue is
highly racy, hence this may not trigger the issue reliably).
This commit is contained in:
Yu Watanabe 2023-07-03 16:04:30 +09:00
parent 7e30527806
commit e4948bb2cd
2 changed files with 27 additions and 0 deletions

View file

@ -0,0 +1,12 @@
# SPDX-License-Identifier: LGPL-2.1-or-later
[Match]
Name=dummy98
[Network]
Address=2001:1234:56:8f63::1/64
IPv6AcceptRA=no
[Route]
Destination=abcd::/16
Gateway=2001:1234:56:8f63::1:1
PreferredSource=2001:1234:56:8f63::1

View file

@ -2975,6 +2975,21 @@ class NetworkdNetworkTests(unittest.TestCase, Utilities):
print(output)
self.assertIn('abcd::/16 via 2001:1234:56:8f63::1:1 proto static src 2001:1234:56:8f63::2', output)
def test_route_preferred_source_with_existing_address(self):
# See issue #28009.
copy_network_unit('25-route-preferred-source.network', '12-dummy.netdev')
start_networkd()
for i in range(3):
if i != 0:
networkctl_reconfigure('dummy98')
self.wait_online(['dummy98:routable'])
output = check_output('ip -6 route list dev dummy98')
print(output)
self.assertIn('abcd::/16 via 2001:1234:56:8f63::1:1 proto static src 2001:1234:56:8f63::1', output)
def test_ip_link_mac_address(self):
copy_network_unit('25-address-link-section.network', '12-dummy.netdev')
start_networkd()