Public bug reported:

[ 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

** Affects: systemd (Ubuntu)
     Importance: Undecided
         Status: Fix Released

** Affects: systemd (Ubuntu Jammy)
     Importance: Undecided
         Status: New

** Affects: systemd (Ubuntu Noble)
     Importance: Undecided
         Status: Fix Released

** Affects: systemd (Ubuntu Plucky)
     Importance: Undecided
         Status: Fix Released

** Affects: systemd (Ubuntu Questing)
     Importance: Undecided
         Status: Fix Released

** Affects: systemd (Ubuntu Resolute)
     Importance: Undecided
         Status: Fix Released

** Also affects: systemd (Ubuntu Noble)
   Importance: Undecided
       Status: New

** Also affects: systemd (Ubuntu Resolute)
   Importance: Undecided
       Status: New

** Also affects: systemd (Ubuntu Jammy)
   Importance: Undecided
       Status: New

** Also affects: systemd (Ubuntu Plucky)
   Importance: Undecided
       Status: New

** Also affects: systemd (Ubuntu Questing)
   Importance: Undecided
       Status: New

** 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

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2133220

Title:
  add ID_NET_MANAGED_BY property support to jammy

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/systemd/+bug/2133220/+subscriptions


-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to