_set_state_full unmanaged->unavailable transition fails to bring up link on devices dynamically set to managed later
In a setup where all interfaces are explicitly unmanaged by default, and manually set to managed later via nmcli or d-bus, NetworkManager fails to bring the interface up if link wasn't already enabled by some external tool (e.g. ip link set eth0 up
).
I have attached my config file for this setup here: 10-unmanage-others.conf
I have narrowed down the issue to this line of nm-device: https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/blob/5cd6eafb2aa6fa218fabed70261670cd332680c3/src/core/devices/nm-device.c#L16627
When NetworkManager assumes control of a previously unmanaged device, the intent I believe from the above is that it should try to assume the same settings of whatever was managing the interface prior (NM_DEVICE_SYS_IFACE_STATE_ASSUME
). However, if no other utility ever configured the interface, NetworkManager will never bring link up because it's not in the NM_DEVICE_SYS_IFACE_STATE_MANAGED
state.
I propose that the above line should check whether link is entirely down in the NM_DEVICE_SYS_IFACE_STATE_ASSUME
state, and at least set IFF_UP
under these conditions. I know interfaces can have IPs set even in the down state, so those should probably be kept when assuming, but a minimal IFF_UP
seems to be needed as I'm not aware of any other means in NetworkManager to explicitly ask for IFF_UP.