summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2020-10-27 13:44:08 +0100
committerThomas Haller <thaller@redhat.com>2020-10-27 14:10:35 +0100
commiteb36380335d39a3959135453be4dccd561405a5b (patch)
treece95d653cf0152c1a23f23e1f5cbf7560d3f782b
parent9a935e516e7015ef3a9224e034b8de9933e584d5 (diff)
downloadNetworkManager-eb36380335d39a3959135453be4dccd561405a5b.tar.gz
device/wifi: don't reset the SSID of a NMWifiAP to unknown
For hidden networks, we usually don't have an SSID. We try to match and fill the SSID based on the profiles that we have: <debug> [1603798852.9918] device[6b383dca267b6878] (wlp2s0): matched hidden AP AA:BB:CC:DD:EE:FF => "SSID" However, we should not clear that value again on the next update: <trace> [1603798856.5724] sup-iface[66c1a0883a262394,0,wlp2s0]: BSS /fi/w1/wpa_supplicant1/Interfaces/0/BSSs/3 updated <debug> [1603798856.5726] device[6b383dca267b6878] (wlp2s0): wifi-ap: updated AA:BB:CC:DD:EE:FF (none) Once we have a SSID, we can only update it to a better value, but not clear it. https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/438 Fixes: b83f07916a54 ('supplicant: large rework of wpa_supplicant handling')
-rw-r--r--src/devices/wifi/nm-wifi-ap.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/src/devices/wifi/nm-wifi-ap.c b/src/devices/wifi/nm-wifi-ap.c
index fe26421df5..55438a53e4 100644
--- a/src/devices/wifi/nm-wifi-ap.c
+++ b/src/devices/wifi/nm-wifi-ap.c
@@ -113,22 +113,26 @@ nm_wifi_ap_set_ssid(NMWifiAP *ap, GBytes *ssid)
g_return_val_if_fail(NM_IS_WIFI_AP(ap), FALSE);
- if (ssid) {
- l = g_bytes_get_size(ssid);
- if (l == 0 || l > 32)
- g_return_val_if_reached(FALSE);
+ if (!ssid) {
+ /* we don't clear the SSID, once we have it. We can only update
+ * it by a better value. */
+ return FALSE;
}
+ l = g_bytes_get_size(ssid);
+ if (l == 0 || l > 32)
+ g_return_val_if_reached(FALSE);
+
priv = NM_WIFI_AP_GET_PRIVATE(ap);
if (ssid == priv->ssid)
return FALSE;
- if (ssid && priv->ssid && g_bytes_equal(ssid, priv->ssid))
+ if (priv->ssid && g_bytes_equal(ssid, priv->ssid))
return FALSE;
+ g_bytes_ref(ssid);
nm_clear_pointer(&priv->ssid, g_bytes_unref);
- if (ssid)
- priv->ssid = g_bytes_ref(ssid);
+ priv->ssid = ssid;
_notify(ap, PROP_SSID);
return TRUE;