From b7ac12843020201b2792378ae4af7580e75015ea Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Sun, 14 Nov 2021 11:51:58 +0900 Subject: [PATCH] network: do not recall link_handle_bound_by_list() or so when the interface is reconfigured --- src/network/networkd-link.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c index 5136a8820e..62c06af122 100644 --- a/src/network/networkd-link.c +++ b/src/network/networkd-link.c @@ -1584,6 +1584,16 @@ static int link_carrier_gained(Link *link) { assert(link); + if (IN_SET(link->state, LINK_STATE_CONFIGURING, LINK_STATE_CONFIGURED)) { + /* At this stage, both wlan and link information should be up-to-date. Hence, + * it is not necessary to call RTM_GETLINK, NL80211_CMD_GET_INTERFACE, or + * NL80211_CMD_GET_STATION commands, and simply call link_reconfigure_impl(). + * Note, link_reconfigure_impl() returns 1 when the link is reconfigured. */ + r = link_reconfigure_impl(link, /* force = */ false); + if (r != 0) + return r; + } + r = link_handle_bound_by_list(link); if (r < 0) return r; @@ -1957,15 +1967,6 @@ static int link_update_flags(Link *link, sd_netlink_message *message) { if (!had_carrier && link_has_carrier(link)) { log_link_info(link, "Gained carrier"); - if (IN_SET(link->state, LINK_STATE_CONFIGURING, LINK_STATE_CONFIGURED)) { - /* At this stage, both wlan and link information should be up-to-date. Hence, - * it is not necessary to call RTM_GETLINK, NL80211_CMD_GET_INTERFACE, or - * NL80211_CMD_GET_STATION commands, and simply call link_reconfigure_impl(). */ - r = link_reconfigure_impl(link, /* force = */ false); - if (r < 0) - return r; - } - r = link_carrier_gained(link); if (r < 0) return r; -- 2.25.1