aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/drivers/driver.h7
-rw-r--r--src/drivers/driver_nl80211.c12
-rw-r--r--src/drivers/driver_wext.c8
-rw-r--r--wpa_supplicant/ctrl_iface_dbus_handlers.c9
4 files changed, 30 insertions, 6 deletions
diff --git a/src/drivers/driver.h b/src/drivers/driver.h
index c5f2106..ea0cba8 100644
--- a/src/drivers/driver.h
+++ b/src/drivers/driver.h
@@ -81,8 +81,14 @@ struct wpa_scan_result {
};
+#define WPA_SCAN_QUAL_INVALID BIT(0)
+#define WPA_SCAN_NOISE_INVALID BIT(1)
+#define WPA_SCAN_LEVEL_INVALID BIT(2)
+#define WPA_SCAN_LEVEL_DBM BIT(3)
+
/**
* struct wpa_scan_res - Scan result for an BSS/IBSS
+ * @flags: information flags about the BSS/IBSS (WPA_SCAN_*)
* @bssid: BSSID
* @freq: frequency of the channel in MHz (e.g., 2412 = channel 1)
* @beacon_int: beacon interval in TUs (host byte order)
@@ -103,6 +109,7 @@ struct wpa_scan_result {
* report all IEs to make it easier to support future additions.
*/
struct wpa_scan_res {
+ unsigned int flags;
u8 bssid[ETH_ALEN];
int freq;
u16 beacon_int;
diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
index b75c10e..2f530b2 100644
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -1769,10 +1769,16 @@ static int bss_info_handler(struct nl_msg *msg, void *arg)
r->beacon_int = nla_get_u16(bss[NL80211_BSS_BEACON_INTERVAL]);
if (bss[NL80211_BSS_CAPABILITY])
r->caps = nla_get_u16(bss[NL80211_BSS_CAPABILITY]);
- if (bss[NL80211_BSS_SIGNAL_UNSPEC])
- r->qual = nla_get_u8(bss[NL80211_BSS_SIGNAL_UNSPEC]);
- if (bss[NL80211_BSS_SIGNAL_MBM])
+ r->flags |= WPA_SCAN_NOISE_INVALID;
+ if (bss[NL80211_BSS_SIGNAL_MBM]) {
r->level = nla_get_u32(bss[NL80211_BSS_SIGNAL_MBM]);
+ r->level /= 100; /* mBm to dBm */
+ r->flags |= WPA_SCAN_LEVEL_DBM | WPA_SCAN_QUAL_INVALID;
+ } else if (bss[NL80211_BSS_SIGNAL_UNSPEC]) {
+ r->level = nla_get_u8(bss[NL80211_BSS_SIGNAL_UNSPEC]);
+ r->flags |= WPA_SCAN_LEVEL_INVALID;
+ } else
+ r->flags |= WPA_SCAN_LEVEL_INVALID | WPA_SCAN_QUAL_INVALID;
if (bss[NL80211_BSS_TSF])
r->tsf = nla_get_u64(bss[NL80211_BSS_TSF]);
r->ie_len = ie_len;
diff --git a/src/drivers/driver_wext.c b/src/drivers/driver_wext.c
index 1c9105b..e6242da 100644
--- a/src/drivers/driver_wext.c
+++ b/src/drivers/driver_wext.c
@@ -1267,6 +1267,14 @@ static void wext_get_scan_qual(struct iw_event *iwe,
res->res.qual = iwe->u.qual.qual;
res->res.noise = iwe->u.qual.noise;
res->res.level = iwe->u.qual.level;
+ if (iwe->u.qual.updated & IW_QUAL_QUAL_INVALID)
+ res->res.flags |= WPA_SCAN_QUAL_INVALID;
+ if (iwe->u.qual.updated & IW_QUAL_LEVEL_INVALID)
+ res->res.flags |= WPA_SCAN_LEVEL_INVALID;
+ if (iwe->u.qual.updated & IW_QUAL_NOISE_INVALID)
+ res->res.flags |= WPA_SCAN_NOISE_INVALID;
+ if (iwe->u.qual.updated & IW_QUAL_DBM)
+ res->res.flags |= WPA_SCAN_LEVEL_DBM;
}
diff --git a/wpa_supplicant/ctrl_iface_dbus_handlers.c b/wpa_supplicant/ctrl_iface_dbus_handlers.c
index 3c29804..161f7f8 100644
--- a/wpa_supplicant/ctrl_iface_dbus_handlers.c
+++ b/wpa_supplicant/ctrl_iface_dbus_handlers.c
@@ -436,11 +436,14 @@ DBusMessage * wpas_dbus_bssid_properties(DBusMessage *message,
if (!wpa_dbus_dict_append_uint16(&iter_dict, "capabilities",
res->caps))
goto error;
- if (!wpa_dbus_dict_append_int32(&iter_dict, "quality", res->qual))
+ if (!(res->flags & WPA_SCAN_QUAL_INVALID) &&
+ !wpa_dbus_dict_append_int32(&iter_dict, "quality", res->qual))
goto error;
- if (!wpa_dbus_dict_append_int32(&iter_dict, "noise", res->noise))
+ if (!(res->flags & WPA_SCAN_NOISE_INVALID) &&
+ !wpa_dbus_dict_append_int32(&iter_dict, "noise", res->noise))
goto error;
- if (!wpa_dbus_dict_append_int32(&iter_dict, "level", res->level))
+ if (!(res->flags & WPA_SCAN_LEVEL_INVALID) &&
+ !wpa_dbus_dict_append_int32(&iter_dict, "level", res->level))
goto error;
if (!wpa_dbus_dict_append_int32(&iter_dict, "maxrate",
wpa_scan_get_max_rate(res) * 500000))