summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLubomir Rintel <lkundrak@v3.sk>2022-05-05 10:29:31 +0200
committerLubomir Rintel <lkundrak@v3.sk>2022-05-10 21:41:19 +0200
commitb0240418b3b27f51034cfe6dddde562a44e2c730 (patch)
tree1a9e916f5a8e563de47c0c0e0ce038016efc8328
parent41291ef773f7628a179f19a271239fd2676ffa37 (diff)
bridge: assume wired settings are therelr/bridge-wired
We can now assert instead of checking. Also, let's move the whole get-the-mtu part down closer to where it is actually used. https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1208
-rw-r--r--src/core/devices/nm-device-bridge.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/core/devices/nm-device-bridge.c b/src/core/devices/nm-device-bridge.c
index 7b7053296c..dcdd160195 100644
--- a/src/core/devices/nm-device-bridge.c
+++ b/src/core/devices/nm-device-bridge.c
@@ -1090,10 +1090,6 @@ create_and_realize(NMDevice *device,
s_bridge = nm_connection_get_setting_bridge(connection);
nm_assert(s_bridge);
- s_wired = nm_connection_get_setting_wired(connection);
- if (s_wired)
- mtu = nm_setting_wired_get_mtu(s_wired);
-
hwaddr = nm_setting_bridge_get_mac_address(s_bridge);
if (!hwaddr
&& nm_device_hw_addr_get_cloned(device, connection, FALSE, &hwaddr_cloned, NULL, NULL)) {
@@ -1118,6 +1114,11 @@ create_and_realize(NMDevice *device,
_platform_lnk_bridge_init_from_setting(s_bridge, &props);
+ s_wired = nm_connection_get_setting_wired(connection);
+ nm_assert(s_wired);
+
+ mtu = nm_setting_wired_get_mtu(s_wired);
+
/* If mtu != 0, we set the MTU of the new bridge at creation time. However, kernel will still
* automatically adjust the MTU of the bridge based on the minimum of the slave's MTU.
* We don't want this automatism as the user asked for a fixed MTU.