Skip to content
Snippets Groups Projects
Unverified Commit f61d2523 authored by Matthias Schiffer's avatar Matthias Schiffer
Browse files

gluon-mesh-batman-adv: respondd: do not count batadv clients inactive for more than 60s

parent af9c1f7e
No related branches found
No related tags found
No related merge requests found
......@@ -57,6 +57,9 @@
#define _STRINGIFY(s) #s
#define STRINGIFY(s) _STRINGIFY(s)
#define MAX_INACTIVITY 60000
struct neigh_netlink_opts {
struct json_object *interfaces;
struct batadv_nlquery_opts query_opts;
......@@ -484,6 +487,12 @@ static void count_stations(size_t *wifi24, size_t *wifi5) {
static const enum batadv_nl_attrs clients_mandatory[] = {
BATADV_ATTR_TT_FLAGS,
/* Entries without the BATADV_TT_CLIENT_NOPURGE flag do not have a
* BATADV_ATTR_LAST_SEEN_MSECS attribute. We can still make this attr
* mandatory here, as entries without BATADV_TT_CLIENT_NOPURGE are
* ignored anyways.
*/
BATADV_ATTR_LAST_SEEN_MSECS,
};
static int parse_clients_list_netlink_cb(struct nl_msg *msg, void *arg)
......@@ -493,7 +502,7 @@ static int parse_clients_list_netlink_cb(struct nl_msg *msg, void *arg)
struct batadv_nlquery_opts *query_opts = arg;
struct genlmsghdr *ghdr;
struct clients_netlink_opts *opts;
uint32_t flags;
uint32_t flags, lastseen;
opts = batadv_container_of(query_opts, struct clients_netlink_opts,
query_opts);
......@@ -519,6 +528,10 @@ static int parse_clients_list_netlink_cb(struct nl_msg *msg, void *arg)
if (flags & BATADV_TT_CLIENT_NOPURGE)
return NL_OK;
lastseen = nla_get_u32(attrs[BATADV_ATTR_LAST_SEEN_MSECS]);
if (lastseen > MAX_INACTIVITY)
return NL_OK;
if (flags & BATADV_TT_CLIENT_WIFI)
opts->wifi++;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment