3 @@ -121,6 +121,11 @@ OBJS += ../src/common/hw_features_common
5 OBJS += ../src/eapol_auth/eapol_auth_sm.o
8 +CFLAGS += -DUBUS_SUPPORT
9 +OBJS += ../src/ap/ubus.o
10 +LIBS += -lubox -lubus
13 ifdef CONFIG_CODE_COVERAGE
14 CFLAGS += -O0 -fprofile-arcs -ftest-coverage
15 --- a/src/ap/hostapd.h
16 +++ b/src/ap/hostapd.h
18 #include "utils/list.h"
19 #include "ap_config.h"
20 #include "drivers/driver.h"
24 struct radius_server_data;
25 @@ -103,6 +104,7 @@ struct hostapd_data {
26 struct hostapd_iface *iface;
27 struct hostapd_config *iconf;
28 struct hostapd_bss_config *conf;
29 + struct hostapd_ubus_bss ubus;
30 int interface_added; /* virtual interface added for this BSS */
31 unsigned int started:1;
32 unsigned int disabled:1;
33 @@ -286,6 +288,8 @@ struct hostapd_iface {
34 struct hostapd_config *conf;
35 char phy[16]; /* Name of the PHY (radio) */
37 + struct hostapd_ubus_iface ubus;
39 enum hostapd_iface_state {
40 HAPD_IFACE_UNINITIALIZED,
46 + * hostapd / ubus support
47 + * Copyright (c) 2013, Felix Fietkau <nbd@openwrt.org>
49 + * This software may be distributed under the terms of the BSD license.
50 + * See README for more details.
53 +#include "utils/includes.h"
54 +#include "utils/common.h"
55 +#include "utils/eloop.h"
56 +#include "common/ieee802_11_defs.h"
58 +#include "wps_hostapd.h"
59 +#include "sta_info.h"
62 +static struct ubus_context *ctx;
63 +static struct blob_buf b;
66 +static inline struct hostapd_data *get_hapd_from_object(struct ubus_object *obj)
68 + return container_of(obj, struct hostapd_data, ubus.obj);
72 +struct ubus_banned_client {
73 + struct avl_node avl;
77 +static void ubus_receive(int sock, void *eloop_ctx, void *sock_ctx)
79 + struct ubus_context *ctx = eloop_ctx;
80 + ubus_handle_event(ctx);
83 +static void ubus_reconnect_timeout(void *eloop_data, void *user_ctx)
85 + if (ubus_reconnect(ctx, NULL)) {
86 + eloop_register_timeout(1, 0, ubus_reconnect_timeout, ctx, NULL);
90 + eloop_register_read_sock(ctx->sock.fd, ubus_receive, ctx, NULL);
93 +static void hostapd_ubus_connection_lost(struct ubus_context *ctx)
95 + eloop_unregister_read_sock(ctx->sock.fd);
96 + eloop_register_timeout(1, 0, ubus_reconnect_timeout, ctx, NULL);
99 +static bool hostapd_ubus_init(void)
104 + ctx = ubus_connect(NULL);
108 + ctx->connection_lost = hostapd_ubus_connection_lost;
109 + eloop_register_read_sock(ctx->sock.fd, ubus_receive, ctx, NULL);
113 +static void hostapd_ubus_ref_inc(void)
118 +static void hostapd_ubus_ref_dec(void)
127 + eloop_unregister_read_sock(ctx->sock.fd);
132 +void hostapd_ubus_add_iface(struct hostapd_iface *iface)
134 + if (!hostapd_ubus_init())
138 +void hostapd_ubus_free_iface(struct hostapd_iface *iface)
145 +hostapd_bss_del_ban(void *eloop_data, void *user_ctx)
147 + struct ubus_banned_client *ban = eloop_data;
148 + struct hostapd_data *hapd = user_ctx;
150 + avl_delete(&hapd->ubus.banned, &ban->avl);
155 +hostapd_bss_ban_client(struct hostapd_data *hapd, u8 *addr, int time)
157 + struct ubus_banned_client *ban;
162 + ban = avl_find_element(&hapd->ubus.banned, addr, ban, avl);
167 + ban = os_zalloc(sizeof(*ban));
168 + memcpy(ban->addr, addr, sizeof(ban->addr));
169 + ban->avl.key = ban->addr;
170 + avl_insert(&hapd->ubus.banned, &ban->avl);
172 + eloop_cancel_timeout(hostapd_bss_del_ban, ban, hapd);
174 + hostapd_bss_del_ban(ban, hapd);
179 + eloop_register_timeout(0, time * 1000, hostapd_bss_del_ban, ban, hapd);
183 +hostapd_bss_get_clients(struct ubus_context *ctx, struct ubus_object *obj,
184 + struct ubus_request_data *req, const char *method,
185 + struct blob_attr *msg)
187 + struct hostapd_data *hapd = container_of(obj, struct hostapd_data, ubus.obj);
188 + struct sta_info *sta;
191 + static const struct {
195 + { "auth", WLAN_STA_AUTH },
196 + { "assoc", WLAN_STA_ASSOC },
197 + { "authorized", WLAN_STA_AUTHORIZED },
198 + { "preauth", WLAN_STA_PREAUTH },
199 + { "wds", WLAN_STA_WDS },
200 + { "wmm", WLAN_STA_WMM },
201 + { "ht", WLAN_STA_HT },
202 + { "vht", WLAN_STA_VHT },
203 + { "wps", WLAN_STA_WPS },
204 + { "mfp", WLAN_STA_MFP },
207 + blob_buf_init(&b, 0);
208 + blobmsg_add_u32(&b, "freq", hapd->iface->freq);
209 + list = blobmsg_open_table(&b, "clients");
210 + for (sta = hapd->sta_list; sta; sta = sta->next) {
213 + sprintf(mac_buf, MACSTR, MAC2STR(sta->addr));
214 + c = blobmsg_open_table(&b, mac_buf);
215 + for (i = 0; i < ARRAY_SIZE(sta_flags); i++)
216 + blobmsg_add_u8(&b, sta_flags[i].name,
217 + !!(sta->flags & sta_flags[i].flag));
218 + blobmsg_add_u32(&b, "aid", sta->aid);
219 + blobmsg_close_table(&b, c);
221 + blobmsg_close_array(&b, list);
222 + ubus_send_reply(ctx, req, b.head);
231 + DEL_CLIENT_BAN_TIME,
235 +static const struct blobmsg_policy del_policy[__DEL_CLIENT_MAX] = {
236 + [DEL_CLIENT_ADDR] = { "addr", BLOBMSG_TYPE_STRING },
237 + [DEL_CLIENT_REASON] = { "reason", BLOBMSG_TYPE_INT32 },
238 + [DEL_CLIENT_DEAUTH] = { "deauth", BLOBMSG_TYPE_INT8 },
239 + [DEL_CLIENT_BAN_TIME] = { "ban_time", BLOBMSG_TYPE_INT32 },
243 +hostapd_bss_del_client(struct ubus_context *ctx, struct ubus_object *obj,
244 + struct ubus_request_data *req, const char *method,
245 + struct blob_attr *msg)
247 + struct blob_attr *tb[__DEL_CLIENT_MAX];
248 + struct hostapd_data *hapd = container_of(obj, struct hostapd_data, ubus.obj);
249 + struct sta_info *sta;
250 + bool deauth = false;
254 + blobmsg_parse(del_policy, __DEL_CLIENT_MAX, tb, blob_data(msg), blob_len(msg));
256 + if (!tb[DEL_CLIENT_ADDR])
257 + return UBUS_STATUS_INVALID_ARGUMENT;
259 + if (hwaddr_aton(blobmsg_data(tb[DEL_CLIENT_ADDR]), addr))
260 + return UBUS_STATUS_INVALID_ARGUMENT;
262 + if (tb[DEL_CLIENT_REASON])
263 + reason = blobmsg_get_u32(tb[DEL_CLIENT_REASON]);
265 + if (tb[DEL_CLIENT_DEAUTH])
266 + deauth = blobmsg_get_bool(tb[DEL_CLIENT_DEAUTH]);
268 + sta = ap_get_sta(hapd, addr);
271 + hostapd_drv_sta_deauth(hapd, addr, reason);
272 + ap_sta_deauthenticate(hapd, sta, reason);
274 + hostapd_drv_sta_disassoc(hapd, addr, reason);
275 + ap_sta_disassociate(hapd, sta, reason);
279 + if (tb[DEL_CLIENT_BAN_TIME])
280 + hostapd_bss_ban_client(hapd, addr, blobmsg_get_u32(tb[DEL_CLIENT_BAN_TIME]));
286 +blobmsg_add_macaddr(struct blob_buf *buf, const char *name, const u8 *addr)
290 + s = blobmsg_alloc_string_buffer(buf, name, 20);
291 + sprintf(s, MACSTR, MAC2STR(addr));
292 + blobmsg_add_string_buffer(buf);
296 +hostapd_bss_list_bans(struct ubus_context *ctx, struct ubus_object *obj,
297 + struct ubus_request_data *req, const char *method,
298 + struct blob_attr *msg)
300 + struct hostapd_data *hapd = container_of(obj, struct hostapd_data, ubus.obj);
301 + struct ubus_banned_client *ban;
304 + blob_buf_init(&b, 0);
305 + c = blobmsg_open_array(&b, "clients");
306 + avl_for_each_element(&hapd->ubus.banned, ban, avl)
307 + blobmsg_add_macaddr(&b, NULL, ban->addr);
308 + blobmsg_close_array(&b, c);
309 + ubus_send_reply(ctx, req, b.head);
315 +hostapd_bss_wps_start(struct ubus_context *ctx, struct ubus_object *obj,
316 + struct ubus_request_data *req, const char *method,
317 + struct blob_attr *msg)
320 + struct hostapd_data *hapd = container_of(obj, struct hostapd_data, ubus.obj);
322 + rc = hostapd_wps_button_pushed(hapd, NULL);
325 + return UBUS_STATUS_NOT_SUPPORTED;
331 +hostapd_bss_wps_cancel(struct ubus_context *ctx, struct ubus_object *obj,
332 + struct ubus_request_data *req, const char *method,
333 + struct blob_attr *msg)
336 + struct hostapd_data *hapd = container_of(obj, struct hostapd_data, ubus.obj);
338 + rc = hostapd_wps_cancel(hapd);
341 + return UBUS_STATUS_NOT_SUPPORTED;
352 +static const struct blobmsg_policy csa_policy[__CSA_MAX] = {
354 + * for now, frequency and beacon count are enough, add more
355 + * parameters on demand
357 + [CSA_FREQ] = { "freq", BLOBMSG_TYPE_INT32 },
358 + [CSA_BCN_COUNT] = { "bcn_count", BLOBMSG_TYPE_INT32 },
362 +hostapd_switch_chan(struct ubus_context *ctx, struct ubus_object *obj,
363 + struct ubus_request_data *req, const char *method,
364 + struct blob_attr *msg)
366 + struct blob_attr *tb[__CSA_MAX];
367 + struct hostapd_data *hapd = get_hapd_from_object(obj);
368 + struct csa_settings css;
370 + blobmsg_parse(csa_policy, __CSA_MAX, tb, blob_data(msg), blob_len(msg));
373 + return UBUS_STATUS_INVALID_ARGUMENT;
375 + memset(&css, 0, sizeof(css));
376 + css.freq_params.freq = blobmsg_get_u32(tb[CSA_FREQ]);
377 + if (tb[CSA_BCN_COUNT])
378 + css.cs_count = blobmsg_get_u32(tb[CSA_BCN_COUNT]);
380 + if (hostapd_switch_channel(hapd, &css) != 0)
381 + return UBUS_STATUS_NOT_SUPPORTED;
382 + return UBUS_STATUS_OK;
387 + __VENDOR_ELEMENTS_MAX
390 +static const struct blobmsg_policy ve_policy[__VENDOR_ELEMENTS_MAX] = {
391 + /* vendor elements are provided as hex-string */
392 + [VENDOR_ELEMENTS] = { "vendor_elements", BLOBMSG_TYPE_STRING },
396 +hostapd_vendor_elements(struct ubus_context *ctx, struct ubus_object *obj,
397 + struct ubus_request_data *req, const char *method,
398 + struct blob_attr *msg)
400 + struct blob_attr *tb[__VENDOR_ELEMENTS_MAX];
401 + struct hostapd_data *hapd = get_hapd_from_object(obj);
403 + blobmsg_parse(ve_policy, __VENDOR_ELEMENTS_MAX, tb,
404 + blob_data(msg), blob_len(msg));
406 + if (!tb[VENDOR_ELEMENTS])
407 + return UBUS_STATUS_INVALID_ARGUMENT;
409 + const char *vendor_elements = blobmsg_data(tb[VENDOR_ELEMENTS]);
410 + if (hostapd_set_iface(hapd->iconf, hapd->conf, "vendor_elements",
411 + vendor_elements) != 0)
412 + return UBUS_STATUS_NOT_SUPPORTED;
414 + /* update beacons if vendor elements were set successfully */
415 + if (ieee802_11_update_beacons(hapd->iface) != 0)
416 + return UBUS_STATUS_NOT_SUPPORTED;
417 + return UBUS_STATUS_OK;
420 +static const struct ubus_method bss_methods[] = {
421 + UBUS_METHOD_NOARG("get_clients", hostapd_bss_get_clients),
422 + UBUS_METHOD("del_client", hostapd_bss_del_client, del_policy),
423 + UBUS_METHOD_NOARG("list_bans", hostapd_bss_list_bans),
424 + UBUS_METHOD_NOARG("wps_start", hostapd_bss_wps_start),
425 + UBUS_METHOD_NOARG("wps_cancel", hostapd_bss_wps_cancel),
426 + UBUS_METHOD("switch_chan", hostapd_switch_chan, csa_policy),
427 + UBUS_METHOD("set_vendor_elements", hostapd_vendor_elements, ve_policy),
430 +static struct ubus_object_type bss_object_type =
431 + UBUS_OBJECT_TYPE("hostapd_bss", bss_methods);
433 +static int avl_compare_macaddr(const void *k1, const void *k2, void *ptr)
435 + return memcmp(k1, k2, ETH_ALEN);
438 +void hostapd_ubus_add_bss(struct hostapd_data *hapd)
440 + struct ubus_object *obj = &hapd->ubus.obj;
444 + if (!hostapd_ubus_init())
447 + if (asprintf(&name, "hostapd.%s", hapd->conf->iface) < 0)
450 + avl_init(&hapd->ubus.banned, avl_compare_macaddr, false, NULL);
452 + obj->type = &bss_object_type;
453 + obj->methods = bss_object_type.methods;
454 + obj->n_methods = bss_object_type.n_methods;
455 + ret = ubus_add_object(ctx, obj);
456 + hostapd_ubus_ref_inc();
459 +void hostapd_ubus_free_bss(struct hostapd_data *hapd)
461 + struct ubus_object *obj = &hapd->ubus.obj;
462 + char *name = (char *) obj->name;
468 + ubus_remove_object(ctx, obj);
469 + hostapd_ubus_ref_dec();
475 +struct ubus_event_req {
476 + struct ubus_notify_request nreq;
481 +ubus_event_cb(struct ubus_notify_request *req, int idx, int ret)
483 + struct ubus_event_req *ureq = container_of(req, struct ubus_event_req, nreq);
489 +int hostapd_ubus_handle_event(struct hostapd_data *hapd, struct hostapd_ubus_request *req)
491 + struct ubus_banned_client *ban;
492 + const char *types[HOSTAPD_UBUS_TYPE_MAX] = {
493 + [HOSTAPD_UBUS_PROBE_REQ] = "probe",
494 + [HOSTAPD_UBUS_AUTH_REQ] = "auth",
495 + [HOSTAPD_UBUS_ASSOC_REQ] = "assoc",
497 + const char *type = "mgmt";
498 + struct ubus_event_req ureq = {};
501 + if (req->mgmt_frame)
502 + addr = req->mgmt_frame->sa;
506 + ban = avl_find_element(&hapd->ubus.banned, addr, ban, avl);
510 + if (!hapd->ubus.obj.has_subscribers)
513 + if (req->type < ARRAY_SIZE(types))
514 + type = types[req->type];
516 + blob_buf_init(&b, 0);
517 + blobmsg_add_macaddr(&b, "address", addr);
518 + if (req->mgmt_frame)
519 + blobmsg_add_macaddr(&b, "target", req->mgmt_frame->da);
520 + if (req->frame_info)
521 + blobmsg_add_u32(&b, "signal", req->frame_info->ssi_signal);
522 + blobmsg_add_u32(&b, "freq", hapd->iface->freq);
524 + if (ubus_notify_async(ctx, &hapd->ubus.obj, type, b.head, &ureq.nreq))
527 + ureq.nreq.status_cb = ubus_event_cb;
528 + ubus_complete_request(ctx, &ureq.nreq.req, 100);
539 + * hostapd / ubus support
540 + * Copyright (c) 2013, Felix Fietkau <nbd@openwrt.org>
542 + * This software may be distributed under the terms of the BSD license.
543 + * See README for more details.
545 +#ifndef __HOSTAPD_UBUS_H
546 +#define __HOSTAPD_UBUS_H
548 +enum hostapd_ubus_event_type {
549 + HOSTAPD_UBUS_PROBE_REQ,
550 + HOSTAPD_UBUS_AUTH_REQ,
551 + HOSTAPD_UBUS_ASSOC_REQ,
552 + HOSTAPD_UBUS_TYPE_MAX
555 +struct hostapd_ubus_request {
556 + enum hostapd_ubus_event_type type;
557 + const struct ieee80211_mgmt *mgmt_frame;
558 + const struct hostapd_frame_info *frame_info;
562 +struct hostapd_iface;
563 +struct hostapd_data;
567 +#include <libubox/avl.h>
568 +#include <libubus.h>
570 +struct hostapd_ubus_iface {
571 + struct ubus_object obj;
574 +struct hostapd_ubus_bss {
575 + struct ubus_object obj;
576 + struct avl_tree banned;
579 +void hostapd_ubus_add_iface(struct hostapd_iface *iface);
580 +void hostapd_ubus_free_iface(struct hostapd_iface *iface);
581 +void hostapd_ubus_add_bss(struct hostapd_data *hapd);
582 +void hostapd_ubus_free_bss(struct hostapd_data *hapd);
584 +int hostapd_ubus_handle_event(struct hostapd_data *hapd, struct hostapd_ubus_request *req);
588 +struct hostapd_ubus_iface {};
590 +struct hostapd_ubus_bss {};
592 +static inline void hostapd_ubus_add_iface(struct hostapd_iface *iface)
596 +static inline void hostapd_ubus_free_iface(struct hostapd_iface *iface)
600 +static inline void hostapd_ubus_add_bss(struct hostapd_data *hapd)
604 +static inline void hostapd_ubus_free_bss(struct hostapd_data *hapd)
608 +static inline int hostapd_ubus_handle_event(struct hostapd_data *hapd, struct hostapd_ubus_request *req)
616 --- a/src/ap/hostapd.c
617 +++ b/src/ap/hostapd.c
618 @@ -277,6 +277,7 @@ static void hostapd_free_hapd_data(struc
621 wpa_printf(MSG_DEBUG, "%s(%s)", __func__, hapd->conf->iface);
622 + hostapd_ubus_free_bss(hapd);
623 iapp_deinit(hapd->iapp);
625 accounting_deinit(hapd);
626 @@ -1098,6 +1099,8 @@ static int hostapd_setup_bss(struct host
627 if (hapd->driver && hapd->driver->set_operstate)
628 hapd->driver->set_operstate(hapd->drv_priv, 1);
630 + hostapd_ubus_add_bss(hapd);
635 @@ -1384,6 +1387,7 @@ int hostapd_setup_interface_complete(str
639 + hostapd_ubus_add_iface(iface);
640 wpa_printf(MSG_DEBUG, "Completing interface initialization");
641 if (iface->conf->channel) {
643 @@ -1544,6 +1548,7 @@ dfs_offload:
646 wpa_printf(MSG_ERROR, "Interface initialization failed");
647 + hostapd_ubus_free_iface(iface);
648 hostapd_set_state(iface, HAPD_IFACE_DISABLED);
649 wpa_msg(hapd->msg_ctx, MSG_INFO, AP_EVENT_DISABLED);
650 if (iface->interfaces && iface->interfaces->terminate_on_error)
651 @@ -1873,6 +1878,7 @@ void hostapd_interface_deinit_free(struc
652 (unsigned int) iface->conf->num_bss);
653 driver = iface->bss[0]->driver;
654 drv_priv = iface->bss[0]->drv_priv;
655 + hostapd_ubus_free_iface(iface);
656 hostapd_interface_deinit(iface);
657 wpa_printf(MSG_DEBUG, "%s: driver=%p drv_priv=%p -> hapd_deinit",
658 __func__, driver, drv_priv);
659 --- a/src/ap/ieee802_11.c
660 +++ b/src/ap/ieee802_11.c
661 @@ -881,7 +881,8 @@ int auth_sae_init_committed(struct hosta
664 static void handle_auth(struct hostapd_data *hapd,
665 - const struct ieee80211_mgmt *mgmt, size_t len)
666 + const struct ieee80211_mgmt *mgmt, size_t len,
667 + struct hostapd_frame_info *fi)
669 u16 auth_alg, auth_transaction, status_code;
670 u16 resp = WLAN_STATUS_SUCCESS;
671 @@ -897,6 +898,11 @@ static void handle_auth(struct hostapd_d
672 char *identity = NULL;
673 char *radius_cui = NULL;
675 + struct hostapd_ubus_request req = {
676 + .type = HOSTAPD_UBUS_AUTH_REQ,
677 + .mgmt_frame = mgmt,
681 if (len < IEEE80211_HDRLEN + sizeof(mgmt->u.auth)) {
682 wpa_printf(MSG_INFO, "handle_auth - too short payload (len=%lu)",
683 @@ -983,6 +989,14 @@ static void handle_auth(struct hostapd_d
684 resp = WLAN_STATUS_UNSPECIFIED_FAILURE;
688 + if (hostapd_ubus_handle_event(hapd, &req)) {
689 + wpa_printf(MSG_DEBUG, "Station " MACSTR " rejected by ubus handler.\n",
690 + MAC2STR(mgmt->sa));
691 + resp = WLAN_STATUS_UNSPECIFIED_FAILURE;
695 if (res == HOSTAPD_ACL_PENDING) {
696 wpa_printf(MSG_DEBUG, "Authentication frame from " MACSTR
697 " waiting for an external authentication",
698 @@ -1694,13 +1708,18 @@ static void send_assoc_resp(struct hosta
700 static void handle_assoc(struct hostapd_data *hapd,
701 const struct ieee80211_mgmt *mgmt, size_t len,
703 + int reassoc, struct hostapd_frame_info *fi)
705 u16 capab_info, listen_interval, seq_ctrl, fc;
706 u16 resp = WLAN_STATUS_SUCCESS;
709 struct sta_info *sta;
710 + struct hostapd_ubus_request req = {
711 + .type = HOSTAPD_UBUS_ASSOC_REQ,
712 + .mgmt_frame = mgmt,
716 if (len < IEEE80211_HDRLEN + (reassoc ? sizeof(mgmt->u.reassoc_req) :
717 sizeof(mgmt->u.assoc_req))) {
718 @@ -1820,6 +1839,13 @@ static void handle_assoc(struct hostapd_
722 + if (hostapd_ubus_handle_event(hapd, &req)) {
723 + wpa_printf(MSG_DEBUG, "Station " MACSTR " assoc rejected by ubus handler.\n",
724 + MAC2STR(mgmt->sa));
725 + resp = WLAN_STATUS_UNSPECIFIED_FAILURE;
729 sta->capability = capab_info;
730 sta->listen_interval = listen_interval;
732 @@ -2236,7 +2262,7 @@ int ieee802_11_mgmt(struct hostapd_data
735 if (stype == WLAN_FC_STYPE_PROBE_REQ) {
736 - handle_probe_req(hapd, mgmt, len, fi->ssi_signal);
737 + handle_probe_req(hapd, mgmt, len, fi);
741 @@ -2251,17 +2277,17 @@ int ieee802_11_mgmt(struct hostapd_data
743 case WLAN_FC_STYPE_AUTH:
744 wpa_printf(MSG_DEBUG, "mgmt::auth");
745 - handle_auth(hapd, mgmt, len);
746 + handle_auth(hapd, mgmt, len, fi);
749 case WLAN_FC_STYPE_ASSOC_REQ:
750 wpa_printf(MSG_DEBUG, "mgmt::assoc_req");
751 - handle_assoc(hapd, mgmt, len, 0);
752 + handle_assoc(hapd, mgmt, len, 0, fi);
755 case WLAN_FC_STYPE_REASSOC_REQ:
756 wpa_printf(MSG_DEBUG, "mgmt::reassoc_req");
757 - handle_assoc(hapd, mgmt, len, 1);
758 + handle_assoc(hapd, mgmt, len, 1, fi);
761 case WLAN_FC_STYPE_DISASSOC:
762 --- a/src/ap/beacon.c
763 +++ b/src/ap/beacon.c
764 @@ -542,7 +542,7 @@ static enum ssid_match_result ssid_match
766 void handle_probe_req(struct hostapd_data *hapd,
767 const struct ieee80211_mgmt *mgmt, size_t len,
769 + struct hostapd_frame_info *fi)
772 struct ieee802_11_elems elems;
773 @@ -550,8 +550,14 @@ void handle_probe_req(struct hostapd_dat
775 struct sta_info *sta = NULL;
777 + int ssi_signal = fi->ssi_signal;
779 enum ssid_match_result res;
780 + struct hostapd_ubus_request req = {
781 + .type = HOSTAPD_UBUS_PROBE_REQ,
782 + .mgmt_frame = mgmt,
786 ie = mgmt->u.probe_req.variable;
787 if (len < IEEE80211_HDRLEN + sizeof(mgmt->u.probe_req))
788 @@ -710,6 +716,12 @@ void handle_probe_req(struct hostapd_dat
790 #endif /* CONFIG_P2P */
792 + if (hostapd_ubus_handle_event(hapd, &req)) {
793 + wpa_printf(MSG_DEBUG, "Probe request for " MACSTR " rejected by ubus handler.\n",
794 + MAC2STR(mgmt->sa));
798 /* TODO: verify that supp_rates contains at least one matching rate
799 * with AP configuration */
801 --- a/src/ap/beacon.h
802 +++ b/src/ap/beacon.h
803 @@ -14,7 +14,7 @@ struct ieee80211_mgmt;
805 void handle_probe_req(struct hostapd_data *hapd,
806 const struct ieee80211_mgmt *mgmt, size_t len,
808 + struct hostapd_frame_info *fi);
809 int ieee802_11_set_beacon(struct hostapd_data *hapd);
810 int ieee802_11_set_beacons(struct hostapd_iface *iface);
811 int ieee802_11_update_beacons(struct hostapd_iface *iface);