mirror of
https://github.com/systemd/systemd
synced 2024-07-21 10:17:21 +00:00
parent
b15ed2be2f
commit
29fbbb1389
|
@ -1,6 +1,7 @@
|
|||
# SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
[Match]
|
||||
Name=client-p
|
||||
Name=router-p
|
||||
Name=router-high-p
|
||||
Name=router-low-p
|
||||
|
||||
|
|
18
test/test-network/conf/25-veth-router-hop-limit.network
Normal file
18
test/test-network/conf/25-veth-router-hop-limit.network
Normal file
|
@ -0,0 +1,18 @@
|
|||
# SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
[Match]
|
||||
Name=router
|
||||
|
||||
[Network]
|
||||
IPv6AcceptRA=no
|
||||
IPv6SendRA=yes
|
||||
|
||||
[IPv6SendRA]
|
||||
RouterPreference=high
|
||||
EmitDNS=no
|
||||
EmitDomains=no
|
||||
HopLimit=42
|
||||
|
||||
[IPv6Prefix]
|
||||
Prefix=2002:da8:1:99::/64
|
||||
PreferredLifetimeSec=1000s
|
||||
ValidLifetimeSec=2100s
|
9
test/test-network/conf/25-veth-router.netdev
Normal file
9
test/test-network/conf/25-veth-router.netdev
Normal file
|
@ -0,0 +1,9 @@
|
|||
# SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
[NetDev]
|
||||
Name=router
|
||||
Kind=veth
|
||||
MACAddress=12:34:56:78:9a:99
|
||||
|
||||
[Peer]
|
||||
Name=router-p
|
||||
MACAddress=12:34:56:78:9b:99
|
|
@ -5288,6 +5288,37 @@ class NetworkdRATests(unittest.TestCase, Utilities):
|
|||
self.assertIn('2002:da8:1:0:b47e:7975:fc7a:7d6e', output)
|
||||
self.assertIn('2002:da8:2:0:f689:561a:8eda:7443', output)
|
||||
|
||||
def check_router_hop_limit(self, hop_limit):
|
||||
self.wait_route('client', rf'default via fe80::1034:56ff:fe78:9a99 proto ra .* hoplimit {hop_limit}', ipv='-6', timeout_sec=10)
|
||||
|
||||
output = check_output('ip -6 route show dev client default via fe80::1034:56ff:fe78:9a99')
|
||||
print(output)
|
||||
self.assertIn(f'hoplimit {hop_limit}', output)
|
||||
|
||||
self.check_ipv6_sysctl_attr('client', 'hop_limit', f'{hop_limit}')
|
||||
|
||||
def test_router_hop_limit(self):
|
||||
copy_network_unit('25-veth-client.netdev',
|
||||
'25-veth-router.netdev',
|
||||
'26-bridge.netdev',
|
||||
'25-veth-bridge.network',
|
||||
'25-veth-client.network',
|
||||
'25-veth-router-hop-limit.network',
|
||||
'25-bridge99.network')
|
||||
start_networkd()
|
||||
self.wait_online('client-p:enslaved',
|
||||
'router:degraded', 'router-p:enslaved',
|
||||
'bridge99:routable')
|
||||
|
||||
self.check_router_hop_limit(42)
|
||||
|
||||
with open(os.path.join(network_unit_dir, '25-veth-router-hop-limit.network'), mode='a', encoding='utf-8') as f:
|
||||
f.write('\n[IPv6SendRA]\nHopLimit=43\n')
|
||||
|
||||
networkctl_reload()
|
||||
|
||||
self.check_router_hop_limit(43)
|
||||
|
||||
def test_router_preference(self):
|
||||
copy_network_unit('25-veth-client.netdev',
|
||||
'25-veth-router-high.netdev',
|
||||
|
|
Loading…
Reference in a new issue