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

Diff settings


Just for now

@@ -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
.mgmt_frame = mgmt,
.frame_info = fi,
+ .elems = &elems,

if (len < IEEE80211_HDRLEN)
@@ -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;
@@ -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_u8(&b, NULL, req->elems->supp_rates[i]);

This comment has been minimized.

Copy link

PolynomialDivision Feb 7, 2018

Author Contributor

@nbd168: So here I should use e.g. u16?

This comment has been minimized.

Copy link

nbd168 Feb 10, 2018


Yes. They take up the same amount of memory anyway (due to alignment)

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_u8(&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);
@@ -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;
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.