[RESEND PATCH usteer v3 4/9] 802.11 Mgmt: DEAUTH reason more accurate

Nils Hendrik Rottgardt n.rottgardt at gmail.com
Tue Dec 3 12:55:27 PST 2024


- policy: DEAUTH reason code linked to the trigger caused the DEAUTH
- ubus: add reason code to method usteer_ubus_kick_client

Signed-off-by: Nils Hendrik Rottgardt <n.rottgardt at gmail.com>
---
 policy.c | 9 +++------
 ubus.c   | 4 ++--
 usteer.h | 2 +-
 3 files changed, 6 insertions(+), 9 deletions(-)

diff --git a/policy.c b/policy.c
index b6b393f..f3150e9 100644
--- a/policy.c
+++ b/policy.c
@@ -498,8 +498,7 @@ usteer_local_node_snr_kick(struct usteer_local_node *ln)
 		ev.threshold.cur = si->signal;
 		ev.count = si->kick_count;
 		usteer_event(&ev);
-
-		usteer_ubus_kick_client(si);
+		usteer_ubus_kick_client(si, 1);
 		return;
 	}
 }
@@ -582,8 +581,7 @@ usteer_local_node_load_kick(struct usteer_local_node *ln)
 	ev.si_cur = kick1;
 	ev.si_other = candidate;
 	ev.count = kick1->kick_count;
-
-	usteer_ubus_kick_client(kick1);
+	usteer_ubus_kick_client(kick1, config.load_kick_reason_code);
 
 out:
 	usteer_event(&ev);
@@ -597,8 +595,7 @@ usteer_local_node_perform_kick(struct usteer_local_node *ln)
 	list_for_each_entry(si, &ln->node.sta_info, node_list) {
 		if (!si->kick_time || si->kick_time > current_time)
 			continue;
-
-		usteer_ubus_kick_client(si);
+		usteer_ubus_kick_client(si, 12);
 	}
 }
 
diff --git a/ubus.c b/ubus.c
index 57b7d29..856ea3f 100644
--- a/ubus.c
+++ b/ubus.c
@@ -771,13 +771,13 @@ int usteer_ubus_trigger_client_scan(struct sta_info *si)
 	return ubus_invoke(ubus_ctx, ln->obj_id, "rrm_beacon_req", b.head, NULL, 0, 100);
 }
 
-void usteer_ubus_kick_client(struct sta_info *si)
+void usteer_ubus_kick_client(struct sta_info *si, uint32_t kick_reason_code)
 {
 	struct usteer_local_node *ln = container_of(si->node, struct usteer_local_node, node);
 
 	blob_buf_init(&b, 0);
 	blobmsg_printf(&b, "addr", MAC_ADDR_FMT, MAC_ADDR_DATA(si->sta->addr));
-	blobmsg_add_u32(&b, "reason", config.load_kick_reason_code);
+	blobmsg_add_u32(&b, "reason", kick_reason_code);
 	blobmsg_add_u8(&b, "deauth", 1);
 	ubus_invoke(ubus_ctx, ln->obj_id, "del_client", b.head, NULL, 0, 100);
 	usteer_sta_disconnected(si);
diff --git a/usteer.h b/usteer.h
index ec6e251..680981f 100644
--- a/usteer.h
+++ b/usteer.h
@@ -341,7 +341,7 @@ void usteer_band_steering_sta_update(struct sta_info *si);
 bool usteer_band_steering_is_target(struct usteer_local_node *ln, struct usteer_node *node);
 
 void usteer_ubus_init(struct ubus_context *ctx);
-void usteer_ubus_kick_client(struct sta_info *si);
+void usteer_ubus_kick_client(struct sta_info *si, uint32_t kick_reason_code);
 int usteer_ubus_trigger_client_scan(struct sta_info *si);
 int usteer_ubus_band_steering_request(struct sta_info *si,
                                       uint8_t dialog_token,
-- 
2.39.5




More information about the openwrt-devel mailing list