sta: schedule sta_info timeout on creation
authorDavid Bauer <mail@david-bauer.net>
Mon, 25 Oct 2021 12:52:59 +0000 (14:52 +0200)
committerDavid Bauer <mail@david-bauer.net>
Fri, 29 Oct 2021 17:37:48 +0000 (19:37 +0200)
The codes looks to have a race-condition, where disconnected sta_infos
are created without scheduling a timeout.

As sta_infos are not connected by default, schedule the timeout upon
sta_info creation.

Fixes spurious spamming of "Refuse to add an already expired station
entry" on remote nodes.

Signed-off-by: David Bauer <mail@david-bauer.net>
sta.c

diff --git a/sta.c b/sta.c
index 959cff59ae33a170a6c2b1ce625ca64f197af60a..54bcaeb2a5c4e827ed7bcf1dcc7217ac3e860863 100644 (file)
--- a/sta.c
+++ b/sta.c
@@ -104,6 +104,10 @@ usteer_sta_info_get(struct sta *sta, struct usteer_node *node, bool *create)
        si->created = current_time;
        *create = true;
 
+       /* Node is by default not connected. */
+       si->connected = STA_NOT_CONNECTED;
+       usteer_sta_info_update_timeout(si, config.local_sta_timeout);
+
        return si;
 }