diff options
author | Nick Hainke <vincent@systemli.org> | 2018-01-14 01:26:13 +0100 |
---|---|---|
committer | Felix Fietkau <nbd@nbd.name> | 2018-02-21 19:28:56 +0100 |
commit | e2681eb06a7d482d0595bb0a58920bc5358c61f7 (patch) | |
tree | 1433e2c3339c8d5a4766382707ea50492e67cdae /package/network/services/hostapd/src | |
parent | 83b4fa9b3ba5622f9219094a4060d76ffe05c717 (diff) | |
download | upstream-e2681eb06a7d482d0595bb0a58920bc5358c61f7.tar.gz upstream-e2681eb06a7d482d0595bb0a58920bc5358c61f7.tar.bz2 upstream-e2681eb06a7d482d0595bb0a58920bc5358c61f7.zip |
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 <vincent@systemli.org>
Diffstat (limited to 'package/network/services/hostapd/src')
-rw-r--r-- | package/network/services/hostapd/src/src/ap/ubus.c | 19 |
1 files changed, 9 insertions, 10 deletions
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) |