From 70342efca5d1f9a85d452d5d10b83c4b6e2eaff7 Mon Sep 17 00:00:00 2001 From: Filip Matusiak <filip.matusiak@iopsys.eu> Date: Wed, 29 Mar 2023 16:33:35 +0200 Subject: [PATCH] pass steer-success/failure event over UBUS Signed-off-by: Filip Matusiak <filip.matusiak@iopsys.eu> --- src/cntlr.c | 15 +++++++++++++++ src/cntlr.h | 2 ++ src/cntlr_map.c | 8 +++++++- 3 files changed, 24 insertions(+), 1 deletion(-) diff --git a/src/cntlr.c b/src/cntlr.c index d319e35c..5eb43456 100644 --- a/src/cntlr.c +++ b/src/cntlr.c @@ -527,6 +527,19 @@ void cntlr_notify_client_steer_req_evt(struct controller *c, cntlr_notify_event(c, "client_steer_request", ev_data); } +void cntlr_notify_client_steer_result(struct controller *c, + uint8_t *sta_mac, bool steer_success) +{ + char ev_data[1024] = {0}; + + snprintf(ev_data, sizeof(ev_data), + "{\"sta_mac\":\""MACFMT"\"" + ",\"status\":%s}", + MAC2STR(sta_mac), + steer_success ? "SUCCESS" : "FAIL"); + cntlr_notify_event(c, "client_steer_result", ev_data); +} + #if 0 static int invoke_disconnect_sta(struct node *n, struct netif_iface *p, uint8_t *sta_mac) @@ -568,6 +581,8 @@ static void cntlr_btm_req_timer_cb(atimer_t *t) c->dlem.network.steer_summary.btm_failure_cnt += s->de_sta->mapsta.pending_btm_resp_num; s->de_sta->mapsta.pending_btm_resp_num = 0; + + cntlr_notify_client_steer_result(c, s->de_sta->macaddr, false); } } diff --git a/src/cntlr.h b/src/cntlr.h index b25179fc..abd21bb6 100644 --- a/src/cntlr.h +++ b/src/cntlr.h @@ -393,6 +393,8 @@ void cntlr_update_sta_steer_counters(struct controller *c, uint8_t *sta_mac, void cntlr_notify_client_steer_req_evt(struct controller *c, uint8_t *bssid, uint32_t sta_nr, uint8_t stas[][6], uint32_t bssid_nr, uint8_t target_bssid[][6]); +void cntlr_notify_client_steer_result(struct controller *c, + uint8_t *sta_mac, bool steer_success); struct steer_control_config *get_steer_control_config(struct controller *c); struct sta *cntlr_add_sta(struct controller *c, uint8_t *macaddr); struct sta *cntlr_find_sta(struct controller *c, uint8_t *mac); diff --git a/src/cntlr_map.c b/src/cntlr_map.c index 8f392d08..88a78c04 100644 --- a/src/cntlr_map.c +++ b/src/cntlr_map.c @@ -1187,9 +1187,11 @@ int handle_1905_ack(void *cntlr, struct cmdu_buff *cmdu, struct node *n) dbg("%s: cmdu->cdata->hdr.mid %u\n", __func__, mid); - if (s->latest_assoc_cntrl_mid == mid) + if (s->latest_assoc_cntrl_mid == mid) { s->de_sta->mapsta.stats.failed_steer_attempts++; + cntlr_notify_client_steer_result(c, s->de_sta->macaddr, false); + } } } @@ -2726,6 +2728,8 @@ int handle_sta_steer_btm_report(void *cntlr, struct cmdu_buff *cmdu, s->de_sta->mapsta.stats.failed_steer_attempts++; s->de_sta->mapsta.stats.btm_failure_cnt++; c->dlem.network.steer_summary.btm_failure_cnt++; + + cntlr_notify_client_steer_result(c, s->de_sta->macaddr, false); } /* else: counters already updated in cntlr_btm_req_timer_cb */ @@ -2737,6 +2741,8 @@ int handle_sta_steer_btm_report(void *cntlr, struct cmdu_buff *cmdu, s->de_sta->mapsta.stats.btm_success_cnt++; c->dlem.network.steer_summary.btm_success_cnt++; + cntlr_notify_client_steer_result(c, s->de_sta->macaddr, true); + if (s->de_sta->mapsta.pending_btm_resp_num == 0) { /* Received succesful btm report, after the btm timeout, * meaning that failure counter have been increased -- GitLab