[PATCH v2 2/5] nodewatcher: add a iface blacklist

Tobias Klaus tk+ff at meskal.net
Sa Okt 10 14:30:00 CEST 2015


Am Samstag, 10. Oktober 2015, 10:24:57 schrieb Tim Niemeyer:
> Signed-off-by: Tim Niemeyer <tim.niemeyer at mastersword.de>
Reviewed-by: Tobias Klaus <tk+ff at meskal.net>

Kleine Anmerkung siehe unten
> ---
> 
> Changes in v2:
> - fix indent
> - add comment in config
> - don't change script version here
> 
>  bsp/default/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
> 9cc8f9d..38132e5 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 send to netmon
sollte sent heißen	

> at all diff --git a/bsp/default/root_file_system/etc/nodewatcher.sh
> b/bsp/default/root_file_system/etc/nodewatcher.sh index 0c7de78..9a15485
> 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. at script[0].data_file`
>  	MESH_INTERFACE=`uci get nodewatcher. at network[0].mesh_interface`
>  	CLIENT_INTERFACES=`uci get nodewatcher. at network[0].client_interfaces`
> +	IFACEBLACKLIST=`uci get nodewatcher. at 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="<status>online</status><hostname>$hostname</hostname><distnam
> e>$distname</distname><distversion>$distversion</distversion>$cpu$memory$loa
> d$uptime<local_time>$local_time</local_time><batman_advanced_version>$batman
> _adv_version</batman_advanced_version><kernel_version>$kernel_version</kerne
> l_version><fastd_version>$fastd_version</fastd_version><nodewatcher_version>
> $nodewatcher_version</nodewatcher_version><firmware_version>$FIRMWARE_VERSIO
> N</firmware_version><firmware_revision>$BUILD_DATE</firmware_revision><openw
> rt_core_revision>$OPENWRT_CORE_REVISION</openwrt_core_revision><openwrt_feed
> s_packages_revision>$OPENWRT_FEEDS_PACKAGES_REVISION</openwrt_feeds_packages
> _revision>"
> +	SYSTEM_DATA="<status>online</status><hostname>$hostname</hostname><distna
> me>$distname</distname><distversion>$distversion</distversion>$cpu$model$mem
> ory$load$uptime<local_time>$local_time</local_time><batman_advanced_version>
> $batman_adv_version</batman_advanced_version><kernel_version>$kernel_version
> </kernel_version><fastd_version>$fastd_version</fastd_version><nodewatcher_v
> ersion>$nodewatcher_version</nodewatcher_version><firmware_version>$FIRMWARE
> _VERSION</firmware_version><firmware_revision>$BUILD_DATE</firmware_revision
> ><openwrt_core_revision>$OPENWRT_CORE_REVISION</openwrt_core_revision><openw
> rt_feeds_packages_revision>$OPENWRT_FEEDS_PACKAGES_REVISION</openwrt_feeds_p
> ackages_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
-------------- nächster Teil --------------
Ein Dateianhang mit Binärdaten wurde abgetrennt...
Dateiname   : signature.asc
Dateityp    : application/pgp-signature
Dateigröße  : 819 bytes
Beschreibung: This is a digitally signed message part.
URL         : <http://lists.freifunk.net/pipermail/franken-dev-freifunk.net/attachments/20151010/a09ca8ac/attachment-0002.sig>


Mehr Informationen über die Mailingliste franken-dev