]> 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)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 27 May 2025 19:38:56 +0000 (04:38 +0900)
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.

src/network/networkd-link.c

index ccaaba25d339d3d90ef2b4b76a3fdae418d0982a..65fd8b43e3b52b490f2b4216214f6402ed5bfe2a 100644 (file)
@@ -2223,6 +2223,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);