From e2681eb06a7d482d0595bb0a58920bc5358c61f7 Mon Sep 17 00:00:00 2001 From: Nick Hainke Date: Sun, 14 Jan 2018 01:26:13 +0100 Subject: hostapd: return with 80211 codes in handle event function If the auth or assoc request was denied the reason was always WLAN_STATUS_UNSPECIFIED_FAILURE. That's why for example the wpa supplicant was always trying to reconnect to the AP. Now it's possible to give reasoncodes why the auth or assoc was denied. Signed-off-by: Nick Hainke --- package/network/services/hostapd/src/src/ap/ubus.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) (limited to 'package/network/services/hostapd/src') diff --git a/package/network/services/hostapd/src/src/ap/ubus.c b/package/network/services/hostapd/src/src/ap/ubus.c index 59b92ab1c9..3dfc0a268f 100644 --- a/package/network/services/hostapd/src/src/ap/ubus.c +++ b/package/network/services/hostapd/src/src/ap/ubus.c @@ -778,7 +778,7 @@ void hostapd_ubus_free_bss(struct hostapd_data *hapd) struct ubus_event_req { struct ubus_notify_request nreq; - bool deny; + int resp; }; static void @@ -786,8 +786,7 @@ ubus_event_cb(struct ubus_notify_request *req, int idx, int ret) { struct ubus_event_req *ureq = container_of(req, struct ubus_event_req, nreq); - if (ret) - ureq->deny = true; + ureq->resp = ret; } int hostapd_ubus_handle_event(struct hostapd_data *hapd, struct hostapd_ubus_request *req) @@ -809,10 +808,10 @@ int hostapd_ubus_handle_event(struct hostapd_data *hapd, struct hostapd_ubus_req ban = avl_find_element(&hapd->ubus.banned, addr, ban, avl); if (ban) - return -2; + return WLAN_STATUS_AP_UNABLE_TO_HANDLE_NEW_STA; if (!hapd->ubus.obj.has_subscribers) - return 0; + return WLAN_STATUS_SUCCESS; if (req->type < ARRAY_SIZE(types)) type = types[req->type]; @@ -827,19 +826,19 @@ int hostapd_ubus_handle_event(struct hostapd_data *hapd, struct hostapd_ubus_req if (!hapd->ubus.notify_response) { ubus_notify(ctx, &hapd->ubus.obj, type, b.head, -1); - return 0; + return WLAN_STATUS_SUCCESS; } if (ubus_notify_async(ctx, &hapd->ubus.obj, type, b.head, &ureq.nreq)) - return 0; + return WLAN_STATUS_SUCCESS; ureq.nreq.status_cb = ubus_event_cb; ubus_complete_request(ctx, &ureq.nreq.req, 100); - if (ureq.deny) - return -1; + if (ureq.resp) + return ureq.resp; - return 0; + return WLAN_STATUS_SUCCESS; } void hostapd_ubus_notify(struct hostapd_data *hapd, const char *type, const u8 *addr) -- cgit v1.2.3