sta-info: add last_connected field

Add a last_connected field to the sta_info struct. This field can be
used to determine, if and when a client was last connected to a given
node. This way, other nodes can determine where a client roamed to or
from.

Signed-off-by: David Bauer <mail@david-bauer.net>
This commit is contained in:
David Bauer
2021-09-27 20:56:41 +02:00
parent 681354256f
commit 6a20591b20
5 changed files with 15 additions and 2 deletions

View File

@@ -180,6 +180,7 @@ interface_add_station(struct usteer_remote_node *node, struct blob_attr *data)
si->connected = msg.connected;
si->signal = msg.signal;
si->seen = current_time - msg.seen;
si->last_connected = current_time - msg.last_connected;
usteer_sta_info_update_timeout(si, msg.timeout);
}
@@ -519,6 +520,7 @@ static void interface_send_msg(struct interface *iface, struct blob_attr *data){
static void usteer_send_sta_info(struct sta_info *sta)
{
int seen = current_time - sta->seen;
int last_connected = !!sta->connected ? 0 : current_time - sta->last_connected;
void *c;
c = blob_nest_start(&buf, 0);
@@ -526,6 +528,7 @@ static void usteer_send_sta_info(struct sta_info *sta)
blob_put_int8(&buf, APMSG_STA_CONNECTED, !!sta->connected);
blob_put_int32(&buf, APMSG_STA_SIGNAL, sta->signal);
blob_put_int32(&buf, APMSG_STA_SEEN, seen);
blob_put_int32(&buf, APMSG_STA_LAST_CONNECTED, last_connected);
blob_put_int32(&buf, APMSG_STA_TIMEOUT, config.local_sta_timeout - seen);
blob_nest_end(&buf, c);
}