hostapd: ubus: pass raw IEs to ubus
authorDavid Bauer <[email protected]>
Fri, 16 Oct 2020 21:42:35 +0000 (23:42 +0200)
committerDavid Bauer <[email protected]>
Mon, 26 Oct 2020 01:39:24 +0000 (02:39 +0100)
package/network/services/hostapd/patches/600-ubus_support.patch
package/network/services/hostapd/patches/800-dfs-enter-DFS-state-if-no-available-channel-is-found.patch
package/network/services/hostapd/src/src/ap/ubus.c
package/network/services/hostapd/src/src/ap/ubus.h

index 938840755a79c5147d3b135c89f24f1240c42a4e..74108797ff7f7bfa42377c9b2885f4e34edc78d0 100644 (file)
  
        if (len < IEEE80211_HDRLEN)
                return;
-@@ -996,6 +1002,12 @@ void handle_probe_req(struct hostapd_dat
+@@ -840,6 +846,9 @@ void handle_probe_req(struct hostapd_dat
+       if (!hapd->conf->send_probe_response)
+               return;
++      req.raw_elems = ie;
++      req.raw_elems_len = ie_len;
++
+       if (ieee802_11_parse_elems(ie, ie_len, &elems, 0) == ParseFailed) {
+               wpa_printf(MSG_DEBUG, "Could not parse ProbeReq from " MACSTR,
+                          MAC2STR(mgmt->sa));
+@@ -996,6 +1005,12 @@ void handle_probe_req(struct hostapd_dat
        }
  #endif /* CONFIG_P2P */
  
index e2db99eeed05cd4290af1d61b47af1409b49b7ea..3e4638d7ff25422eea5169852fe96672e0d35e20 100644 (file)
@@ -17,7 +17,7 @@ Signed-off-by: David Bauer <[email protected]>
 
 --- a/src/ap/dfs.c
 +++ b/src/ap/dfs.c
-@@ -1066,8 +1066,15 @@ static int hostapd_dfs_start_channel_swi
+@@ -1086,8 +1086,15 @@ static int hostapd_dfs_start_channel_swi
                                                  &oper_centr_freq_seg0_idx,
                                                  &oper_centr_freq_seg1_idx,
                                                  &skip_radar);
index ba8f0e818e19a6a6d2841a30f50037657d6cce96..acc735ca5471fecdf43170b58a77fa0ad5d9b777 100644 (file)
@@ -1451,6 +1451,8 @@ int hostapd_ubus_handle_event(struct hostapd_data *hapd, struct hostapd_ubus_req
        const char *type = "mgmt";
        struct ubus_event_req ureq = {};
        const u8 *addr;
+       char *ie_str;
+       int i;
 
        if (req->mgmt_frame)
                addr = req->mgmt_frame->sa;
@@ -1474,6 +1476,14 @@ int hostapd_ubus_handle_event(struct hostapd_data *hapd, struct hostapd_ubus_req
        if (req->ssi_signal)
                blobmsg_add_u32(&b, "signal", req->ssi_signal);
        blobmsg_add_u32(&b, "freq", hapd->iface->freq);
+       
+       /* Add raw IEs */
+       if (req->raw_elems_len > 0) {
+               ie_str = blobmsg_alloc_string_buffer(&b, "raw_elements", req->raw_elems_len * 2 + 1);
+               for (i = 0; i < req->raw_elems_len; i++)
+                       snprintf(&ie_str[i*2], 3, "%02X", req->raw_elems[i]);
+               blobmsg_add_string_buffer(&b);
+       }
 
        if (req->elems) {
                if(req->elems->ht_capabilities)
index e16017394fd8a0fb2093a3fd0ede3783577f0af5..be7938aebedafc2b988d53fdfc46cf2fa8aae571 100644 (file)
@@ -19,6 +19,8 @@ struct hostapd_ubus_request {
        enum hostapd_ubus_event_type type;
        const struct ieee80211_mgmt *mgmt_frame;
        const struct ieee802_11_elems *elems;
+       size_t raw_elems_len;
+       const u8 *raw_elems;
        int ssi_signal; /* dBm */
        const u8 *addr;
 };