Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A workaround for NetworkManager #72

Open
YukariChiba opened this issue Sep 11, 2024 · 1 comment
Open

A workaround for NetworkManager #72

YukariChiba opened this issue Sep 11, 2024 · 1 comment

Comments

@YukariChiba
Copy link

From the documentation of NetworkManager:
(https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/blob/main/docs/internal/device.md)

PLATFORM_INIT: NetworkManager is waiting for udev to announce the device. Note that NetworkManager can't touch the device until then because udev might perform operations on it (such as renaming or changing the MAC). Unrealized devices (see later) have this flag set.

udev needs to do the right things to make networkmanager think it's ready (but I haven't figured out exactly what those things are)

a simple solution is to enable force_platform_init by default in src/core/devices/nm-device.c:

--- a/src/core/devices/nm-device.c
+++ b/src/core/devices/nm-device.c
@@ -7690,7 +7690,7 @@
                         assume_state_connection_uuid,
                         set_nm_owned,
                         unmanaged_user_explicit,
-                        FALSE);
+                        TRUE);
     return TRUE;
 }

note that this workaround means that network interfaces should not be touched by udev, e.g. by modifying the mac or naming

@JulianDroske
Copy link

JulianDroske commented Jan 14, 2025

Update Jan 17 2025

With the method below, NM (with libudev-zero) works fine BEFORE mdev starts. But NM would not think a device is ready without udev/eudev for now. We are working on it.


No need to patch since libudev-zero works with it now.

Use the helper (contrib/helper.c) in mdev.conf like this, but under the rule SUBSYSTEM=net;.*. Using the rule -.* also make sense, not recommended though.

See also

If you want to do something before notifying NetworkManager, like running a script that configure network interfaces in mdev.conf, just execute the helper in the script where you think the work is done.

This trick works on my system without running udev or eudev, so please let me know if not work on yours.


Actually It's about the hotplugging capability mentioned in README.md.

NetworkManager relies on it, explicitly the udev's monitor function and will start to use a real network interface (will switch from unmanaged state) only after udev notifies the corresponding ADD event with necessary information like:

ACTION=add SUBSYSTEM=net SEQNUM=16 DEVPATH=/devices/... IFINDEX=1

And the helper actually works if NetworkManager also uses libudev-zero, which answers the "NetworkManager - needs investigation" in README.md.

See also

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants