firmware/src/packages/fff/fff-network/files/usr/lib/nodewatcher.d/50-clients.sh
Adrian Schmutzler 858930547b treewide: use SPDX license identifiers
The SPDX license identifier provides a standardized way for specifying
licenses that is both human- and machine-readable. It is used upstream
both in OpenWrt and the Linux kernel.

Replace licenses in our repository by those identifiers.

The full-text licenses corresponding to these identifiers are
provided in the LICENSES folder.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
Acked-by: Fabian Bläse <fabian@blaese.de>
2021-03-06 18:53:26 +01:00

27 lines
719 B
Bash
Executable File

#!/bin/sh
# SPDX-License-Identifier: GPL-3.0-only
#
# Netmon Nodewatcher (C) 2010-2012 Freifunk Oldenburg
MESH_INTERFACE=$(uci get nodewatcher.@network[0].mesh_interface)
debug() {
(>&2 echo "nodewatcher: $1")
}
debug "Collecting information about connected clients"
client_count=0
dataclient=""
CLIENT_INTERFACES=$(ls "/sys/class/net/$MESH_INTERFACE/brif" | grep -v '^bat')
for clientif in ${CLIENT_INTERFACES}; do
cc=$(bridge fdb show br "$MESH_INTERFACE" brport "$clientif" | grep -v self | grep -v permanent -c)
client_count=$((client_count + cc))
dataclient="$dataclient<$clientif>$cc</$clientif>"
done
echo -n "<client_count>$client_count</client_count>"
echo -n "<clients>$dataclient</clients>"
exit 0