diff --git a/src/cntlr_map.c b/src/cntlr_map.c index a96ea2cc7e98db11d7dcf3fe1cf61a13e55869f6..4eb7fa2d3bf67af4544d99b8906531c9227e3772 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) {