From 96a3375d1026854b3a582477abdadc4009755647 Mon Sep 17 00:00:00 2001 From: Filip Matusiak <filip.matusiak@iopsys.eu> Date: Tue, 14 Mar 2023 09:06:21 +0100 Subject: [PATCH] Always reset steer params upon operational channel change Signed-off-by: Filip Matusiak <filip.matusiak@iopsys.eu> --- src/cntlr.h | 3 ++- src/cntlr_map.c | 8 ++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/cntlr.h b/src/cntlr.h index 5e21cab3..470579a6 100644 --- a/src/cntlr.h +++ b/src/cntlr.h @@ -286,9 +286,10 @@ enum cntlr_state { CNTLR_START /* normal */ }; +#define STEER_MAX_CHANNEL 64 struct steering { int channels_num; - uint8_t channels[64]; + uint8_t channels[STEER_MAX_CHANNEL]; }; struct controller { diff --git a/src/cntlr_map.c b/src/cntlr_map.c index 4822aeb9..cac00a56 100644 --- a/src/cntlr_map.c +++ b/src/cntlr_map.c @@ -180,6 +180,13 @@ int handle_topology_notification(void *cntlr, struct cmdu_buff *cmdu, return 0; } +static void cntlr_reset_steer_params(struct controller *c) +{ + c->steer_params.channels_num = 0; + memset(c->steer_params.channels, 0, + STEER_MAX_CHANNEL * sizeof(c->steer_params.channels[0])); +} + static void cntlr_update_steer_params(struct controller *c, struct wifi_radio_opclass *op) { int i, j, k; @@ -1591,6 +1598,7 @@ int handle_oper_channel_report(void *cntlr, struct cmdu_buff *cmdu, struct node cntlr_radio_cur_opclass_dump(r->radio_el); /* Channel changed, update ctrl's steer params accordingly */ + cntlr_reset_steer_params(c); cntlr_update_steer_params(c, &r->radio_el->cur_opclass); } -- GitLab