diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2021-06-15 05:11:33 +0900 |
---|---|---|
committer | Yu Watanabe <watanabe.yu+github@gmail.com> | 2021-06-15 05:14:22 +0900 |
commit | 710fa1b3fb679556d980759f5812ededac70a99d (patch) | |
tree | 037bda96d4f8631a04e927d7d3e341adf5bc556f | |
parent | 7f80fa12c2f4f2a1f0e6bf04a3abd7634f4605ab (diff) | |
download | systemd-710fa1b3fb679556d980759f5812ededac70a99d.tar.gz |
network: update wlan information when IFF_LOWER_UP flag is gained
Fixes the issue mentioned at
https://github.com/systemd/systemd/issues/19832#issuecomment-860269320.
-rw-r--r-- | src/network/networkd-link.c | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c index 3376a2f3e1..c3729ce681 100644 --- a/src/network/networkd-link.c +++ b/src/network/networkd-link.c @@ -1497,17 +1497,6 @@ static int link_carrier_gained(Link *link) { /* let's shortcut things for CAN which doesn't need most of what's done below. */ return 0; - r = wifi_get_info(link); - if (r < 0) - return r; - if (r > 0) { - /* All link information is up-to-date. So, it is not necessary to call RTM_GETLINK - * netlink method again. */ - r = link_reconfigure_impl(link, /* force = */ false); - if (r != 0) - return r; - } - if (IN_SET(link->state, LINK_STATE_CONFIGURING, LINK_STATE_CONFIGURED)) { r = link_acquire_dynamic_conf(link); if (r < 0) @@ -1832,7 +1821,7 @@ void link_update_operstate(Link *link, bool also_update_master) { : "") static int link_update_flags(Link *link, sd_netlink_message *message) { - bool link_was_admin_up, had_carrier; + bool link_was_lower_up, link_was_admin_up, had_carrier; uint8_t operstate; unsigned flags; int r; @@ -1894,6 +1883,7 @@ static int link_update_flags(Link *link, sd_netlink_message *message) { log_link_debug(link, "Unknown link flags lost, ignoring: %#.5x", unknown_flags_removed); } + link_was_lower_up = link->flags & IFF_LOWER_UP; link_was_admin_up = link->flags & IFF_UP; had_carrier = link_has_carrier(link); @@ -1902,6 +1892,19 @@ static int link_update_flags(Link *link, sd_netlink_message *message) { link_update_operstate(link, true); + if (!link_was_lower_up && (link->flags & IFF_LOWER_UP)) { + r = wifi_get_info(link); + if (r < 0) + return r; + if (r > 0) { + /* All link information is up-to-date. So, it is not necessary to call + * RTM_GETLINK netlink method again. */ + r = link_reconfigure_impl(link, /* force = */ false); + if (r < 0) + return r; + } + } + if (!link_was_admin_up && (link->flags & IFF_UP)) { log_link_info(link, "Link UP"); |