From 5423a92b0f7c6a301e2474eaaab293de82e824ce Mon Sep 17 00:00:00 2001 From: Beniamino Galvani Date: Tue, 21 May 2019 14:36:01 +0200 Subject: [PATCH] wifi: renew dynamic IP configuration after roaming There are some APs that require a DHCP transaction before allowing other traffic. This is meant to improve security by preventing the use of static addresses. Currently we don't renew DHCP after roaming to a new AP and this can lead to broken connectivity with APs that implement the check described above. Also, even if unlikely, the new AP could be in a different layer 3 network and so the old address could be no longer valid. Renew dynamic IP configuration after we detect the supplicant decided to roam to a new AP. Note that we only trigger a DHCP client restart; the DHCP client already implements the logic to renew the previous address and fall back to a full request in case of NAK or timeout. https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/449 --- src/devices/wifi/nm-device-wifi.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/devices/wifi/nm-device-wifi.c b/src/devices/wifi/nm-device-wifi.c index 2d97f9b117..cf849bcdc8 100644 --- a/src/devices/wifi/nm-device-wifi.c +++ b/src/devices/wifi/nm-device-wifi.c @@ -2564,6 +2564,15 @@ supplicant_iface_notify_current_bss (NMSupplicantInterface *iface, new_bssid ?: "(none)", (new_ssid_s = _nm_utils_ssid_to_string (new_ssid))); + if (new_bssid) { + /* The new AP could be in a different layer 3 network + * and so the old DHCP lease could be no longer valid. + * Also, some APs (e.g. Cisco) can be configured to drop + * all traffic until DHCP completes. To support such + * cases, renew the lease when roaming to a new AP. */ + nm_device_update_dynamic_ip_setup (NM_DEVICE (self)); + } + set_current_ap (self, new_ap, TRUE); } }