Skip to content

Commit

Permalink
test-network: add test for static route with preferred source
Browse files Browse the repository at this point in the history
This adds possible reproducer for issue #28009 (though, the issue is
highly racy, hence this may not trigger the issue reliably).
  • Loading branch information
yuwata committed Jul 3, 2023
1 parent 7e30527 commit e4948bb
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
12 changes: 12 additions & 0 deletions test/test-network/conf/25-route-preferred-source.network
Original file line number Diff line number Diff line change
@@ -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
15 changes: 15 additions & 0 deletions test/test-network/systemd-networkd-tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -2975,6 +2975,21 @@ def test_ip_route_ipv6_src_route(self):
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()
Expand Down

0 comments on commit e4948bb

Please sign in to comment.