]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
network: do not recall link_handle_bound_by_list() or so when the interface is reconf...
authorYu Watanabe <watanabe.yu+github@gmail.com>
Sun, 14 Nov 2021 02:51:58 +0000 (11:51 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Sun, 14 Nov 2021 02:52:49 +0000 (11:52 +0900)
src/network/networkd-link.c

index 5136a8820e3be7c7251cf8352fb459926c866dd2..62c06af1221839f7228f9bb04ad25d856243377d 100644 (file)
@@ -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;