hostapd: add ht and vht support in handle event function Add ht and vht capabilities...
authorNick Hainke <vincent@systemli.org>
Thu, 17 May 2018 10:35:23 +0000 (12:35 +0200)
committerJohn Crispin <john@phrozen.org>
Mon, 30 Jul 2018 09:01:04 +0000 (11:01 +0200)
Signed-off-by: Nick Hainke <vincent@systemli.org>
package/network/services/hostapd/patches/600-ubus_support.patch
package/network/services/hostapd/src/src/ap/ubus.c
package/network/services/hostapd/src/src/ap/ubus.h

index a4c4a67..cb2c54d 100644 (file)
        int ret;
        u16 csa_offs[2];
        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;
        char *identity = NULL;
        char *radius_cui = NULL;
 +              .type = HOSTAPD_UBUS_PROBE_REQ,
 +              .mgmt_frame = mgmt,
 +              .frame_info = fi,
++              .elems = &elems,
 +      };
  
        if (len < IEEE80211_HDRLEN)
                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 */
  
index 6207b03..2024d45 100644 (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, "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) {
                ubus_notify(ctx, &hapd->ubus.obj, type, b.head, -1);
                return WLAN_STATUS_SUCCESS;
index ca63b34..185af5a 100644 (file)
@@ -18,6 +18,7 @@ enum hostapd_ubus_event_type {
 struct hostapd_ubus_request {
        enum hostapd_ubus_event_type type;
        const struct ieee80211_mgmt *mgmt_frame;
+       const struct ieee802_11_elems *elems;
        const struct hostapd_frame_info *frame_info;
        const u8 *addr;
 };