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:
parent
f7454c97df
commit
e403ba859e
4 changed files with 83 additions and 21 deletions
|
@ -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);
|
||||
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 */
|
||||
|
|
|
@ -2204,17 +2204,43 @@ static int wpa_supplicant_ctrl_iface_scan_result(
|
|||
return -1;
|
||||
pos += ret;
|
||||
}
|
||||
if (bss->caps & IEEE80211_CAP_IBSS) {
|
||||
ret = os_snprintf(pos, end - pos, "[IBSS]");
|
||||
if (bss_is_dmg(bss)) {
|
||||
const char *s;
|
||||
ret = os_snprintf(pos, end - pos, "[DMG]");
|
||||
if (ret < 0 || ret >= end - pos)
|
||||
return -1;
|
||||
pos += ret;
|
||||
}
|
||||
if (bss->caps & IEEE80211_CAP_ESS) {
|
||||
ret = os_snprintf(pos, end - pos, "[ESS]");
|
||||
switch (bss->caps & IEEE80211_CAP_DMG_MASK) {
|
||||
case IEEE80211_CAP_DMG_IBSS:
|
||||
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)
|
||||
return -1;
|
||||
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) {
|
||||
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;
|
||||
pos += ret;
|
||||
}
|
||||
if (bss->caps & IEEE80211_CAP_IBSS) {
|
||||
ret = os_snprintf(pos, end - pos, "[IBSS]");
|
||||
if (bss_is_dmg(bss)) {
|
||||
const char *s;
|
||||
ret = os_snprintf(pos, end - pos, "[DMG]");
|
||||
if (ret < 0 || ret >= end - pos)
|
||||
return 0;
|
||||
pos += ret;
|
||||
}
|
||||
if (bss->caps & IEEE80211_CAP_ESS) {
|
||||
ret = os_snprintf(pos, end - pos, "[ESS]");
|
||||
switch (bss->caps & IEEE80211_CAP_DMG_MASK) {
|
||||
case IEEE80211_CAP_DMG_IBSS:
|
||||
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)
|
||||
return 0;
|
||||
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) ||
|
||||
wpa_bss_get_vendor_ie_beacon(bss, P2P_IE_VENDOR_TYPE)) {
|
||||
|
|
|
@ -3546,11 +3546,22 @@ dbus_bool_t wpas_dbus_getter_bss_mode(DBusMessageIter *iter, DBusError *error,
|
|||
res = get_bss_helper(args, error, __func__);
|
||||
if (!res)
|
||||
return FALSE;
|
||||
|
||||
if (res->caps & IEEE80211_CAP_IBSS)
|
||||
mode = "ad-hoc";
|
||||
else
|
||||
mode = "infrastructure";
|
||||
if (bss_is_dmg(res)) {
|
||||
switch (res->caps & IEEE80211_CAP_DMG_MASK) {
|
||||
case IEEE80211_CAP_DMG_PBSS:
|
||||
case IEEE80211_CAP_DMG_IBSS:
|
||||
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,
|
||||
&mode, error);
|
||||
|
|
|
@ -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.
|
||||
* This is done differently in DMG (60 GHz) and non-DMG bands
|
||||
|
|
Loading…
Reference in a new issue