mirror of
https://github.com/systemd/systemd-stable.git
synced 2024-12-24 21:34:08 +03:00
Merge pull request #21209 from yuwata/veth-peer-mtu
network: also set MTU for veth peer interface
This commit is contained in:
commit
db2aef5a1d
@ -34,6 +34,12 @@ static int netdev_veth_fill_message_create(NetDev *netdev, Link *link, sd_netlin
|
||||
return log_netdev_error_errno(netdev, r, "Could not append IFLA_ADDRESS attribute: %m");
|
||||
}
|
||||
|
||||
if (netdev->mtu != 0) {
|
||||
r = sd_netlink_message_append_u32(m, IFLA_MTU, netdev->mtu);
|
||||
if (r < 0)
|
||||
return log_netdev_error_errno(netdev, r, "Could not append IFLA_MTU attribute: %m");
|
||||
}
|
||||
|
||||
r = sd_netlink_message_close_container(m);
|
||||
if (r < 0)
|
||||
return log_netdev_error_errno(netdev, r, "Could not append IFLA_INFO_DATA attribute: %m");
|
||||
|
10
test/test-network/conf/25-veth-mtu.netdev
Normal file
10
test/test-network/conf/25-veth-mtu.netdev
Normal file
@ -0,0 +1,10 @@
|
||||
# SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
[NetDev]
|
||||
Name=veth-mtu
|
||||
Kind=veth
|
||||
MACAddress=12:34:56:78:9a:be
|
||||
MTUBytes=1800
|
||||
|
||||
[Peer]
|
||||
Name=veth-mtu-peer
|
||||
MACAddress=12:34:56:78:9a:bf
|
@ -8,6 +8,8 @@ Name=macvlan99
|
||||
Name=macvtap99
|
||||
Name=veth99
|
||||
Name=veth-peer
|
||||
Name=veth-mtu
|
||||
Name=veth-mtu-peer
|
||||
Name=vcan99
|
||||
Name=vxcan99
|
||||
Name=vxcan-peer
|
||||
|
@ -904,6 +904,7 @@ class NetworkdNetDevTests(unittest.TestCase, Utilities):
|
||||
'test1',
|
||||
'tun99',
|
||||
'vcan99',
|
||||
'veth-mtu',
|
||||
'veth99',
|
||||
'vlan99',
|
||||
'vrf99',
|
||||
@ -994,6 +995,7 @@ class NetworkdNetDevTests(unittest.TestCase, Utilities):
|
||||
'25-tunnel-remote-any.network',
|
||||
'25-tunnel.network',
|
||||
'25-vcan.netdev',
|
||||
'25-veth-mtu.netdev',
|
||||
'25-veth.netdev',
|
||||
'25-vrf.netdev',
|
||||
'25-vti6-tunnel-any-any.netdev',
|
||||
@ -1282,10 +1284,11 @@ class NetworkdNetDevTests(unittest.TestCase, Utilities):
|
||||
self.assertRegex(output, 'ipvtap *mode ' + mode.lower() + ' ' + flag)
|
||||
|
||||
def test_veth(self):
|
||||
copy_unit_to_networkd_unit_path('25-veth.netdev', 'netdev-link-local-addressing-yes.network')
|
||||
copy_unit_to_networkd_unit_path('25-veth.netdev', 'netdev-link-local-addressing-yes.network',
|
||||
'25-veth-mtu.netdev')
|
||||
start_networkd()
|
||||
|
||||
self.wait_online(['veth99:degraded', 'veth-peer:degraded'])
|
||||
self.wait_online(['veth99:degraded', 'veth-peer:degraded', 'veth-mtu:degraded', 'veth-mtu-peer:degraded'])
|
||||
|
||||
output = check_output('ip -d link show veth99')
|
||||
print(output)
|
||||
@ -1294,6 +1297,15 @@ class NetworkdNetDevTests(unittest.TestCase, Utilities):
|
||||
print(output)
|
||||
self.assertRegex(output, 'link/ether 12:34:56:78:9a:bd')
|
||||
|
||||
output = check_output('ip -d link show veth-mtu')
|
||||
print(output)
|
||||
self.assertRegex(output, 'link/ether 12:34:56:78:9a:be')
|
||||
self.assertRegex(output, 'mtu 1800')
|
||||
output = check_output('ip -d link show veth-mtu-peer')
|
||||
print(output)
|
||||
self.assertRegex(output, 'link/ether 12:34:56:78:9a:bf')
|
||||
self.assertRegex(output, 'mtu 1800')
|
||||
|
||||
def test_tun(self):
|
||||
copy_unit_to_networkd_unit_path('25-tun.netdev')
|
||||
start_networkd()
|
||||
|
Loading…
Reference in New Issue
Block a user