hostapd: add ht and vht support in handle event function Add ht and vht capabilities. If a device sends a probe request, the capabilities are added.

Signed-off-by: Nick Hainke <vincent@systemli.org>
This commit is contained in:
Nick Hainke 2018-05-17 12:35:23 +02:00 committed by John Crispin
parent 74ac742277
commit abefb4fda3
3 changed files with 45 additions and 2 deletions

View File

@ -242,7 +242,7 @@
int ret; int ret;
u16 csa_offs[2]; u16 csa_offs[2];
size_t csa_offs_len; size_t csa_offs_len;
@@ -737,6 +738,11 @@ void handle_probe_req(struct hostapd_dat @@ -737,6 +738,12 @@ void handle_probe_req(struct hostapd_dat
struct hostapd_sta_wpa_psk_short *psk = NULL; struct hostapd_sta_wpa_psk_short *psk = NULL;
char *identity = NULL; char *identity = NULL;
char *radius_cui = NULL; char *radius_cui = NULL;
@ -250,11 +250,12 @@
+ .type = HOSTAPD_UBUS_PROBE_REQ, + .type = HOSTAPD_UBUS_PROBE_REQ,
+ .mgmt_frame = mgmt, + .mgmt_frame = mgmt,
+ .frame_info = fi, + .frame_info = fi,
+ .elems = &elems,
+ }; + };
if (len < IEEE80211_HDRLEN) if (len < IEEE80211_HDRLEN)
return; return;
@@ -914,6 +920,12 @@ void handle_probe_req(struct hostapd_dat @@ -914,6 +921,12 @@ void handle_probe_req(struct hostapd_dat
} }
#endif /* CONFIG_P2P */ #endif /* CONFIG_P2P */

View File

@ -1044,6 +1044,47 @@ int hostapd_ubus_handle_event(struct hostapd_data *hapd, struct hostapd_ubus_req
blobmsg_add_u32(&b, "signal", req->frame_info->ssi_signal); blobmsg_add_u32(&b, "signal", req->frame_info->ssi_signal);
blobmsg_add_u32(&b, "freq", hapd->iface->freq); blobmsg_add_u32(&b, "freq", hapd->iface->freq);
if (req->elems) {
if(req->elems->ht_capabilities)
{
struct ieee80211_ht_capabilities *ht_capabilities;
void *ht_cap, *ht_cap_mcs_set, *mcs_set;
ht_capabilities = (struct ieee80211_ht_capabilities*) req->elems->ht_capabilities;
ht_cap = blobmsg_open_table(&b, "ht_capabilities");
blobmsg_add_u16(&b, "ht_capabilities_info", ht_capabilities->ht_capabilities_info);
ht_cap_mcs_set = blobmsg_open_table(&b, "supported_mcs_set");
blobmsg_add_u16(&b, "a_mpdu_params", ht_capabilities->a_mpdu_params);
blobmsg_add_u16(&b, "ht_extended_capabilities", ht_capabilities->ht_extended_capabilities);
blobmsg_add_u32(&b, "tx_bf_capability_info", ht_capabilities->tx_bf_capability_info);
blobmsg_add_u16(&b, "asel_capabilities", ht_capabilities->asel_capabilities);
mcs_set = blobmsg_open_array(&b, "supported_mcs_set");
for (int i = 0; i < 16; i++) {
blobmsg_add_u16(&b, NULL, (u16) ht_capabilities->supported_mcs_set[i]);
}
blobmsg_close_array(&b, mcs_set);
blobmsg_close_table(&b, ht_cap_mcs_set);
blobmsg_close_table(&b, ht_cap);
}
if(req->elems->vht_capabilities)
{
struct ieee80211_vht_capabilities *vht_capabilities;
void *vht_cap, *vht_cap_mcs_set;
vht_capabilities = (struct ieee80211_vht_capabilities*) req->elems->vht_capabilities;
vht_cap = blobmsg_open_table(&b, "vht_capabilities");
blobmsg_add_u32(&b, "vht_capabilities_info", vht_capabilities->vht_capabilities_info);
vht_cap_mcs_set = blobmsg_open_table(&b, "vht_supported_mcs_set");
blobmsg_add_u16(&b, "rx_map", vht_capabilities->vht_supported_mcs_set.rx_map);
blobmsg_add_u16(&b, "rx_highest", vht_capabilities->vht_supported_mcs_set.rx_highest);
blobmsg_add_u16(&b, "tx_map", vht_capabilities->vht_supported_mcs_set.tx_map);
blobmsg_add_u16(&b, "tx_highest", vht_capabilities->vht_supported_mcs_set.tx_highest);
blobmsg_close_table(&b, vht_cap_mcs_set);
blobmsg_close_table(&b, vht_cap);
}
}
if (!hapd->ubus.notify_response) { if (!hapd->ubus.notify_response) {
ubus_notify(ctx, &hapd->ubus.obj, type, b.head, -1); ubus_notify(ctx, &hapd->ubus.obj, type, b.head, -1);
return WLAN_STATUS_SUCCESS; return WLAN_STATUS_SUCCESS;

View File

@ -18,6 +18,7 @@ enum hostapd_ubus_event_type {
struct hostapd_ubus_request { struct hostapd_ubus_request {
enum hostapd_ubus_event_type type; enum hostapd_ubus_event_type type;
const struct ieee80211_mgmt *mgmt_frame; const struct ieee80211_mgmt *mgmt_frame;
const struct ieee802_11_elems *elems;
const struct hostapd_frame_info *frame_info; const struct hostapd_frame_info *frame_info;
const u8 *addr; const u8 *addr;
}; };