Public bug reported:

[ Impact ]

 * Systemd upstream commit [0] added the new property ID_NET_MANAGED_BY
to allow system admins to explicitly choose what will manage interfaces.
(See bug tracker [1] for details).

 * However, in some cases (for example when link state changes), the
ID_NET_MANAGED_BY value is ignored, and systemd-networkd attempts to
reconfigure the interface regardless of the property value.

 * This behavior causes conflicts on systems relying on different
network managers alongside systemd-networkd.

 * This issue was fixed upstream in [2] and is associated with bug
tracker [3].

[ Test Plan ]

 * The original test plan is described in [3] and relies on rebooting VMs.
 * To test the change locally without reboots, we can use virtio interfaces on 
a VM with the ID_NET_MANAGED_BY property set via udev.

1. Create a custom udev rule to set ID_NET_MANAGED_BY:
   $ cat /etc/udev/rules.d/99-debug-unmanaged.rules
   SUBSYSTEM=="net", ACTION!="remove", KERNEL=="enp1s0", 
ENV{ID_NET_MANAGED_BY}="unmanaged", RUN+="/bin/sh -c 'logger -t debug-udev-test 
marked enp1s0 as unmanaged'"

2. Trigger the rule:
   $ udevadm trigger --verbose --action=add /sys/class/net/enp1s0

3. Check the state of the interface (Expected: unmanaged):
   $ networkctl list
   IDX LINK    TYPE      OPERATIONAL SETUP    
     1 lo      loopback  carrier     unmanaged
     2 enp1s0  ether     routable    unmanaged

4. Change the link state:
   $ ip link set enp1s0 down
   $ ip link set enp1s0 up

5. Verify state of the interface:

   [ FAIL - Current Behavior ]
   $ networkctl list
   IDX LINK    TYPE      OPERATIONAL SETUP     
     1 lo      loopback  carrier     unmanaged
     2 enp1s0  ether     routable    configured  <-- Incorrectly took control

   [ PASS - With Fix Applied ]
   $ networkctl list
   IDX LINK    TYPE      OPERATIONAL SETUP    
     1 lo      loopback  carrier     unmanaged
     2 enp1s0  ether     off         unmanaged   <-- Correctly ignored

NOTES:
- To set an interface to 'unmanaged', ID_NET_MANAGED_BY can be set to any 
string value other than "io.systemd.Network".

[ Where problems could occur ]

 * The patch modifies the logic systemd-networkd uses to determine if it
should manage an interface when link is reconfigured. If the logic is
flawed, networkd might incorrectly identify a managed interface as
"unmanaged," leading to a loss of connectivity because networkd will
refuse to configure it.

 * Users who have unknowingly set ID_NET_MANAGED_BY (via leftover udev
rules) but were previously relying on the incorrect behavior (where
networkd ignored the flag on link-change and configured the interface
anyway) will have their interfaces unmanaged.

 * Patch is already applied to questing and resolute, which reduces
risks of regression.

[ Other Info ]

 * Resolute and Questing already include the fix, the change is required in 
Noble and Plucky.
 * Jammy and older do not implement support for the ID_NET_MANAGED_BY property.

[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

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

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

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

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

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

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

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

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

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

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

Title:
  systemd-networkd does not respect ID_NET_MANAGED_BY in all cases

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


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

Reply via email to