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 a4c4a67fc34d69d631435c4aac62c57588769021..cb2c54d57c215c9886811cdda5f553d63656ffa2 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 6207b035305e62f5c437948fb952b0312d1c6221..2024d455ba88f5d038eeb663546e89d972478d6c 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 ca63b34cb71dc218e1ba41824978b55136fe21f8..185af5a7f43cec221ce75de5f84ba26eb2768577 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;
 };