[RFC PATCH 7/9] bsp/default: remove wlanwatchdog and dependencies

Tobias Klaus tk+ff at meskal.net
Mo Nov 2 22:44:14 CET 2015


Hallo,

was waren denn die Gründe den watchdog einzuführen und welche Änderungen im 
ChaosCalmer führen dazu, dass wirs jetzt nicht mehr brauchen?
Grundsätzlich bin ich ja froh um jede Datei, die wir nicht von Openwrt 
abweichen. Leider kann ich das nicht genau bewerten.

Grüße
Tobias

Am Sonntag, 25. Oktober 2015, 16:26:26 schrieb Tim Niemeyer:
> Signed-off-by: Tim Niemeyer <tim.niemeyer at mastersword.de>
> ---
> Besonders hier interessiert mich eure Meinung. Kann das Ding wirklich weg?
> 
>  bsp/default/root_file_system/etc/crontabs/root   |   4 +-
>  bsp/default/root_file_system/etc/environment.sh  |  54 -------
>  bsp/default/root_file_system/etc/rc.local.tpl    |   5 +-
>  bsp/default/root_file_system/etc/wlanwatchdog.sh | 173
> ----------------------- 4 files changed, 3 insertions(+), 233 deletions(-)
>  delete mode 100755 bsp/default/root_file_system/etc/environment.sh
>  delete mode 100755 bsp/default/root_file_system/etc/wlanwatchdog.sh
> 
> diff --git a/bsp/default/root_file_system/etc/crontabs/root
> b/bsp/default/root_file_system/etc/crontabs/root index 7122f77..630c358
> 100644
> --- a/bsp/default/root_file_system/etc/crontabs/root
> +++ b/bsp/default/root_file_system/etc/crontabs/root
> @@ -1,7 +1,7 @@
> -*/5 * * * *	sh /etc/fastdstart.sh; sh /etc/nodewatcher.sh; sh
> /etc/configurator.sh; sh /etc/wlanwatchdog.sh >> /var/log/wlanwatchdog.log
> 2>&1 +*/5 * * * *	sh /etc/fastdstart.sh; sh /etc/nodewatcher.sh; sh
> /etc/configurator.sh */1 * * * * /usr/sbin/batctl gw off; sleep 1;
> /usr/sbin/batctl gw client
> 
>  #15 01 * * *	rdate -s time.fu-berlin.de > /dev/null
> 
>  #Enable zapp script if you are running a gateway
> -#*/1 * * * * /etc/init.d/zapp
> \ No newline at end of file
> +#*/1 * * * * /etc/init.d/zapp
> diff --git a/bsp/default/root_file_system/etc/environment.sh
> b/bsp/default/root_file_system/etc/environment.sh deleted file mode 100755
> index 716c827..0000000
> --- a/bsp/default/root_file_system/etc/environment.sh
> +++ /dev/null
> @@ -1,54 +0,0 @@
> -#!/bin/ash
> -
> -# functions
> -#FIXME: define here your favorite methods to get the values
> -get_wlan_client_interface() {
> -	echo "wlan0"
> -}
> -
> -get_wlan_mesh_interface() {
> -	echo "wlan0-1"
> -}
> -
> -get_eth_client_interface() {
> -	echo ""
> -}
> -
> -get_eth_mesh_interface() {
> -	echo ""
> -}
> -
> -get_bridge_interface() {
> -	echo "br-mesh"
> -}
> -
> -get_batman_interface() {
> -	echo "bat0"
> -}
> -
> -get_vpn_interface() {
> -	test -f /etc/fastdstart.sh || exit;
> -	local $(grep -o project=.* /etc/fastdstart.sh)
> -	echo ${project}VPN | tr -d '"'
> -}
> -
> -get_debug_level() {
> -	echo "0"
> -}
> -
> -print_definitions() {
> -	echo "# interfaces"
> -	echo "WLAN_CLIENT_INTERFACE=$(get_wlan_client_interface)"
> -	echo "WLAN_MESH_INTERFACE=$(get_wlan_mesh_interface)"
> -	echo "ETH_CLIENT_INTERFACE=$(get_eth_client_interface)"
> -	echo "ETH_MESH_INTERFACE=$(get_eth_mesh_interface)"
> -	echo "BRIDGE_INTERFACE=$(get_bridge_interface)"
> -	echo "BATMAN_INTERFACE=$(get_batman_interface)"
> -	echo "VPN_INTERFACE=$(get_vpn_interface)"
> -	echo ""
> -	echo "# variables"
> -	echo "DEBUG=$(get_debug_level)"
> -}
> -
> -# program
> -print_definitions
> \ No newline at end of file
> diff --git a/bsp/default/root_file_system/etc/rc.local.tpl
> b/bsp/default/root_file_system/etc/rc.local.tpl index 99c93b0..b40c75f
> 100755
> --- a/bsp/default/root_file_system/etc/rc.local.tpl
> +++ b/bsp/default/root_file_system/etc/rc.local.tpl
> @@ -25,9 +25,6 @@ fi
> 
>  . /etc/network.sh
> 
> -# collect environment info and write to dot-script
> -/etc/environment.sh > /tmp/environment
> -
>  # Starting NTP-Client Daemon after 30s to ensure that the interface is up
>  ( sleep 30 ; ntpd -p ${NTPD_IP} ) &
> 
> @@ -42,4 +39,4 @@ httpd -h /tmp/crawldata
> 
>  touch /tmp/started
> 
> -exit 0
> \ No newline at end of file
> +exit 0
> diff --git a/bsp/default/root_file_system/etc/wlanwatchdog.sh
> b/bsp/default/root_file_system/etc/wlanwatchdog.sh deleted file mode 100755
> index ad00216..0000000
> --- a/bsp/default/root_file_system/etc/wlanwatchdog.sh
> +++ /dev/null
> @@ -1,173 +0,0 @@
> -#!/bin/ash
> -
> -test -f /tmp/started || exit
> -
> -# environment
> -. "/tmp/environment" || exit 1
> -
> -# constants
> -MINUTE=60
> -HOUR=3600
> -DAY=86400
> -TIMEOUT_SHORT=$((4*$MINUTE))
> -TIMEOUT_MEDIUM=$((29*$MINUTE))
> -TIMEOUT_LONG=$DAY
> -ORIGINATOR_QUALITY_MIN=50
> -CLIENT_AGE_MAX=60
> -STATEFILE="/tmp/wlanwatchdogstate"
> -DEBUGFILE="/root/wlanwatchdog_debug.log.gz"
> -
> -# variables
> -STATE=
> -SINCE=
> -
> -# functions
> -debug_output() {
> -	echo "==== DEBUG OUTPUT ===="
> -	echo "date: $(date)"
> -	echo "=== INTERFACES ==="
> -	ifconfig 2>&1
> -	echo "=== BATMAN ==="
> -	echo "== ORIGINATORS =="
> -	batctl o 2>&1
> -	echo "== STATISTICS =="
> -	batctl s 2>&1
> -	echo "== GATEWAYS =="
> -	batctl gwl 2>&1
> -	echo "=== BRIDGE ==="
> -	echo "== $BRIDGE_INTERFACE =="
> -	brctl showmacs $BRIDGE_INTERFACE 2>&1
> -	echo "=== CONNECTIVITY TESTS ==="
> -	echo "== PING GATEWAY OVER MESH =="
> -	ping -6 -c3 $(uci get configurator. at api[0].ipv6_address)%$(uci get
> configurator. at api[0].ipv6_interface) 2>&1 -	echo "== PING HOST OVER
> INTERNET =="
> -	ping -4 -c3 freifunk-ol.de 2>&1
> -	echo "=== WLAN ==="
> -	echo "== $WLAN_CLIENT_INTERFACE =="
> -	iw dev $WLAN_CLIENT_INTERFACE station dump 2>&1
> -	echo "== $WLAN_MESH_INTERFACE =="
> -	iw dev $WLAN_MESH_INTERFACE station dump 2>&1
> -	echo "== SCAN =="
> -	iwlist scanning 2>&1
> -	echo "=== WATCHDOG LOG ==="
> -	cat "/var/log/wlanwatchdog.log"
> -}
> -
> -get_time() {
> -	date +%s
> -}
> -
> -count_originators() {
> -	local COUNT=0
> -	if [ -n "$BATMAN_INTERFACE" ]; then
> -		COUNT=$(tail -n +3
> /sys/kernel/debug/batman_adv/$BATMAN_INTERFACE/originators 2> /dev/null | \
> -			grep "$1" | \
> -			grep -o "^\([0-9a-f]\{2\}:\?
\)\+[[:space:]]\+[0-9.]\+s[[:space:]]\+([
> 0-9]\+)" | \ -			cut -d\( -f2 | \
> -			cut -d\) -f1 | \
> -			tr -d " " | \
> -			awk -vlimit=$ORIGINATOR_QUALITY_MIN '$1>=limit{print $1}' | \
> -			wc -l)
> -	fi
> -	echo $COUNT
> -}
> -
> -count_clients() {
> -	local COUNT=0
> -	local NUMBER=
> -	if [ -n "$BRIDGE_INTERFACE" ] && [ -n "$WLAN_CLIENT_INTERFACE" ]; then
> -		NUMBER=$(brctl showstp $BRIDGE_INTERFACE 2> /dev/null | \
> -			grep -e "^$WLAN_CLIENT_INTERFACE " | \
> -			cut -d" " -f2 | \
> -			tr -d "()")
> -	fi
> -	if [ -n "$BRIDGE_INTERFACE" ] && [ -n "$NUMBER" ]; then
> -		COUNT=$(brctl showmacs "^$BRIDGE_INTERFACE " 2> /dev/null | \
> -			grep -o
> "^[[:space:]]*$NUMBER[[:space:]]\+\([0-9a-f]\{2\}:\?\)\+[[:space:]]\+no[[:s
> pace:]]\+[0-9]\+" | \ -				tr "\t" " " | \
> -				tr -s " " | \
> -				cut -d" " -f5 | \
> -				awk -vlimit=$CLIENT_AGE_MAX '$1<=limit{print $1}' | \
> -				wc -l)
> -	fi
> -	echo $COUNT
> -}
> -
> -count_neighbours() {
> -	count_originators "$WLAN_MESH_INTERFACE"
> -}
> -
> -scan_wlan() {
> -	#FIXME: if you can; is there an easier way to get the current frequency?
> -	#FIXME: this should reanimate the wlan driver; do passive and active
> scanning the job equally well? -	local FREQUENCY=$(iwlist
> $WLAN_MESH_INTERFACE frequency 2> /dev/null | \ -		grep -o "Current
> Frequency=[0-9.]\+ GHz" | \
> -		grep -o "[0-9.]*" | \
> -		tr -d ".")
> -	[ -n "$FREQUENCY" ] && iw $WLAN_MESH_INTERFACE scan freq $FREQUENCY
> passive 1> /dev/null 2> /dev/null -}
> -
> -fsm_load() {
> -	if [ -f "$STATEFILE" ]; then
> -		STATE=""
> -		SINCE=""
> -		. "$STATEFILE" || return 1
> -	fi
> -}
> -
> -fsm_save() {
> -	echo -e "STATE=${STATE}\nSINCE=${SINCE}" > "$STATEFILE" || return 1
> -}
> -
> -fsm_entry() {
> -	SINCE=$(get_time)
> -	case $STATE in
> -		pending)
> -			scan_wlan
> -		;;
> -		error)
> -			if [ -n "$DEBUG" ] && [ "$DEBUG" -eq "1" ]; then
> -				debug_output | gzip > ${DEBUGFILE}
> -			fi
> -			reboot
> -		;;
> -	esac
> -}
> -
> -fsm_transition() {
> -	local AGE=-1
> -	[ -n "$SINCE" ] && AGE=$(( $(get_time) - $SINCE ))
> -	local OLDSTATE=$STATE
> -	case $STATE in
> -		working)
> -			if [ "$(count_neighbours)" -eq "0" ] && [ "$(count_clients)" -
eq "0" ];
> then -				STATE=pending
> -			fi
> -		;;
> -		pending)
> -			if [ "$AGE" -ge "$TIMEOUT_MEDIUM" ]; then
> -				STATE=error
> -			elif [ "$(count_originators)" -eq "0" ] && [ "$AGE" -ge 
"$TIMEOUT_SHORT"
> ]; then -				STATE=error
> -			elif [ "$(count_neighbours)" -gt "0" ] || [ "$(count_clients)" 
-gt "0"
> ]; then -				STATE=working
> -			fi
> -		;;
> -		*)
> -			if [ "$AGE" -ge "$TIMEOUT_LONG" ]; then
> -				STATE=error
> -			elif [ "$(count_neighbours)" -gt "0" ] || [ "$(count_clients)" 
-gt "0"
> ]; then -				STATE=working
> -			fi
> -		;;
> -	esac
> -	if [ ! "$OLDSTATE" = "$STATE" ]; then
> -		echo "$(date) '$OLDSTATE' -> '$STATE'"
> -		fsm_entry
> -	fi
> -}
> -
> -# program
> -fsm_load
> -fsm_transition
> -fsm_save
> \ No newline at end of file



Mehr Informationen über die Mailingliste franken-dev