From f3d5ee65e51ef1e3f4910b9ea7598e204ee03dfe Mon Sep 17 00:00:00 2001 From: Filip Matusiak <filip.matusiak@iopsys.eu> Date: Tue, 3 Jun 2025 13:45:18 +0200 Subject: [PATCH] Remove STA from old node before adding to new one --- src/cntlr_map.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/cntlr_map.c b/src/cntlr_map.c index a96ea2cc..4eb7fa2d 100644 --- a/src/cntlr_map.c +++ b/src/cntlr_map.c @@ -617,6 +617,15 @@ int handle_topology_response(void *cntlr, struct cmdu_buff *cmdu, struct node *n s->de_sta->conn_time = conntime; s->state = conntime != 0 ? STA_ASSOCIATED : STA_DISCONNECTED; if (old_state != STA_ASSOCIATED && s->state == STA_ASSOCIATED) { + if (!hwaddr_is_zero(s->agent_almacaddr) && + memcmp(s->agent_almacaddr, n->almacaddr, 6)) { + /* associated to a new node - remove from the old one */ + struct node *old_n = NULL; + + old_n = cntlr_find_node(c, s->agent_almacaddr); + if (old_n) + node_del_sta(old_n, s); + } node_add_sta(n, s); time(&s->assoc_time); } else if (old_state != STA_DISCONNECTED && s->state == STA_DISCONNECTED) { -- GitLab