summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLuca Boccassi <bluca@debian.org>2022-11-22 13:37:15 +0100
committerGitHub <noreply@github.com>2022-11-22 13:37:15 +0100
commitd4b3ae65f36fdddda2700a7aab7fd5ba3518bd95 (patch)
tree92e89bc9f5d07cfc323005e78cf779e7fe2eca2f /src
parentman/journalctl: mention systemd-cat, make the description more direct (diff)
parentnetwork: wifi: try to reconfigure when connected (diff)
downloadsystemd-d4b3ae65f36fdddda2700a7aab7fd5ba3518bd95.tar.xz
systemd-d4b3ae65f36fdddda2700a7aab7fd5ba3518bd95.zip
Merge pull request #25477 from yuwata/network-wifi-reconfigure-on-connect
network: wifi: try to reconfigure when connected
Diffstat (limited to 'src')
-rw-r--r--src/network/networkd-link.c2
-rw-r--r--src/network/networkd-link.h2
-rw-r--r--src/network/networkd-wifi.c12
3 files changed, 14 insertions, 2 deletions
diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c
index 4ed622cfe6..c46b8f5b2e 100644
--- a/src/network/networkd-link.c
+++ b/src/network/networkd-link.c
@@ -1178,7 +1178,7 @@ static int link_get_network(Link *link, Network **ret) {
return -ENOENT;
}
-static int link_reconfigure_impl(Link *link, bool force) {
+int link_reconfigure_impl(Link *link, bool force) {
Network *network = NULL;
NetDev *netdev = NULL;
int r;
diff --git a/src/network/networkd-link.h b/src/network/networkd-link.h
index 4d397da79a..0d601ab548 100644
--- a/src/network/networkd-link.h
+++ b/src/network/networkd-link.h
@@ -238,8 +238,8 @@ int link_stop_engines(Link *link, bool may_keep_dhcp);
const char* link_state_to_string(LinkState s) _const_;
LinkState link_state_from_string(const char *s) _pure_;
+int link_reconfigure_impl(Link *link, bool force);
int link_reconfigure(Link *link, bool force);
-int link_reconfigure_after_sleep(Link *link);
int manager_udev_process_link(Manager *m, sd_device *device, sd_device_action_t action);
int manager_rtnl_process_link(sd_netlink *rtnl, sd_netlink_message *message, Manager *m);
diff --git a/src/network/networkd-wifi.c b/src/network/networkd-wifi.c
index 4bf798a9eb..62cbca0cf9 100644
--- a/src/network/networkd-wifi.c
+++ b/src/network/networkd-wifi.c
@@ -269,6 +269,18 @@ int manager_genl_process_nl80211_mlme(sd_netlink *genl, sd_netlink_message *mess
if (link->wlan_iftype == NL80211_IFTYPE_STATION && link->ssid)
log_link_info(link, "Connected WiFi access point: %s (%s)",
link->ssid, ETHER_ADDR_TO_STR(&link->bssid));
+
+ /* Sometimes, RTM_NEWLINK message with carrier is received earlier than NL80211_CMD_CONNECT.
+ * To make SSID= or other WiFi related settings in [Match] section work, let's try to
+ * reconfigure the interface. */
+ if (link->ssid && link_has_carrier(link)) {
+ r = link_reconfigure_impl(link, /* force = */ false);
+ if (r < 0) {
+ log_link_warning_errno(link, r, "Failed to reconfigure interface: %m");
+ link_enter_failed(link);
+ return 0;
+ }
+ }
break;
}
case NL80211_CMD_DISCONNECT: