-
Notifications
You must be signed in to change notification settings - Fork 325
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
gluon-statistics-mcast: adding initial package
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 <[email protected]>
- Loading branch information
Showing
7 changed files
with
1,305 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
include $(TOPDIR)/rules.mk | ||
|
||
PKG_NAME:=gluon-statistics-mcast | ||
PKG_VERSION:=1 | ||
|
||
include ../gluon.mk | ||
|
||
define Package/gluon-statistics-mcast | ||
TITLE:=Gluon Statistics for Multicast Traffic | ||
DEPENDS:= +bpfcountd +libgluonutil | ||
endef | ||
|
||
define Package/gluon-statistics-mcast/description | ||
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". | ||
endef | ||
|
||
$(eval $(call BuildPackageGluon,gluon-statistics-mcast)) |
68 changes: 68 additions & 0 deletions
68
package/gluon-statistics-mcast/files/etc/hotplug.d/iface/40-bpfcountd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
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 |
Oops, something went wrong.