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>
This commit is contained in:
Nick Hainke
2018-01-14 01:26:13 +01:00
committed by Felix Fietkau
parent 83b4fa9b3b
commit e2681eb06a
2 changed files with 36 additions and 23 deletions

View File

@@ -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)