This package collects disected statistics on multicast and management traffic and provides them via respondd in "statistics-extended". Such information can be helpful for further development and comparison of mesh routing protocols and troubleshooting network issues. The statistics gathered disect into batman-adv packets as well. Statistics are collected both on client bridge ports and br-client as well as mesh interfaces. This introduces a performance penalty but tries to keep the impact on unicast traffic small. Note that respondd replies are rather large (several UDP datagrams, even when LZMA compressed). Therefore you might want to use slower intervals for querying respondd "statistics-extended". Signed-off-by: Linus Lüssing <linus.luessing@c0d3.blue>
69 lines
1.3 KiB
Plaintext
69 lines
1.3 KiB
Plaintext
case "$INTERFACE" in
|
|
"client"|\
|
|
"mmfd")
|
|
;;
|
|
*)
|
|
exit 0
|
|
;;
|
|
esac
|
|
|
|
BPFCOUNTD_RUN="/var/run/bpfcountd"
|
|
mkdir -p "${BPFCOUNTD_RUN}/gluon-ifaces"
|
|
|
|
get_ifup_ifaces() {
|
|
local ifaces="$DEVICE"
|
|
local brports
|
|
|
|
if [ -d "/sys/class/net/$DEVICE/bridge/" ]; then
|
|
brports="$(ls "/sys/class/net/$DEVICE/brif/")"
|
|
[ -n "$brports" ] && ifaces="$(echo -e "${brports}\n${ifaces}")"
|
|
fi
|
|
|
|
echo "$ifaces"
|
|
}
|
|
|
|
get_ifdown_ifaces() {
|
|
cat "${BPFCOUNTD_RUN}/gluon-ifaces/$INTERFACE"
|
|
}
|
|
|
|
bpfcountd_start() {
|
|
local ifaces="$(get_ifup_ifaces)"
|
|
local iface
|
|
|
|
[ -z "$ifaces" ] && return
|
|
[ -f "${BPFCOUNTD_RUN}/gluon-ifaces/$INTERFACE" ] && return
|
|
echo "$ifaces" > "${BPFCOUNTD_RUN}/gluon-ifaces/$INTERFACE"
|
|
|
|
for iface in $ifaces; do
|
|
IFNAME="$iface" /lib/gluon/core/mesh/setup.d/40-bpfcountd "clients"
|
|
done
|
|
}
|
|
|
|
bpfcountd_stop() {
|
|
local ifaces="$(get_ifdown_ifaces)"
|
|
local iface
|
|
|
|
[ -z "$ifaces" ] && return
|
|
rm "${BPFCOUNTD_RUN}/gluon-ifaces/$INTERFACE"
|
|
|
|
for iface in $ifaces; do
|
|
IFNAME="$iface" /lib/gluon/core/mesh/teardown.d/40-bpfcountd
|
|
done
|
|
}
|
|
|
|
# synchronize reads+writes to /var/run/gluon-ifaces/$INTERFACE
|
|
lock /var/lock/gluon_bpfcountd_ifaces.lock
|
|
|
|
case "$ACTION" in
|
|
"ifup")
|
|
bpfcountd_start
|
|
;;
|
|
"ifdown")
|
|
bpfcountd_stop
|
|
;;
|
|
*)
|
|
;;
|
|
esac
|
|
|
|
lock -u /var/lock/gluon_bpfcountd_ifaces.lock
|