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

gluon-mesh-*: do not count wifi clients/neighbours inactive for more than 60s

parent f61d2523
No related branches found
No related tags found
No related merge requests found
...@@ -63,6 +63,8 @@ ...@@ -63,6 +63,8 @@
#define STRINGIFY(s) _STRINGIFY(s) #define STRINGIFY(s) _STRINGIFY(s)
#include <stdlib.h> #include <stdlib.h>
#define MAX_INACTIVITY 60000
#define SOCKET_INPUT_BUFFER_SIZE 255 #define SOCKET_INPUT_BUFFER_SIZE 255
#define BABEL_PORT 33123 #define BABEL_PORT 33123
#define VPN_INTERFACE "mesh-vpn" #define VPN_INTERFACE "mesh-vpn"
...@@ -461,8 +463,12 @@ static void count_iface_stations(size_t *wifi24, size_t *wifi5, const char *ifna ...@@ -461,8 +463,12 @@ static void count_iface_stations(size_t *wifi24, size_t *wifi5, const char *ifna
return; return;
struct iwinfo_assoclist_entry *entry; struct iwinfo_assoclist_entry *entry;
for (entry = (struct iwinfo_assoclist_entry *)buf; (char*)(entry+1) <= buf + len; entry++) for (entry = (struct iwinfo_assoclist_entry *)buf; (char*)(entry+1) <= buf + len; entry++) {
if (entry->inactive > MAX_INACTIVITY)
continue;
(*wifi)++; (*wifi)++;
}
} }
static void count_stations(size_t *wifi24, size_t *wifi5) { static void count_stations(size_t *wifi24, size_t *wifi5) {
...@@ -623,6 +629,9 @@ static struct json_object * get_wifi_neighbours(const char *ifname) { ...@@ -623,6 +629,9 @@ static struct json_object * get_wifi_neighbours(const char *ifname) {
struct iwinfo_assoclist_entry *entry; struct iwinfo_assoclist_entry *entry;
for (entry = (struct iwinfo_assoclist_entry *)buf; (char*)(entry+1) <= buf + len; entry++) { for (entry = (struct iwinfo_assoclist_entry *)buf; (char*)(entry+1) <= buf + len; entry++) {
if (entry->inactive > MAX_INACTIVITY)
continue;
struct json_object *obj = json_object_new_object(); struct json_object *obj = json_object_new_object();
json_object_object_add(obj, "signal", json_object_new_int(entry->signal)); json_object_object_add(obj, "signal", json_object_new_int(entry->signal));
......
...@@ -444,8 +444,12 @@ static void count_iface_stations(size_t *wifi24, size_t *wifi5, const char *ifna ...@@ -444,8 +444,12 @@ static void count_iface_stations(size_t *wifi24, size_t *wifi5, const char *ifna
return; return;
struct iwinfo_assoclist_entry *entry; struct iwinfo_assoclist_entry *entry;
for (entry = (struct iwinfo_assoclist_entry *)buf; (char*)(entry+1) <= buf + len; entry++) for (entry = (struct iwinfo_assoclist_entry *)buf; (char*)(entry+1) <= buf + len; entry++) {
if (entry->inactive > MAX_INACTIVITY)
continue;
(*wifi)++; (*wifi)++;
}
} }
static void count_stations(size_t *wifi24, size_t *wifi5) { static void count_stations(size_t *wifi24, size_t *wifi5) {
...@@ -712,6 +716,9 @@ static struct json_object * get_wifi_neighbours(const char *ifname) { ...@@ -712,6 +716,9 @@ static struct json_object * get_wifi_neighbours(const char *ifname) {
struct iwinfo_assoclist_entry *entry; struct iwinfo_assoclist_entry *entry;
for (entry = (struct iwinfo_assoclist_entry *)buf; (char*)(entry+1) <= buf + len; entry++) { for (entry = (struct iwinfo_assoclist_entry *)buf; (char*)(entry+1) <= buf + len; entry++) {
if (entry->inactive > MAX_INACTIVITY)
continue;
struct json_object *obj = json_object_new_object(); struct json_object *obj = json_object_new_object();
json_object_object_add(obj, "signal", json_object_new_int(entry->signal)); json_object_object_add(obj, "signal", json_object_new_int(entry->signal));
......
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