Parse DMG capabilities when reporting to external interfaces

This adds [DMG] and [PBSS] flags for scan results and BSS table entries
using the IEEE Std 802.11ad-2012 updated definition of the Capability
field.

Signed-off-by: Boris Sorochkin <qca_bsoroc@qca.qualcomm.com>
This commit is contained in:
Boris Sorochkin 2014-05-12 10:35:41 +03:00 committed by Jouni Malinen
parent f7454c97df
commit e403ba859e
4 changed files with 83 additions and 21 deletions

View file

@ -130,4 +130,9 @@ int wpa_bss_get_bit_rates(const struct wpa_bss *bss, u8 **rates);
struct wpa_bss_anqp * wpa_bss_anqp_alloc(void); struct wpa_bss_anqp * wpa_bss_anqp_alloc(void);
int wpa_bss_anqp_unshare_alloc(struct wpa_bss *bss); int wpa_bss_anqp_unshare_alloc(struct wpa_bss *bss);
static inline int bss_is_dmg(const struct wpa_bss *bss)
{
return bss->freq > 45000;
}
#endif /* BSS_H */ #endif /* BSS_H */

View file

@ -2204,17 +2204,43 @@ static int wpa_supplicant_ctrl_iface_scan_result(
return -1; return -1;
pos += ret; pos += ret;
} }
if (bss->caps & IEEE80211_CAP_IBSS) { if (bss_is_dmg(bss)) {
ret = os_snprintf(pos, end - pos, "[IBSS]"); const char *s;
ret = os_snprintf(pos, end - pos, "[DMG]");
if (ret < 0 || ret >= end - pos) if (ret < 0 || ret >= end - pos)
return -1; return -1;
pos += ret; pos += ret;
} switch (bss->caps & IEEE80211_CAP_DMG_MASK) {
if (bss->caps & IEEE80211_CAP_ESS) { case IEEE80211_CAP_DMG_IBSS:
ret = os_snprintf(pos, end - pos, "[ESS]"); s = "[IBSS]";
break;
case IEEE80211_CAP_DMG_AP:
s = "[ESS]";
break;
case IEEE80211_CAP_DMG_PBSS:
s = "[PBSS]";
break;
default:
s = "";
break;
}
ret = os_snprintf(pos, end - pos, "%s", s);
if (ret < 0 || ret >= end - pos) if (ret < 0 || ret >= end - pos)
return -1; return -1;
pos += ret; pos += ret;
} else {
if (bss->caps & IEEE80211_CAP_IBSS) {
ret = os_snprintf(pos, end - pos, "[IBSS]");
if (ret < 0 || ret >= end - pos)
return -1;
pos += ret;
}
if (bss->caps & IEEE80211_CAP_ESS) {
ret = os_snprintf(pos, end - pos, "[ESS]");
if (ret < 0 || ret >= end - pos)
return -1;
pos += ret;
}
} }
if (p2p) { if (p2p) {
ret = os_snprintf(pos, end - pos, "[P2P]"); ret = os_snprintf(pos, end - pos, "[P2P]");
@ -3544,17 +3570,43 @@ static int print_bss_info(struct wpa_supplicant *wpa_s, struct wpa_bss *bss,
return 0; return 0;
pos += ret; pos += ret;
} }
if (bss->caps & IEEE80211_CAP_IBSS) { if (bss_is_dmg(bss)) {
ret = os_snprintf(pos, end - pos, "[IBSS]"); const char *s;
ret = os_snprintf(pos, end - pos, "[DMG]");
if (ret < 0 || ret >= end - pos) if (ret < 0 || ret >= end - pos)
return 0; return 0;
pos += ret; pos += ret;
} switch (bss->caps & IEEE80211_CAP_DMG_MASK) {
if (bss->caps & IEEE80211_CAP_ESS) { case IEEE80211_CAP_DMG_IBSS:
ret = os_snprintf(pos, end - pos, "[ESS]"); s = "[IBSS]";
break;
case IEEE80211_CAP_DMG_AP:
s = "[ESS]";
break;
case IEEE80211_CAP_DMG_PBSS:
s = "[PBSS]";
break;
default:
s = "";
break;
}
ret = os_snprintf(pos, end - pos, "%s", s);
if (ret < 0 || ret >= end - pos) if (ret < 0 || ret >= end - pos)
return 0; return 0;
pos += ret; pos += ret;
} else {
if (bss->caps & IEEE80211_CAP_IBSS) {
ret = os_snprintf(pos, end - pos, "[IBSS]");
if (ret < 0 || ret >= end - pos)
return 0;
pos += ret;
}
if (bss->caps & IEEE80211_CAP_ESS) {
ret = os_snprintf(pos, end - pos, "[ESS]");
if (ret < 0 || ret >= end - pos)
return 0;
pos += ret;
}
} }
if (wpa_bss_get_vendor_ie(bss, P2P_IE_VENDOR_TYPE) || if (wpa_bss_get_vendor_ie(bss, P2P_IE_VENDOR_TYPE) ||
wpa_bss_get_vendor_ie_beacon(bss, P2P_IE_VENDOR_TYPE)) { wpa_bss_get_vendor_ie_beacon(bss, P2P_IE_VENDOR_TYPE)) {

View file

@ -3546,11 +3546,22 @@ dbus_bool_t wpas_dbus_getter_bss_mode(DBusMessageIter *iter, DBusError *error,
res = get_bss_helper(args, error, __func__); res = get_bss_helper(args, error, __func__);
if (!res) if (!res)
return FALSE; return FALSE;
if (bss_is_dmg(res)) {
if (res->caps & IEEE80211_CAP_IBSS) switch (res->caps & IEEE80211_CAP_DMG_MASK) {
mode = "ad-hoc"; case IEEE80211_CAP_DMG_PBSS:
else case IEEE80211_CAP_DMG_IBSS:
mode = "infrastructure"; mode = "ad-hoc";
break;
case IEEE80211_CAP_DMG_AP:
mode = "infrastructure";
break;
}
} else {
if (res->caps & IEEE80211_CAP_IBSS)
mode = "ad-hoc";
else
mode = "infrastructure";
}
return wpas_dbus_simple_property_getter(iter, DBUS_TYPE_STRING, return wpas_dbus_simple_property_getter(iter, DBUS_TYPE_STRING,
&mode, error); &mode, error);

View file

@ -713,12 +713,6 @@ static int rate_match(struct wpa_supplicant *wpa_s, struct wpa_bss *bss)
} }
static int bss_is_dmg(struct wpa_bss *bss)
{
return bss->freq > 45000;
}
/* /*
* Test whether BSS is in an ESS. * Test whether BSS is in an ESS.
* This is done differently in DMG (60 GHz) and non-DMG bands * This is done differently in DMG (60 GHz) and non-DMG bands