diff options
author | Thomas Haller <thaller@redhat.com> | 2023-03-21 09:08:20 +0100 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2023-03-27 08:54:47 +0200 |
commit | 15101447c327044d8657ef961245fa9b703880aa (patch) | |
tree | 7867bdf75578a328a46b59cdfa7662952005719d | |
parent | e773559d9d92b6a59295629e41541345cf97f615 (diff) |
device: also configure MTU while assuming devices
The sys-iface-state "assume" means to gracefully take over a device (for
example, after a restart). The end result is a fully managed interface.
The flag only has meaning while activating, and for most practical
purposes, such devices should be treated the same as fully activated
ones.
Without this, the MTU is not reset until the device reaches fully
activated state, at which point the sys-iface-state switches from
"assume" to "managed". With the previous commit, at that point we also
schedule an idle commit, which ends up also setting the MTU. Before
that, the MTU was only reset some undefined time later, when we happened
to do another NML3Cfg commit. Nonetheless, even waiting until we reach
fully activated state is wrong. Also during activation, commit the MTU.
I guess, what theoretically could happen is that we get our MTU via
ip-config (like DHCP). Then, during assuming we hit _commit_mtu()
without having the DHCP lease yet. This happens after a restart, so it
would be wrong to first reset the MTU, before we re-receive the DHCP
lease. However, if the MTU is really to be set due via
NM_DEVICE_MTU_SOURCE_IP_CONFIG, then all other MTU sources are also not
in effect (because ip-config has a low priority). In that case, we would
not have an MTU to reset and the code would not commit a new MTU. Thus
this should still be fine, also during activation when we didn't yet get
the DHCP lease (or other information to dynamically set the MTU).
-rw-r--r-- | src/core/devices/nm-device.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/src/core/devices/nm-device.c b/src/core/devices/nm-device.c index f305ddeb7d..6723d1415a 100644 --- a/src/core/devices/nm-device.c +++ b/src/core/devices/nm-device.c @@ -11327,10 +11327,8 @@ _commit_mtu(NMDevice *self) if (ifindex <= 0) return; - if (!nm_device_get_applied_connection(self) - || nm_device_sys_iface_state_is_external_or_assume(self)) { - /* we don't tamper with the MTU of disconnected and - * external/assumed devices. */ + if (!nm_device_get_applied_connection(self) || nm_device_sys_iface_state_is_external(self)) { + /* we don't tamper with the MTU of disconnected and external devices. */ return; } |