add ID_NET_MANAGED_BY property support to jammy

Bug #2133220 reported by Robert Malz
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
systemd (Ubuntu)
Status tracked in Resolute
Jammy
New
Undecided
Unassigned
Noble
Fix Released
Undecided
Unassigned
Plucky
Fix Released
Undecided
Unassigned
Questing
Fix Released
Undecided
Unassigned
Resolute
Fix Released
Undecided
Unassigned

Bug Description

[ Impact ]

* This update backports support for the ID_NET_MANAGED_BY udev property to systemd-networkd in Jammy.

* Right now, networkd and NetworkManager can both try to manage the same network interfaces. This can lead to races or situations where an interface ends up configured by the wrong manager. Noble and later Ubuntu releases already include a mechanism through the ID_NET_MANAGED_BY property, which allows udev rules to make interface unmanaged by networkd.

* If ID_NET_MANAGED_BY is set to anything other than io.systemd.Network, networkd will leave that interface alone and treat it as unmanaged.
This makes it possible to reliably exclude interfaces from networkd, which matters in environments like Azure SR-IOV, where certain interfaces must not be touched by networkd or they break.

* The update contains:
  - The main feature backport [0] (commit ba87a61)
  - A follow-up fix [2] (commit 78f8d5e) which prevents networkd from taking ownership of an unmanaged interface when it is reconfigured. Without this, some setups can lose connectivity unexpectedly.

* Although this is technically a feature addition, it’s needed to correct incorrect behavior in Jammy where networkd can take over interfaces that are supposed to stay unmanaged. The property itself is opt-in and won’t affect systems that don’t use it. Newer releases already rely on this mechanism, and some users might hit issues without it.

[ Test Plan ]
* Test 1: Basic Unmanaged Case
Install the updated systemd.
Create a dummy interface:
ip link add name testdummy0 type dummy
Add a udev rule marking it as managed by something else:
echo 'SUBSYSTEM=="net", ACTION=="add|change", SUBSYSTEMS=="platform", KERNEL=="testdummy0", ENV{ID_NET_MANAGED_BY}="org.freedesktop.NetworkManager"' | \
    sudo tee /etc/udev/rules.d/99-test-managed-by.rules

Reload and trigger udev:
sudo udevadm control --reload
sudo udevadm trigger --verbose --action=add /sys/class/net/testdummy0

Check networkd:
networkctl status testdummy0

Expected state: unmanaged
Failure: anything else (managed, configuring, failed)

* Test 2: Reconfiguration
Make sure Test 1 passed.

Reload networkd:
networkctl reload

Simulate link changes:
ip link set dev testdummy0 up
ip link set dev testdummy0 down

Check again:
networkctl status testdummy0

Expected state: still unmanaged
Failure: if it becomes managed/configuring after reload or link change

[ Where problems could occur ]

* Upstream fix [2] introduced integration test test_ID_NET_MANAGED_BY which cannot be backported unless we include changes from patch [4]. This patch adds support for [Link] Property=, and might introduce more risk to this backport. As a result manual testing based on [Test Plan] should be performed.

* Change was build in PPA [5] and tested on jammy VM

* Some interfaces may become unmanaged if a third-party rule sets ID_NET_MANAGED_BY unexpectedly. This could cause loss of connectivity in edge cases.

* The backport required manual adjustment. If the logic checking and enforcing the property was backported incorrectly, it could lead to networkd failing to manage standard interfaces.

[ Other Info ]

* This functionality is already in Noble, Plucky, Questing, and Resolute.

* [1] - describes issue which [0] was fixing

* [3] - goes into details why bugfix [2] was needed

* Fix [2] is added to Noble/Plucky as part of https://bugs.launchpad.net/ubuntu/+source/systemd/+bug/2133159

Upstream links:
[0] - https://github.com/systemd/systemd/commit/ba87a61d05d637be9f0b21707f7fe3b0a74c5a05
[1] - https://github.com/systemd/systemd/issues/29768
[2] - https://github.com/systemd/systemd/commit/78f8d5ed71ecc16ad36d1c215d2d57433d127679
[3] - https://github.com/systemd/systemd/issues/36997
[4] - https://github.com/systemd/systemd/commit/046286e863f20b2d0fa7eb9a5a7ac26aa399b3fe
[5] - https://launchpad.net/~rmalz/+archive/ubuntu/sf00420640-jammy

Robert Malz (rmalz)
Changed in systemd (Ubuntu Noble):
status: New → Fix Released
Changed in systemd (Ubuntu Plucky):
status: New → Fix Released
Changed in systemd (Ubuntu Questing):
status: New → Fix Released
Changed in systemd (Ubuntu Resolute):
status: New → Fix Released
Revision history for this message
Robert Malz (rmalz) wrote :
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.