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, 19 Sep 2022 23:19:13 +0000 (01:19 +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 7c6c5e38144215655018704d832c475a83a8208d..517bdca30780c652896724ef4d95b44736b1891d 100644 (file)
  
        if (hapd->iconf->rssi_ignore_probe_request && ssi_signal &&
            ssi_signal < hapd->iconf->rssi_ignore_probe_request)
-@@ -1105,6 +1111,12 @@ void handle_probe_req(struct hostapd_dat
+@@ -882,6 +888,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));
+@@ -1038,6 +1047,12 @@ void handle_probe_req(struct hostapd_dat
        }
  #endif /* CONFIG_P2P */
  
index 622eab8838acc3c4bbce0064e8d0fa237efa412f..9ecae05e994acc5a6790e3e97940df58c6b85c71 100644 (file)
@@ -1887,6 +1887,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;
@@ -1910,6 +1912,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, "information_elements", req->raw_elems_len * 2 + 1);
+               for (i = 0; i < req->raw_elems_len; i++)
+                       snprintf(&ie_str[i*2], 3, "%02X", (unsigned char)req->raw_elems[i]);
+               blobmsg_add_string_buffer(&b);
+       }
 
        if (req->elems) {
                if(req->elems->ht_capabilities)
index 5a33b624d0873803efd9111c55d387bd4b83c930..0942180d828c4367ace8d13ab11819808ba3eb6d 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;
 };