mirror of
https://github.com/systemd/systemd.git
synced 2025-02-02 13:47:27 +03:00
test-network: add test case for issue #35047
This commit is contained in:
parent
688f166972
commit
7f1b36a82a
10
test/test-network/conf/25-route-static-issue-35047.network
Normal file
10
test/test-network/conf/25-route-static-issue-35047.network
Normal file
@ -0,0 +1,10 @@
|
||||
# SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
[Match]
|
||||
Name=dummy98
|
||||
|
||||
[Network]
|
||||
IPv6AcceptRA=no
|
||||
|
||||
[Route]
|
||||
Destination=198.51.100.0/24
|
||||
Gateway=192.0.2.2
|
@ -0,0 +1,4 @@
|
||||
# SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
[Address]
|
||||
Address=192.0.2.1/32
|
||||
Peer=192.0.2.2/32
|
@ -0,0 +1,6 @@
|
||||
# SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
[Address]
|
||||
Address=192.0.2.1/32
|
||||
|
||||
[Route]
|
||||
Destination=192.0.2.2/32
|
@ -4050,6 +4050,46 @@ class NetworkdNetworkTests(unittest.TestCase, Utilities):
|
||||
with self.subTest(manage_foreign_routes=manage_foreign_routes):
|
||||
self._test_route_static(manage_foreign_routes)
|
||||
|
||||
def test_route_static_issue_35047(self):
|
||||
copy_network_unit(
|
||||
'25-route-static-issue-35047.network',
|
||||
'25-route-static-issue-35047.network.d/step1.conf',
|
||||
'12-dummy.netdev',
|
||||
copy_dropins=False)
|
||||
start_networkd()
|
||||
self.wait_online('dummy98:routable')
|
||||
|
||||
print('### ip -4 route show table all dev dummy98')
|
||||
output = check_output('ip -4 route show table all dev dummy98')
|
||||
print(output)
|
||||
self.assertIn('192.0.2.2 proto kernel scope link src 192.0.2.1', output)
|
||||
self.assertIn('local 192.0.2.1 table local proto kernel scope host src 192.0.2.1', output)
|
||||
self.assertIn('198.51.100.0/24 via 192.0.2.2 proto static', output)
|
||||
|
||||
check_output('ip link set dev dummy98 down')
|
||||
self.wait_route_dropped('dummy98', '192.0.2.2 proto kernel scope link src 192.0.2.1', ipv='-4', table='all', timeout_sec=10)
|
||||
self.wait_route_dropped('dummy98', 'local 192.0.2.1 table local proto kernel scope host src 192.0.2.1', ipv='-4', table='all', timeout_sec=10)
|
||||
self.wait_route_dropped('dummy98', '198.51.100.0/24 via 192.0.2.2 proto static', ipv='-4', table='all', timeout_sec=10)
|
||||
|
||||
print('### ip -4 route show table all dev dummy98')
|
||||
output = check_output('ip -4 route show table all dev dummy98')
|
||||
print(output)
|
||||
self.assertNotIn('192.0.2.2', output)
|
||||
self.assertNotIn('192.0.2.1', output)
|
||||
self.assertNotIn('198.51.100.0/24', output)
|
||||
|
||||
remove_network_unit('25-route-static-issue-35047.network.d/step1.conf')
|
||||
copy_network_unit('25-route-static-issue-35047.network.d/step2.conf')
|
||||
networkctl_reload()
|
||||
self.wait_online('dummy98:routable')
|
||||
|
||||
print('### ip -4 route show table all dev dummy98')
|
||||
output = check_output('ip -4 route show table all dev dummy98')
|
||||
print(output)
|
||||
self.assertIn('192.0.2.2 proto static scope link', output)
|
||||
self.assertIn('local 192.0.2.1 table local proto kernel scope host src 192.0.2.1', output)
|
||||
self.assertIn('198.51.100.0/24 via 192.0.2.2 proto static', output)
|
||||
|
||||
@expectedFailureIfRTA_VIAIsNotSupported()
|
||||
def test_route_via_ipv6(self):
|
||||
copy_network_unit('25-route-via-ipv6.network', '12-dummy.netdev')
|
||||
|
Loading…
x
Reference in New Issue
Block a user