usteer: add connected-since
Fetch the age of the association for STAs in order to implement minimum intervals after which a STA is considered kickable. Signed-off-by: David Bauer <mail@david-bauer.net>
This commit is contained in:
@@ -269,6 +269,9 @@ static void nl80211_update_sta(struct usteer_node *node, struct sta_info *si)
|
|||||||
|
|
||||||
if (tb_sta[NL80211_STA_INFO_SIGNAL_AVG])
|
if (tb_sta[NL80211_STA_INFO_SIGNAL_AVG])
|
||||||
signal = (int8_t) nla_get_u8(tb_sta[NL80211_STA_INFO_SIGNAL_AVG]);
|
signal = (int8_t) nla_get_u8(tb_sta[NL80211_STA_INFO_SIGNAL_AVG]);
|
||||||
|
|
||||||
|
if (tb_sta[NL80211_STA_INFO_CONNECTED_TIME])
|
||||||
|
si->connected_since = current_time - (nla_get_u32(tb_sta[NL80211_STA_INFO_CONNECTED_TIME]) * 1000);
|
||||||
|
|
||||||
usteer_sta_info_update(si, signal, true);
|
usteer_sta_info_update(si, signal, true);
|
||||||
|
|
||||||
|
1
sta.c
1
sta.c
@@ -150,6 +150,7 @@ void usteer_sta_disconnected(struct sta_info *si)
|
|||||||
{
|
{
|
||||||
si->connected = STA_NOT_CONNECTED;
|
si->connected = STA_NOT_CONNECTED;
|
||||||
si->kick_time = 0;
|
si->kick_time = 0;
|
||||||
|
si->connected_since = 0;
|
||||||
usteer_sta_info_update_timeout(si, config.local_sta_timeout);
|
usteer_sta_info_update_timeout(si, config.local_sta_timeout);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
1
ubus.c
1
ubus.c
@@ -403,6 +403,7 @@ usteer_ubus_get_connected_clients(struct ubus_context *ctx, struct ubus_object *
|
|||||||
blobmsg_add_u32(&b, "signal", si->signal);
|
blobmsg_add_u32(&b, "signal", si->signal);
|
||||||
blobmsg_add_u64(&b, "created", si->created);
|
blobmsg_add_u64(&b, "created", si->created);
|
||||||
blobmsg_add_u64(&b, "seen", si->seen);
|
blobmsg_add_u64(&b, "seen", si->seen);
|
||||||
|
blobmsg_add_u64(&b, "connected_since", si->connected_since);
|
||||||
blobmsg_add_u64(&b, "last_connected", si->last_connected);
|
blobmsg_add_u64(&b, "last_connected", si->last_connected);
|
||||||
|
|
||||||
t = blobmsg_open_table(&b, "snr-kick");
|
t = blobmsg_open_table(&b, "snr-kick");
|
||||||
|
3
usteer.h
3
usteer.h
@@ -241,7 +241,10 @@ struct sta_info {
|
|||||||
struct sta_info_stats stats[__EVENT_TYPE_MAX];
|
struct sta_info_stats stats[__EVENT_TYPE_MAX];
|
||||||
uint64_t created;
|
uint64_t created;
|
||||||
uint64_t seen;
|
uint64_t seen;
|
||||||
|
|
||||||
|
uint64_t connected_since;
|
||||||
uint64_t last_connected;
|
uint64_t last_connected;
|
||||||
|
|
||||||
int signal;
|
int signal;
|
||||||
|
|
||||||
uint8_t rrm;
|
uint8_t rrm;
|
||||||
|
Reference in New Issue
Block a user