From b9b3efe3504c43a30acf628d6245862ab35aa1f7 Mon Sep 17 00:00:00 2001 From: PolynomialDivision Date: Fri, 29 Dec 2017 19:39:14 +0100 Subject: [PATCH 1/6] send notify --- src/utils/ubus.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/utils/ubus.c b/src/utils/ubus.c index 3ff8cbc..4b3603e 100644 --- a/src/utils/ubus.c +++ b/src/utils/ubus.c @@ -540,6 +540,8 @@ static int hostapd_notify(struct ubus_context *ctx, struct ubus_object *obj, // TODO: Only handle probe request and NOT assoc, ... + respond_to_notify(req->peer); + if (strncmp(method, "probe", 5) == 0) { return handle_probe_req(msg); } else if (strncmp(method, "auth", 4) == 0) { @@ -971,4 +973,13 @@ static void ubus_add_oject() if (ret) fprintf(stderr, "Failed to add watch handler: %s\n", ubus_strerror(ret)); */ +} + + +static void respond_to_notify(uint32_t id) { + blob_buf_init(&b, 0); + blobmsg_add_u32(&b, "notify_response", 1234); + + int timeout = 1; + ubus_invoke(ctx, id, "notify_response", b.head, NULL, NULL, timeout * 1000); } \ No newline at end of file From d31bfa5e07fa51be5d09fcd7e36537b53b339722 Mon Sep 17 00:00:00 2001 From: PolynomialDivision Date: Sat, 30 Dec 2017 15:32:04 +0100 Subject: [PATCH 2/6] send notify response --- src/utils/ubus.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/utils/ubus.c b/src/utils/ubus.c index 72f5d85..9552119 100644 --- a/src/utils/ubus.c +++ b/src/utils/ubus.c @@ -188,9 +188,12 @@ int hostapd_array_check_id(uint32_t id); void hostapd_array_insert(uint32_t id); void hostapd_array_delete(uint32_t id); + static void ubus_add_oject(); -void add_client_update_timer(time_t time) { +static void respond_to_notify(uint32_t id); + + void add_client_update_timer(time_t time) { uloop_timeout_set(&client_timer, time); } From 64529d64149379c670326c6ad5b98e9827fffe17 Mon Sep 17 00:00:00 2001 From: PolynomialDivision Date: Sat, 30 Dec 2017 15:43:38 +0100 Subject: [PATCH 3/6] use notify --- src/utils/ubus.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/utils/ubus.c b/src/utils/ubus.c index 9552119..e7ca638 100644 --- a/src/utils/ubus.c +++ b/src/utils/ubus.c @@ -1016,8 +1016,9 @@ static void ubus_add_oject() static void respond_to_notify(uint32_t id) { + printf("SENDING NOTIFY!!!\n"); blob_buf_init(&b, 0); - blobmsg_add_u32(&b, "notify_response", 1234); + blobmsg_add_u32(&b, "notify_response", 0); int timeout = 1; ubus_invoke(ctx, id, "notify_response", b.head, NULL, NULL, timeout * 1000); From 66c3f005e65276f54451af64c7ad5e102ee9c179 Mon Sep 17 00:00:00 2001 From: PolynomialDivision Date: Thu, 4 Jan 2018 11:57:00 +0100 Subject: [PATCH 4/6] add files and so on --- files/dawn.config | 2 +- src/utils/ubus.c | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/files/dawn.config b/files/dawn.config index a81923e..d8c27bc 100644 --- a/files/dawn.config +++ b/files/dawn.config @@ -32,7 +32,7 @@ config metric option low_rssi_val '-80' option chan_util_val '140' option max_chan_util_val '170' - option min_probe_count '4' + option min_probe_count '100' option bandwith_threshold '6' option use_station_count '1' option eval_probe_req '1' \ No newline at end of file diff --git a/src/utils/ubus.c b/src/utils/ubus.c index e7ca638..bb91980 100644 --- a/src/utils/ubus.c +++ b/src/utils/ubus.c @@ -596,6 +596,9 @@ static int add_subscriber(char *name) { hostapd_array_insert(id); fprintf(stderr, "Watching object %08x: %s\n", id, ubus_strerror(ret)); + // respond to notify... + respond_to_notify(id); + return 0; } @@ -1018,7 +1021,7 @@ static void ubus_add_oject() static void respond_to_notify(uint32_t id) { printf("SENDING NOTIFY!!!\n"); blob_buf_init(&b, 0); - blobmsg_add_u32(&b, "notify_response", 0); + blobmsg_add_u32(&b, "notify_response", 1); int timeout = 1; ubus_invoke(ctx, id, "notify_response", b.head, NULL, NULL, timeout * 1000); From c8bdc3472bfe960edcac0fe47d1990c1426a6e61 Mon Sep 17 00:00:00 2001 From: PolynomialDivision Date: Thu, 4 Jan 2018 12:08:26 +0100 Subject: [PATCH 5/6] use notify call --- files/dawn.config | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/files/dawn.config b/files/dawn.config index d8c27bc..8cad0b0 100644 --- a/files/dawn.config +++ b/files/dawn.config @@ -32,7 +32,7 @@ config metric option low_rssi_val '-80' option chan_util_val '140' option max_chan_util_val '170' - option min_probe_count '100' + option min_probe_count '4' option bandwith_threshold '6' option use_station_count '1' - option eval_probe_req '1' \ No newline at end of file + option eval_probe_req '1' From 96ad652c27d42a9237804a6395a6b78286f3a23e Mon Sep 17 00:00:00 2001 From: PolynomialDivision Date: Thu, 4 Jan 2018 12:12:43 +0100 Subject: [PATCH 6/6] remove code --- src/utils/ubus.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/utils/ubus.c b/src/utils/ubus.c index bb91980..80feb64 100644 --- a/src/utils/ubus.c +++ b/src/utils/ubus.c @@ -193,7 +193,7 @@ static void ubus_add_oject(); static void respond_to_notify(uint32_t id); - void add_client_update_timer(time_t time) { +void add_client_update_timer(time_t time) { uloop_timeout_set(&client_timer, time); } @@ -565,8 +565,6 @@ static int hostapd_notify(struct ubus_context *ctx, struct ubus_object *obj, // TODO: Only handle probe request and NOT assoc, ... - respond_to_notify(req->peer); - if (strncmp(method, "probe", 5) == 0) { return handle_probe_req(msg); } else if (strncmp(method, "auth", 4) == 0) {