diff options
author | Lubomir Rintel <lkundrak@v3.sk> | 2014-11-13 16:42:45 +0100 |
---|---|---|
committer | Lubomir Rintel <lkundrak@v3.sk> | 2014-11-13 16:42:45 +0100 |
commit | 46c869b2959f5c396ab150145d8c2e60218cc212 (patch) | |
tree | b56ed0a3efa0a9719ecc0835e7c99dffed21dce4 | |
parent | beec6c87ffb049d785343cc19986d6719a435cff (diff) | |
parent | 38bf08ec44f7180322c43a8bc16b756ff74ea2ea (diff) | |
download | NetworkManager-46c869b2959f5c396ab150145d8c2e60218cc212.tar.gz |
merge: wifi bssid handling fixes
Avoid passing NULL bssid where it does not make sense, fix a couple of bad
asserts.
https://bugzilla.gnome.org/show_bug.cgi?id=739258
-rw-r--r-- | src/devices/wifi/nm-device-wifi.c | 19 | ||||
-rw-r--r-- | src/devices/wifi/nm-wifi-ap.c | 4 |
2 files changed, 10 insertions, 13 deletions
diff --git a/src/devices/wifi/nm-device-wifi.c b/src/devices/wifi/nm-device-wifi.c index f8b4c2a3d6..3e8d02d0e1 100644 --- a/src/devices/wifi/nm-device-wifi.c +++ b/src/devices/wifi/nm-device-wifi.c @@ -395,7 +395,7 @@ find_active_ap (NMDeviceWifi *self, ap_ssid ? "'" : "", ap_ssid ? nm_utils_escape_ssid (ap_ssid->data, ap_ssid->len) : "(none)", ap_ssid ? "'" : "", - ap_bssid); + str_if_set (ap_bssid, "(none)")); if (ap == ignore_ap) { _LOGD (LOGD_WIFI, " ignored"); @@ -460,14 +460,13 @@ find_active_ap (NMDeviceWifi *self, * we can't match the AP based on frequency at all, just give up. */ if (match_nofreq && ((found_a_band != found_bg_band) || (devfreq == 0))) { - const char *ap_bssid = nm_ap_get_address (match_nofreq); const GByteArray *ap_ssid = nm_ap_get_ssid (match_nofreq); _LOGD (LOGD_WIFI, " matched %s%s%s %s", ap_ssid ? "'" : "", ap_ssid ? nm_utils_escape_ssid (ap_ssid->data, ap_ssid->len) : "(none)", ap_ssid ? "'" : "", - ap_bssid); + str_if_set (nm_ap_get_address (match_nofreq), "(none)")); active_ap = match_nofreq; goto done; @@ -1699,12 +1698,12 @@ merge_scanned_ap (NMDeviceWifi *self, if (ssid && (nm_utils_is_empty_ssid (ssid->data, ssid->len) == FALSE)) { /* Yay, matched it, no longer treat as hidden */ _LOGD (LOGD_WIFI_SCAN, "matched hidden AP %s => '%s'", - bssid, nm_utils_escape_ssid (ssid->data, ssid->len)); + str_if_set (bssid, "(none)"), nm_utils_escape_ssid (ssid->data, ssid->len)); nm_ap_set_broadcast (merge_ap, FALSE); } else { /* Didn't have an entry for this AP in the database */ _LOGD (LOGD_WIFI_SCAN, "failed to match hidden AP %s", - bssid); + str_if_set (bssid, "(none)")); } } @@ -1723,7 +1722,7 @@ merge_scanned_ap (NMDeviceWifi *self, if (found_ap) { _LOGD (LOGD_WIFI_SCAN, "merging AP '%s' %s (%p) with existing (%p)", ssid ? nm_utils_escape_ssid (ssid->data, ssid->len) : "(none)", - bssid, + str_if_set (bssid, "(none)"), merge_ap, found_ap); @@ -1745,7 +1744,7 @@ merge_scanned_ap (NMDeviceWifi *self, /* New entry in the list */ _LOGD (LOGD_WIFI_SCAN, "adding new AP '%s' %s (%p)", ssid ? nm_utils_escape_ssid (ssid->data, ssid->len) : "(none)", - bssid, merge_ap); + str_if_set (bssid, "(none)"), merge_ap); g_object_ref (merge_ap); priv->ap_list = g_slist_prepend (priv->ap_list, merge_ap); @@ -1801,14 +1800,12 @@ cull_scan_list (NMDeviceWifi *self) /* Remove outdated APs */ for (elt = outdated_list; elt; elt = g_slist_next (elt)) { NMAccessPoint *outdated_ap = NM_AP (elt->data); - const char *bssid; const GByteArray *ssid; - bssid = nm_ap_get_address (outdated_ap); ssid = nm_ap_get_ssid (outdated_ap); _LOGD (LOGD_WIFI_SCAN, " removing %s (%s%s%s)", - bssid, + str_if_set (nm_ap_get_address (outdated_ap), "(none)"), ssid ? "'" : "", ssid ? nm_utils_escape_ssid (ssid->data, ssid->len) : "(none)", ssid ? "'" : ""); @@ -3015,7 +3012,7 @@ activation_success_handler (NMDevice *device) * the BSSID off the card and fill in the BSSID of the activation AP. */ nm_platform_wifi_get_bssid (ifindex, bssid); - if (!nm_ethernet_address_is_valid (nm_ap_get_address (ap), -1)) { + if (!nm_ap_get_address (ap)) { char *bssid_str = nm_utils_hwaddr_ntoa (bssid, ETH_ALEN); nm_ap_set_address (ap, bssid_str); g_free (bssid_str); diff --git a/src/devices/wifi/nm-wifi-ap.c b/src/devices/wifi/nm-wifi-ap.c index 0c252218fa..c775940f09 100644 --- a/src/devices/wifi/nm-wifi-ap.c +++ b/src/devices/wifi/nm-wifi-ap.c @@ -725,7 +725,7 @@ nm_ap_dump (NMAccessPoint *ap, const char *prefix) prefix, priv->ssid ? nm_utils_escape_ssid (priv->ssid->data, priv->ssid->len) : "(none)", ap); - nm_log_dbg (LOGD_WIFI_SCAN, " BSSID %s", priv->address); + nm_log_dbg (LOGD_WIFI_SCAN, " BSSID %s", str_if_set (priv->address, "(none)")); nm_log_dbg (LOGD_WIFI_SCAN, " mode %d", priv->mode); nm_log_dbg (LOGD_WIFI_SCAN, " flags 0x%X", priv->flags); nm_log_dbg (LOGD_WIFI_SCAN, " wpa flags 0x%X", priv->wpa_flags); @@ -1129,7 +1129,7 @@ nm_ap_check_compatible (NMAccessPoint *self, return FALSE; bssid = nm_setting_wireless_get_bssid (s_wireless); - if (bssid && !nm_utils_hwaddr_matches (bssid, -1, priv->address, -1)) + if (bssid && (!priv->address || !nm_utils_hwaddr_matches (bssid, -1, priv->address, -1))) return FALSE; mode = nm_setting_wireless_get_mode (s_wireless); |