network/link: update state file when master ifindex is changed

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.
This commit is contained in:
Yu Watanabe
2025-05-28 02:09:52 +09:00
parent f44b20b7b6
commit 7dde00ca57

View 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);