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]>
Wed, 26 May 2021 09:39:36 +0000 (11:39 +0200)
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 0d1cb2c3e48b8139e3acb6b0d30147cc4b5cdf85..85ee1eef01906fee7775d837e3c513449ac53083 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 ef190327f98e1028fd253a13e3773f1a4bf46275..7fc3b187768103a01e2c435517edcc646d505544 100644 (file)
@@ -1562,6 +1562,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;
@@ -1585,6 +1587,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 de0d1182fd300c47522886f0b7f4af1410a9247c..49e5f883cd61ffc16917535445fd2152291f9ad7 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;
 };