From 913ccd17339ec35657defbd1c481e6c341f53b22 Mon Sep 17 00:00:00 2001 From: Tim Niemeyer Date: Sat, 10 Oct 2015 10:24:57 +0200 Subject: [PATCH] nodewatcher: add a iface blacklist Signed-off-by: Tim Niemeyer Reviewed-by: Tobias Klaus --- .../root_file_system/etc/config/nodewatcher | 3 ++- bsp/default/root_file_system/etc/nodewatcher.sh | 15 +++++++++++++-- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/bsp/default/root_file_system/etc/config/nodewatcher b/bsp/default/root_file_system/etc/config/nodewatcher index 9cc8f9d1..9571220a 100644 --- a/bsp/default/root_file_system/etc/config/nodewatcher +++ b/bsp/default/root_file_system/etc/config/nodewatcher @@ -5,4 +5,5 @@ config 'script' option 'data_file' '/tmp/crawldata/node.data' config 'network' - option 'mesh_interface' 'br-mesh' \ No newline at end of file + option 'mesh_interface' 'br-mesh' + option 'iface_blacklist' 'lo ifb0' # This devices won't be sent to netmon at all diff --git a/bsp/default/root_file_system/etc/nodewatcher.sh b/bsp/default/root_file_system/etc/nodewatcher.sh index 0c7de782..9a154859 100755 --- a/bsp/default/root_file_system/etc/nodewatcher.sh +++ b/bsp/default/root_file_system/etc/nodewatcher.sh @@ -14,6 +14,7 @@ if [ -f /etc/config/nodewatcher ];then SCRIPT_DATA_FILE=`uci get nodewatcher.@script[0].data_file` MESH_INTERFACE=`uci get nodewatcher.@network[0].mesh_interface` CLIENT_INTERFACES=`uci get nodewatcher.@network[0].client_interfaces` + IFACEBLACKLIST=`uci get nodewatcher.@network[0].iface_blacklist` else . `dirname $0`/nodewatcher_config fi @@ -38,6 +39,16 @@ delete_log() { fi } +inArray() { + local value + for value in $1; do + if [ "$value" = "$2" ]; then + return 0 + fi + done + return 1 +} + #this method generates the crawl data xml file that is beeing fetched by netmon #and provided by a small local httpd crawl() { @@ -83,7 +94,7 @@ crawl() { #OPENWRT_CORE_REVISION="35298" #OPENWRT_FEEDS_PACKAGES_REVISION="35298" . /etc/firmware_release - SYSTEM_DATA="online$hostname$distname$distversion$cpu$memory$load$uptime$local_time$batman_adv_version$kernel_version$fastd_version$nodewatcher_version$FIRMWARE_VERSION$BUILD_DATE$OPENWRT_CORE_REVISION$OPENWRT_FEEDS_PACKAGES_REVISION" + SYSTEM_DATA="online$hostname$distname$distversion$cpu$model$memory$load$uptime$local_time$batman_adv_version$kernel_version$fastd_version$nodewatcher_version$FIRMWARE_VERSION$BUILD_DATE$OPENWRT_CORE_REVISION$OPENWRT_FEEDS_PACKAGES_REVISION" err "`date`: Collecting information from network interfaces" @@ -96,7 +107,7 @@ crawl() { for filename in `grep 'up\|unknown' /sys/class/net/*/operstate`; do ifpath=${filename%/operstate*} iface=${ifpath#/sys/class/net/} - if [ "$iface" = "lo" ]; then + if inArray "$IFACEBLACKLIST" "$iface"; then continue fi