]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
network/link: update state file when master ifindex is changed
authorYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 27 May 2025 17:09:52 +0000 (02:09 +0900)
committerLuca Boccassi <luca.boccassi@gmail.com>
Wed, 25 Jun 2025 17:17:42 +0000 (18:17 +0100)
If master ifindex is non-zero, then the carrier state and operational
state of the interface may be the enslaved state.
As the operational state is saved in link state file, and read by
wait-online, we need to update the state file when the master ifindex is
changed.

(cherry picked from commit 7dde00ca57cf20a5d71e580d0bc6173f454095e5)
(cherry picked from commit e9655c7865d632bd05437f8ebd4264a13b8011e4)

src/network/networkd-link.c

index 85bce825604ea186f483949d6a84f2df8dd9e821..47145a83447bf6b829131a7e936a9cae95e86d37 100644 (file)
@@ -2191,6 +2191,9 @@ static int link_update_master(Link *link, sd_netlink_message *message) {
 
                 link_drop_from_master(link);
                 link->master_ifindex = master_ifindex;
+
+                /* Updating master ifindex may cause operational state change, e.g. carrier <-> enslaved */
+                link_dirty(link);
         }
 
         r = link_append_to_master(link);