Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hostapd: add supported rates and extended supported rates in ubus #726

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
@@ -0,0 +1,10 @@
--- a/src/ap/beacon.c
+++ b/src/ap/beacon.c
@@ -733,6 +733,7 @@ void handle_probe_req(struct hostapd_dat
.type = HOSTAPD_UBUS_PROBE_REQ,
.mgmt_frame = mgmt,
.frame_info = fi,
+ .elems = &elems,
};

if (len < IEEE80211_HDRLEN)
18 changes: 18 additions & 0 deletions package/network/services/hostapd/src/src/ap/ubus.c
Expand Up @@ -700,6 +700,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;
void *supp_rates, *ext_supp_rates;
int i;

if (req->mgmt_frame)
addr = req->mgmt_frame->sa;
Expand All @@ -723,6 +725,22 @@ int hostapd_ubus_handle_event(struct hostapd_data *hapd, struct hostapd_ubus_req
if (req->frame_info)
blobmsg_add_u32(&b, "signal", req->frame_info->ssi_signal);
blobmsg_add_u32(&b, "freq", hapd->iface->freq);
if (req->elems) {
if (req->elems->supp_rates) {
supp_rates = blobmsg_open_array(&b, "supp_rates");
for (i = 0; req->elems->supp_rates && i < req->elems->supp_rates_len; i++) {
blobmsg_add_u16(&b, NULL, req->elems->supp_rates[i]);
}
blobmsg_close_array(&b, supp_rates);
}
if (req->elems->ext_supp_rates) {
ext_supp_rates = blobmsg_open_array(&b, "ext_supp_rates");
for (i = 0; req->elems->ext_supp_rates && i < req->elems->ext_supp_rates_len; i++) {
blobmsg_add_u16(&b, NULL, req->elems->ext_supp_rates[i]);
}
blobmsg_close_array(&b, ext_supp_rates);
}
}

if (!hapd->ubus.notify_response) {
ubus_notify(ctx, &hapd->ubus.obj, type, b.head, -1);
Expand Down
1 change: 1 addition & 0 deletions package/network/services/hostapd/src/src/ap/ubus.h
Expand Up @@ -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;
};
Expand Down