From a643265a27440cd649332414852ccc20a0eca292 Mon Sep 17 00:00:00 2001 From: PolynomialDivision Date: Thu, 4 Jan 2018 12:58:59 +0100 Subject: [PATCH 1/2] return with reason code --- files/dawn.config | 2 +- src/utils/ubus.c | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/files/dawn.config b/files/dawn.config index 8cad0b0..04a4ffb 100644 --- a/files/dawn.config +++ b/files/dawn.config @@ -35,4 +35,4 @@ config metric option min_probe_count '4' option bandwith_threshold '6' option use_station_count '1' - option eval_probe_req '1' + option eval_probe_req '0' diff --git a/src/utils/ubus.c b/src/utils/ubus.c index 80feb64..95f8cc7 100644 --- a/src/utils/ubus.c +++ b/src/utils/ubus.c @@ -9,6 +9,8 @@ #define ETH_ALEN 6 #endif +#define WLAN_STATUS_AP_UNABLE_TO_HANDLE_NEW_STA 17 + #include "ubus.h" #include "networksocket.h" @@ -371,12 +373,12 @@ static int handle_auth_req(struct blob_attr *msg) { // block if entry was not already found in probe database if (!(mac_is_equal(tmp.bssid_addr, auth_req.bssid_addr) && mac_is_equal(tmp.client_addr, auth_req.client_addr))) { printf("DENY AUTH!\n"); - return UBUS_STATUS_UNKNOWN_ERROR; + return WLAN_STATUS_AP_UNABLE_TO_HANDLE_NEW_STA; } if (!decide_function(&tmp)) { printf("DENY AUTH\n"); - return UBUS_STATUS_UNKNOWN_ERROR; + return WLAN_STATUS_AP_UNABLE_TO_HANDLE_NEW_STA; } // maybe add here if a client is already connected... @@ -406,7 +408,7 @@ static int handle_probe_req(struct blob_attr *msg) { if (!decide_function(&tmp_prob_req)) { //printf("MAC WILL BE DECLINED!!!\n"); - return UBUS_STATUS_UNKNOWN_ERROR; + return WLAN_STATUS_AP_UNABLE_TO_HANDLE_NEW_STA; } //printf("MAC WILL BE ACCEPDTED!!!\n"); return 0; From 8c68e2fe205a01b814e9d56e705b3b3e63aeb563 Mon Sep 17 00:00:00 2001 From: PolynomialDivision Date: Thu, 4 Jan 2018 13:05:17 +0100 Subject: [PATCH 2/2] respond with reason code --- files/dawn.config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/files/dawn.config b/files/dawn.config index 04a4ffb..8cad0b0 100644 --- a/files/dawn.config +++ b/files/dawn.config @@ -35,4 +35,4 @@ config metric option min_probe_count '4' option bandwith_threshold '6' option use_station_count '1' - option eval_probe_req '0' + option eval_probe_req '1'