Historic archive of defunct list bismark-commits@lists.bufferbloat.net
 help / color / mirror / Atom feed
From: bismark@svn.comics.unina.it
To: bismark-commits@lists.bufferbloat.net
Subject: [Bismark-commits] rev 317 - trunk/device/OpenWrt_common trunk/device/OpenWrt_common/lib trunk/device/OpenWrt_common/scripts
Date: Wed, 13 Apr 2011 20:34:25 +0200	[thread overview]
Message-ID: <E1QA4tV-00006L-Ss@svn.comics.unina.it> (raw)

Author: bismark
Date: 2011-04-13 20:34:25 +0200 (Wed, 13 Apr 2011)
New Revision: 317

Added:
   trunk/device/OpenWrt_common/lib/
   trunk/device/OpenWrt_common/lib/functions.inc.sh
   trunk/device/OpenWrt_common/scripts/bismark-action
   trunk/device/OpenWrt_common/scripts/bismark-bootstrap
   trunk/device/OpenWrt_common/scripts/bismark-probe
   trunk/device/OpenWrt_common/scripts/bismark-rshell
Removed:
   trunk/device/OpenWrt_common/rc.local
   trunk/device/OpenWrt_common/scripts/action
   trunk/device/OpenWrt_common/scripts/functions
   trunk/device/OpenWrt_common/scripts/probe
   trunk/device/OpenWrt_common/scripts/rshell
   trunk/device/OpenWrt_common/scripts/startup
Log:
first steps towards new folder structure

Copied: trunk/device/OpenWrt_common/lib/functions.inc.sh (from rev 316, trunk/device/OpenWrt_common/scripts/functions)
===================================================================
--- trunk/device/OpenWrt_common/lib/functions.inc.sh	                        (rev 0)
+++ trunk/device/OpenWrt_common/lib/functions.inc.sh	2011-04-13 18:34:25 UTC (rev 317)
@@ -0,0 +1,147 @@
+#!/bin/bash
+# Ausiliary functions library
+#
+# author: walter.dedonato@unina.it
+
+# Generates integer random numbers
+# $1 = min value
+# $2 = max value
+random ()
+{
+	diff=$(( $2 - $1 ))
+	awk '{
+		srand($1*100);
+		print '$2' + int(rand()*'$diff');
+	}' /proc/uptime
+}
+
+# Modifies configuration files option
+# $1 = configuration file
+# $2 = option
+# $3 = value
+mod_conf ()
+{
+	if [ "$3" ]; then
+		# Modify value
+		sed -i -e "/^$2=/ s/=.*/=\"$3\"/" $1
+	else
+		# Remove option
+		sed -i -e "/^$2=/ d" $1
+	fi
+}
+
+# Log output destination
+# $1 = action
+output ()
+{
+        if [ $REMOTE ]; then
+                ( echo "$DEVICE_ID log $1 $(date +%s)" ; cat ) | nc -u $NC_OPTS $SERVER $PROBE_PORT
+        else
+                cat
+        fi
+}
+
+# Rename dump files
+rename_dump ()
+{
+	# Rename features dump files
+	( cd /tmp/measure/
+	  for file in $(find -name "*.dump"); do
+		mv $file ${DEVICE_ID}_${file:2}
+	  done
+	)
+}
+
+# Get public IP
+get_ip ()
+{
+	if [ -e /tmp/ip ] && [ $(grep -c '^[0-9]*\.[0-9]*\.[0-9]*\.[0-9]*$' /tmp/ip) -ge 1 ]; then
+		src=$(cat /tmp/ip)
+	else
+		src=$(ifconfig $WAN_IF | awk '/inet:/{ print substr($2,6) }')
+	fi
+}
+
+# Wifi output filter
+wifi_filter ()
+{
+        ( cd /tmp/measure/
+	  [ $PRIVACY_MODE ] && OPT="-v priv=on"
+          for file in $(find -name "*.csv" -a ! -name "*.filt.*"); do
+                gawk $OPT -F", |," -f /dev/stdin $file > ${file%.*}.filt.csv <<-end
+			function tstamp(d,ts){
+				cmd = "date -d \"" d "\" +%s"
+				cmd | getline ts
+				close(cmd)
+				return ts
+			}
+			function hash(n,h){
+				cmd = "echo " n " | md5sum"
+				cmd | getline h
+				close(cmd)
+				return substr(h,1,10)
+			}
+			/^BSSID/{ 
+				sec = 1
+				printf "%-18s %-11s %-11s %-2s %-5s %-8s %-10s %-4s %-5s %-7s %-7s %-5s %s\n",\
+				"BSSID", "First", "Last", "Ch", "Speed", "Privacy", "Cipher", "Auth", "Power", "Beacons", "IVs", "IDlen", "ESSID" 
+			}
+			/^Station/{ 
+				sec = 2
+				printf "%-18s %-11s %-11s %-5s %-7s %-18s %s\n",\
+				"Station MAC", "First", "Last", "Power", "Pkts", "BSSID", "ESSID" 
+			}
+			{ 
+				if (\$1 ~ /^..:/) {
+					# First MAC
+					if (priv == "on") \$1 = substr(\$1,1,8) ":00:00:00"
+					\$2 = tstamp(\$2)
+					\$3 = tstamp(\$3)
+					if (sec == 1) {
+						if (\$6 ~ /[A-Za-z0-9]+/) { gsub(/ /,"+",\$6); sub(/+$/,"",\$6) } else { \$6 = "-" }
+						if (\$7 ~ /[A-Za-z0-9]+/) { gsub(/ /,"+",\$7) } else { \$7 = "-" }
+						if (\$8 ~ /[A-Za-z0-9]+/) { gsub(/ /,"+",\$8) } else { \$8 = "-" }
+						if (\$14 ~ /[A-Za-z0-9]+/) { if (priv == "on") \$14 = hash(\$14) } else { \$14 = "-" }
+						printf "%-18s %-11u %-11u %-2u %-5d %-8s %-10s %-4s %-5d %-7u %-7u %-5u %s\n",\
+							\$1, \$2, \$3, \$4, \$5, \$6, \$7, \$8, \$9, \$10, \$11, \$13, \$14 
+					} else  if ( sec == 2 ) { 
+						if (\$6 ~ /^..:/) { if (priv == "on") \$6 = substr(\$6,1,8) ":00:00:00" } else { \$6 = "-" }
+						if (\$7 ~ /[a-zA-Z0-9]+/) { if (priv == "on") \$7 = hash(\$7) } else { \$7 = "-"}
+						printf "%-18s %-11u %-11u %-5d %-7d %-18s %s\n",\
+							\$1, \$2, \$3, \$4, \$5, \$6, \$7 
+					}
+				} 
+			}
+		end
+		rm $file
+          done
+        )
+}
+
+# T2 privacy filter
+t2_filter ()
+{
+        ( cd /tmp/measure/
+          for file in $(find -name "*.t2" -a ! -name "*.filt.*"); do
+                gawk -f /dev/stdin $file > ${file%.*}.filt.t2 <<-end
+			function anon(ip,d){
+				split(ip,d,".")
+				return d[1]"."d[2]"."d[3]".0" 
+			}
+			{ 
+				if (\$1 ~ /^[0-9]/) {
+					\$2 = anon(\$2)
+					\$3 = anon(\$3)
+					printf "%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\n",\
+						\$1, \$2, \$3, \$4, \$5, \$6, \$7, \$8, \$9, \$10, \$11, \$12, \$13, \$14, \$15
+				} else {
+					print
+				}
+			}
+		end
+		rm $file
+          done
+        )
+	
+}
+


Property changes on: trunk/device/OpenWrt_common/lib/functions.inc.sh
___________________________________________________________________
Name: svn:executable
   + *
Name: svn:mergeinfo
   + 

Deleted: trunk/device/OpenWrt_common/rc.local
===================================================================
--- trunk/device/OpenWrt_common/rc.local	2011-04-06 13:34:14 UTC (rev 316)
+++ trunk/device/OpenWrt_common/rc.local	2011-04-13 18:34:25 UTC (rev 317)
@@ -1,18 +0,0 @@
-# Bismark rc.local boot script
-#
-# author: walter.dedonato@unina.it
-
-export BISMARK_DIR="/tmp/bismark"
-export PLATFORM="$(uname -nm | tr ' ' '_')
-
-# Checkout latest version
-svn co --non-interactive "svn://143.215.131.215/$PLATFORM" $BISMARK_DIR
-
-# Startup configuration
-export PATH=$BISMARK_DIR/bin:$BISMARK_DIR/scripts:$PATH
-mkdir -p $BISMARK_DIR/var/data
-startup
-
-# Cronjobs setup
-cat /etc/crontabs/root $BISMARK_DIR/etc/crontab | crontab -
-

Deleted: trunk/device/OpenWrt_common/scripts/action
===================================================================
--- trunk/device/OpenWrt_common/scripts/action	2011-04-06 13:34:14 UTC (rev 316)
+++ trunk/device/OpenWrt_common/scripts/action	2011-04-13 18:34:25 UTC (rev 317)
@@ -1,95 +0,0 @@
-#!/bin/bash
-# Device actions script
-# Provides:
-# - on-demand SSH tunnel
-# - server heartbeat
-# - software update
-# - configuration query/push
-#
-# author: walter.dedonato@unina.it
-
-# Import configuration and functions
-. $BISMARK_DIR/etc/bismark.conf
-. $BISMARK_DIR/scripts/functions
-
-# Help screen
-[ $1 ] || { echo "$(basename $0) <command> [options]" ; exit ; }
-
-# Perform action
-case $1 in
-fwd)	# on-demand SSH tunnel
-	if [ $2 == ${2#*:} ]; then
-		# Default to local port 22 
-		( ssh $KEEP_ALIVE -N -i $SSH_KEY -R $2:127.0.0.1:22 $USER@$SERVER >/dev/null 2>&1 & )
-	else
-		# To custom IP:PORT destination
-		( ssh $KEEP_ALIVE -N -i $SSH_KEY -R $2 $USER@$SERVER >/dev/null 2>&1 & )
-	fi
-;;
-pong)	# Server heartbeat
-	ltime=$(date +%s)
-	stime=$(( $3 + 2 ))
-
-	# Check clock synch
-	[ $stime -gt $((ltime + 1)) ] && resync=true
-	[ $stime -lt $((ltime - 1)) ] && resync=true
-	if [ $resync ]; then
-		ltime=$stime
-		date -s @$ltime
-		hwclock -w
-	fi
-	echo $ltime > $BISMARK_DIR/var/server_last
-
-	# Store public IP 
-	echo $2 > $BISMARK_DIR/var/ip
-;;
-update)	# Software update
-
-	# Skip if same version
-	[ $2 ] && [ $VERSION -eq $2 ] && { echo "Device up to date" | output $1 ; exit ; }
-
-	# Start svn update
-	svn update $BISMARK_DIR | output $1
-
-	# Apply changes
-	crontab $BISMARK_DIR/etc/crontab
-
-	# Set restart flag
-	touch $BISMARK_DIR/var/restart
-;;
-config)
-	# Modify parameters	
-	if [ "$2" ]; then 
-		# Parse new configuration
-		IFS=$'&'
-		for param in $2; do
-			name=${param%=*}
-			value="${param#*=}"
-
-			# Check generic parameter validity
-			grep -q "^$name=" $BISMARK_DIR/etc/{bismark,local}.conf || { echo -e "Invalid option $name\n" >&2; continue ; }
-
-			# Assign new value to parameter
-			eval "$name=\"$value\""
-
-			if [ "$value" ]; then
-				# Store parameter 
-				if grep -q "^$name=" /tmp/local.conf; then
-					# Substitute
-					mod_conf /tmp/local.conf $name "$value"
-				else
-					# Append
-					echo $name="$value" >> /tmp/local.conf
-				fi
-			elif grep -q "^$name=" /tmp/local.conf; then
-				# Remove parameter from local.conf
-				mod_conf /tmp/local.conf $name
-			fi
-		done
-	fi
-
-	# Configuration output
-	set | awk -F'=' '(FNR==1){ f+=1 } /=/{ if (f == 1){a[$1]=1} else { if (a[$1] == 1) print $1 "=" $2} }' $BISMARK_DIR/etc/bismark.conf - | output $1
-;;
-esac
-

Copied: trunk/device/OpenWrt_common/scripts/bismark-action (from rev 316, trunk/device/OpenWrt_common/scripts/action)
===================================================================
--- trunk/device/OpenWrt_common/scripts/bismark-action	                        (rev 0)
+++ trunk/device/OpenWrt_common/scripts/bismark-action	2011-04-13 18:34:25 UTC (rev 317)
@@ -0,0 +1,81 @@
+#!/bin/ash
+# Device actions script
+# Provides:
+# - on-demand SSH tunnel
+# - server heartbeat
+# - software update
+# - configuration query/pull
+#
+# author: walter.dedonato@unina.it
+
+# Import configuration and functions
+. /etc/bismark/bismark.conf
+. /lib/bismark/functions.inc.sh
+
+# Help screen
+[ $1 ] || { echo "$(basename $0) <command> [options]" ; exit ; }
+
+# Perform the requested action
+case $1 in
+fwd)	# on-demand SSH tunnel
+	if [ $2 == ${2#*:} ]; then
+		# Default to local port 22 
+		( ssh $KEEP_ALIVE -N -i $SSH_KEY -R $2:127.0.0.1:22 $USER@$SERVER >/dev/null 2>&1 & )
+	else
+		# To custom IP:PORT destination
+		( ssh $KEEP_ALIVE -N -i $SSH_KEY -R $2 $USER@$SERVER >/dev/null 2>&1 & )
+	fi
+;;
+pong)	# Server heartbeat
+	ltime=$(date +%s)
+	stime=$(( $3 + 2 ))
+
+	# Check clock synch
+	[ $stime -gt $((ltime + 1)) ] && resync=true
+	[ $stime -lt $((ltime - 1)) ] && resync=true
+	if [ $resync ]; then
+		ltime=$stime
+		date -s @$ltime
+		hwclock -w
+	fi
+	echo $ltime > /tmp/bismark/var/server_last
+
+	# Store public IP 
+	echo $2 > /tmp/bismark/var/ip
+;;
+config)
+	# Modify parameters	
+	if [ "$2" ]; then 
+		# Parse new configuration
+		IFS=$'&'
+		for param in $2; do
+			name=${param%=*}
+			value="${param#*=}"
+
+			# Check generic parameter validity
+			grep -q "^$name=" /etc/bismark/{bismark,local}.conf || { echo -e "Invalid option $name\n" >&2; continue ; }
+
+			# Assign new value to parameter
+			eval "$name=\"$value\""
+
+			if [ "$value" ]; then
+				# Store parameter 
+				if grep -q "^$name=" /tmp/local.conf; then
+					# Substitute
+					mod_conf /tmp/local.conf $name "$value"
+				else
+					# Append
+					echo $name="$value" >> /tmp/local.conf
+				fi
+			elif grep -q "^$name=" /tmp/local.conf; then
+				# Remove parameter from local.conf
+				mod_conf /tmp/local.conf $name
+			fi
+		done
+	fi
+
+	# Configuration output
+	set | awk -F'=' '(FNR==1){ f+=1 } /=/{ if (f == 1){a[$1]=1} else { if (a[$1] == 1) print $1 "=" $2} }' /etc/bismark/bismark.conf - | output $1
+;;
+esac
+


Property changes on: trunk/device/OpenWrt_common/scripts/bismark-action
___________________________________________________________________
Name: svn:executable
   + *
Name: svn:mergeinfo
   + 

Copied: trunk/device/OpenWrt_common/scripts/bismark-bootstrap (from rev 316, trunk/device/OpenWrt_common/rc.local)
===================================================================
--- trunk/device/OpenWrt_common/scripts/bismark-bootstrap	                        (rev 0)
+++ trunk/device/OpenWrt_common/scripts/bismark-bootstrap	2011-04-13 18:34:25 UTC (rev 317)
@@ -0,0 +1,21 @@
+#!/bin/ash
+# Device startup script
+#
+# author walter.dedonato@unina.it
+
+# Load configuration
+. /etc/bismark/bismark.conf
+
+# Create temporary tree
+mkdir -p /tmp/bismark/{var,data}
+
+# Pull device specific configuration from the server
+#action config pull
+
+# Set boot event and start modem monitor
+# bismark-event boot
+# bismark-event modem
+
+# Cronjobs setup
+cat /etc/crontabs/root /etc/bismark/crontab | crontab -
+

Copied: trunk/device/OpenWrt_common/scripts/bismark-probe (from rev 316, trunk/device/OpenWrt_common/scripts/probe)
===================================================================
--- trunk/device/OpenWrt_common/scripts/bismark-probe	                        (rev 0)
+++ trunk/device/OpenWrt_common/scripts/bismark-probe	2011-04-13 18:34:25 UTC (rev 317)
@@ -0,0 +1,59 @@
+#!/bin/ash
+# Send UDP probes to Bismark server and
+# call action script depending on the answer
+# Provides:
+# - device heartbeat
+# - UDP proxy fallback
+#
+# author: walter.dedonato@unina.it
+
+# Load configuration file
+. /etc/bismark/bismark.conf
+. /lib/bismark/functions.inc.sh
+
+# Local config
+MAX_SLEEP=30
+
+# Probe message generator
+msg () {
+	echo "$DEVICE_ID ping $VERSION"
+	sleep 1
+	return 0
+}
+
+# Create status files
+[ -e /tmp/bismark/var/faults ] || echo 0 > /tmp/bismark/var/faults
+[ -e /tmp/bismark/var/proxy ] || echo 0 > /tmp/bismark/var/proxy
+
+# Check faults count
+faults=$(cat /tmp/bismark/var/faults)
+if [ $faults -ge 20 ]; then
+	proxy=$(cat /tmp/bismark/var/proxy)
+	echo $(( (proxy + 1) % 2 )) > /tmp/bismark/var/proxy
+	echo 0 > /tmp/bismark/var/faults
+	faults=0
+fi
+
+# Random delay wait
+sleep $(random 0 $MAX_SLEEP)
+
+# Send probe and store reply
+if [ $(cat /tmp/bismark/var/proxy) -eq 1 ]; then
+	msg | nc -u $NC_OPTS $PROXY $PROXY_PORT > /tmp/bismark/var/reply
+else
+	msg | nc -u $NC_OPTS $SERVER $PROBE_PORT > /tmp/bismark/var/reply
+fi
+
+# Refresh faults count
+if [ "`cat /tmp/bismark/var/reply`" ]; then
+	echo 0 > /tmp/faults
+	#event uplink up
+else
+	echo $((++faults)) > /tmp/faults
+	#event uplink down
+fi
+
+# Parse reply
+read cmd value < /tmp/bismark/var/reply
+[ $cmd ] && REMOTE=on action $cmd $value
+


Property changes on: trunk/device/OpenWrt_common/scripts/bismark-probe
___________________________________________________________________
Name: svn:executable
   + *
Name: svn:mergeinfo
   + 

Copied: trunk/device/OpenWrt_common/scripts/bismark-rshell (from rev 316, trunk/device/OpenWrt_common/scripts/rshell)
===================================================================
--- trunk/device/OpenWrt_common/scripts/bismark-rshell	                        (rev 0)
+++ trunk/device/OpenWrt_common/scripts/bismark-rshell	2011-04-13 18:34:25 UTC (rev 317)
@@ -0,0 +1,30 @@
+#!/bin/ash
+# Starts a recovery shell if unable to probe the server 
+#
+# author: walter.dedonato@unina.it
+
+# Load configuration file
+. /etc/bismark/bismark.conf
+. /lib/bismark/functions.inc.sh
+
+# Local config
+BASE_PORT=5000
+MAX_PORT=50000
+
+[ -e /tmp/bismark/var/server_last ] || echo `date +%s` > /tmp/bismark/var/server_last
+
+# Start new tunnel if last timestamp is more than 5 minutes old
+if [ $((`date +%s` - `cat /tmp/bismark/var/server_last`)) -gt 300 ]; then
+	if [ -e /tmp/tunnel ]; then
+		# Check pre-existing recovery tunnel
+		pid=$(cat /tmp/bismark/var/tunnel)
+		ps $pid >/dev/null || rm /tmp/bismark/var/tunnel
+	else
+		# Create new recovery tunnel
+		port=$(random $BASE_PORT $MAX_PORT)
+		#ssh -i $SSH_KEY $USER@$SERVER "bin/bdm settunnel $DEVICE_ID $port"
+		( ssh $KEEP_ALIVE -N -i $SSH_KEY -R $port:127.0.0.1:22 $USER@$SERVER >/dev/null 2>&1 & )
+		echo $! > /tmp/bismark/var/tunnel
+	fi
+fi
+


Property changes on: trunk/device/OpenWrt_common/scripts/bismark-rshell
___________________________________________________________________
Name: svn:executable
   + *
Name: svn:mergeinfo
   + 

Deleted: trunk/device/OpenWrt_common/scripts/functions
===================================================================
--- trunk/device/OpenWrt_common/scripts/functions	2011-04-06 13:34:14 UTC (rev 316)
+++ trunk/device/OpenWrt_common/scripts/functions	2011-04-13 18:34:25 UTC (rev 317)
@@ -1,135 +0,0 @@
-#!/bin/bash
-# Ausiliary functions library
-#
-# author: walter.dedonato@unina.it
-
-# Modifies configuration files option
-# $1 = configuration file
-# $2 = option
-# $3 = value
-mod_conf ()
-{
-	if [ "$3" ]; then
-		# Modify value
-		sed -i -e "/^$2=/ s/=.*/=\"$3\"/" $1
-	else
-		# Remove option
-		sed -i -e "/^$2=/ d" $1
-	fi
-}
-
-# Log output destination
-# $1 = action
-output ()
-{
-        if [ $REMOTE ]; then
-                ( echo "$DEVICE_ID log $1 $(date +%s)" ; cat ) | nc -u $NC_OPTS $SERVER $PROBE_PORT
-        else
-                cat
-        fi
-}
-
-# Rename dump files
-rename_dump ()
-{
-	# Rename features dump files
-	( cd /tmp/measure/
-	  for file in $(find -name "*.dump"); do
-		mv $file ${DEVICE_ID}_${file:2}
-	  done
-	)
-}
-
-# Get public IP
-get_ip ()
-{
-	if [ -e /tmp/ip ] && [ $(grep -c '^[0-9]*\.[0-9]*\.[0-9]*\.[0-9]*$' /tmp/ip) -ge 1 ]; then
-		src=$(cat /tmp/ip)
-	else
-		src=$(ifconfig $WAN_IF | awk '/inet:/{ print substr($2,6) }')
-	fi
-}
-
-# Wifi output filter
-wifi_filter ()
-{
-        ( cd /tmp/measure/
-	  [ $PRIVACY_MODE ] && OPT="-v priv=on"
-          for file in $(find -name "*.csv" -a ! -name "*.filt.*"); do
-                gawk $OPT -F", |," -f /dev/stdin $file > ${file%.*}.filt.csv <<-end
-			function tstamp(d,ts){
-				cmd = "date -d \"" d "\" +%s"
-				cmd | getline ts
-				close(cmd)
-				return ts
-			}
-			function hash(n,h){
-				cmd = "echo " n " | md5sum"
-				cmd | getline h
-				close(cmd)
-				return substr(h,1,10)
-			}
-			/^BSSID/{ 
-				sec = 1
-				printf "%-18s %-11s %-11s %-2s %-5s %-8s %-10s %-4s %-5s %-7s %-7s %-5s %s\n",\
-				"BSSID", "First", "Last", "Ch", "Speed", "Privacy", "Cipher", "Auth", "Power", "Beacons", "IVs", "IDlen", "ESSID" 
-			}
-			/^Station/{ 
-				sec = 2
-				printf "%-18s %-11s %-11s %-5s %-7s %-18s %s\n",\
-				"Station MAC", "First", "Last", "Power", "Pkts", "BSSID", "ESSID" 
-			}
-			{ 
-				if (\$1 ~ /^..:/) {
-					# First MAC
-					if (priv == "on") \$1 = substr(\$1,1,8) ":00:00:00"
-					\$2 = tstamp(\$2)
-					\$3 = tstamp(\$3)
-					if (sec == 1) {
-						if (\$6 ~ /[A-Za-z0-9]+/) { gsub(/ /,"+",\$6); sub(/+$/,"",\$6) } else { \$6 = "-" }
-						if (\$7 ~ /[A-Za-z0-9]+/) { gsub(/ /,"+",\$7) } else { \$7 = "-" }
-						if (\$8 ~ /[A-Za-z0-9]+/) { gsub(/ /,"+",\$8) } else { \$8 = "-" }
-						if (\$14 ~ /[A-Za-z0-9]+/) { if (priv == "on") \$14 = hash(\$14) } else { \$14 = "-" }
-						printf "%-18s %-11u %-11u %-2u %-5d %-8s %-10s %-4s %-5d %-7u %-7u %-5u %s\n",\
-							\$1, \$2, \$3, \$4, \$5, \$6, \$7, \$8, \$9, \$10, \$11, \$13, \$14 
-					} else  if ( sec == 2 ) { 
-						if (\$6 ~ /^..:/) { if (priv == "on") \$6 = substr(\$6,1,8) ":00:00:00" } else { \$6 = "-" }
-						if (\$7 ~ /[a-zA-Z0-9]+/) { if (priv == "on") \$7 = hash(\$7) } else { \$7 = "-"}
-						printf "%-18s %-11u %-11u %-5d %-7d %-18s %s\n",\
-							\$1, \$2, \$3, \$4, \$5, \$6, \$7 
-					}
-				} 
-			}
-		end
-		rm $file
-          done
-        )
-}
-
-# T2 privacy filter
-t2_filter ()
-{
-        ( cd /tmp/measure/
-          for file in $(find -name "*.t2" -a ! -name "*.filt.*"); do
-                gawk -f /dev/stdin $file > ${file%.*}.filt.t2 <<-end
-			function anon(ip,d){
-				split(ip,d,".")
-				return d[1]"."d[2]"."d[3]".0" 
-			}
-			{ 
-				if (\$1 ~ /^[0-9]/) {
-					\$2 = anon(\$2)
-					\$3 = anon(\$3)
-					printf "%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\n",\
-						\$1, \$2, \$3, \$4, \$5, \$6, \$7, \$8, \$9, \$10, \$11, \$12, \$13, \$14, \$15
-				} else {
-					print
-				}
-			}
-		end
-		rm $file
-          done
-        )
-	
-}
-

Deleted: trunk/device/OpenWrt_common/scripts/probe
===================================================================
--- trunk/device/OpenWrt_common/scripts/probe	2011-04-06 13:34:14 UTC (rev 316)
+++ trunk/device/OpenWrt_common/scripts/probe	2011-04-13 18:34:25 UTC (rev 317)
@@ -1,56 +0,0 @@
-#!/bin/bash
-# Send UDP probes to Bismark server and
-# call action script depending on the answer
-# Provides:
-# - device heartbeat
-# - UDP proxy fallback
-# - startup script during boot
-#
-# author: walter.dedonato@unina.it
-
-# Load configuration file
-. $BISMARK_DIR/etc/bismark.conf
-
-# Probe message generator
-msg () {
-	echo "$DEVICE_ID ping $VERSION"
-	sleep 1
-	return 0
-}
-
-# Create status files
-[ -e $BISMARK_DIR/var/faults ] || echo 0 > $BISMARK_DIR/var/faults
-[ -e $BISMARK_DIR/var/proxy ] || echo 0 > $BISMARK_DIR/var/proxy
-
-# Check faults count
-faults=$(cat $BISMARK_DIR/var/faults)
-if [ $faults -ge 20 ]; then
-	proxy=$(cat /tmp/proxy)
-	echo $(( (proxy + 1) % 2 )) > $BISMARK_DIR/var/proxy
-	echo 0 > $BISMARK_DIR/var/faults
-	faults=0
-fi
-
-# Random wait
-sleep $((RANDOM % 30))
-
-# Send probe and store reply
-if [ $(cat $BISMARK_DIR/var/proxy) -eq 1 ]; then
-	msg | nc -u $NC_OPTS $PROXY $PROXY_PORT > $BISMARK_DIR/var/reply
-else
-	msg | nc -u $NC_OPTS $SERVER $PROBE_PORT > $BISMARK_DIR/var/reply
-fi
-
-# Refresh faults count
-if [ "`cat /tmp/reply`" ]; then
-	echo 0 > /tmp/faults
-	event uplink up
-else
-	echo $((++faults)) > /tmp/faults
-	event uplink down
-fi
-
-# Parse reply
-read cmd value < /tmp/reply
-[ $cmd ] && REMOTE=on action $cmd $value
-

Deleted: trunk/device/OpenWrt_common/scripts/rshell
===================================================================
--- trunk/device/OpenWrt_common/scripts/rshell	2011-04-06 13:34:14 UTC (rev 316)
+++ trunk/device/OpenWrt_common/scripts/rshell	2011-04-13 18:34:25 UTC (rev 317)
@@ -1,26 +0,0 @@
-#!/bin/bash
-# Starts a recovery shell if unable to probe the server 
-#
-# author: walter.dedonato@unina.it
-
-# Load configuration file
-. ~/conf/dev.conf
-
-[ -e /tmp/server_last ] || echo `date +%s` > /tmp/server_last
-
-# Start new tunnel if last timestamp is more than 5 minutes old
-if [ $((`date +%s` - `cat /tmp/server_last`)) -gt 300 ]; then
-	if [ -e /tmp/tunnel ]; then
-		# Check pre-existing recovery tunnel
-		pid=$(cat /tmp/tunnel)
-		ps $pid >/dev/null || rm /tmp/tunnel
-	else
-		# Create new recovery tunnel
-		RANDOM=$(( `date +%s` % 32767 ))
-		port=$(( RANDOM % 5000 + 5000 ))
-		ssh -i $SSH_KEY $USER@$SERVER "bin/bdm settunnel $DEVICE_ID $port"
-		( ssh $KEEP_ALIVE -N -i $SSH_KEY -R $port:127.0.0.1:22 $USER@$SERVER >/dev/null 2>&1 & )
-		echo $! > /tmp/tunnel
-	fi
-fi
-

Deleted: trunk/device/OpenWrt_common/scripts/startup
===================================================================
--- trunk/device/OpenWrt_common/scripts/startup	2011-04-06 13:34:14 UTC (rev 316)
+++ trunk/device/OpenWrt_common/scripts/startup	2011-04-13 18:34:25 UTC (rev 317)
@@ -1,47 +0,0 @@
-#!/bin/bash
-# Device startup script
-#
-# author walter.dedonato@unina.it
-
-# Load configuration
-. ~/conf/dev.conf
-
-case $DEVICE_ID in
-NB*)
-	# Configure wireless interface 
-	action config push
-
-	# Set TCP core parameters
-	ifconfig eth0 txqueuelen 5000
-	ifconfig eth0 mtu 1500
-	sysctl net.ipv4.tcp_congestion_control=reno
-	sysctl net.core.rmem_max=8388608
-	sysctl net.core.wmem_max=8388608
-	sysctl net.ipv4.tcp_rmem="4096 65536 8388608"
-	sysctl net.ipv4.tcp_wmem="4096 65536 8388608"
-
-	# Setup dhcp log script
-	if ! grep -q ^dhcp-script= /etc/dnsmasq.conf ; then
-		echo "dhcp-script=/root/scripts/bdhcp" >> /etc/dnsmasq.conf
-		/etc/init.d/dnsmasq restart
-	fi
-
-	# Set local time
-	ln -fs /usr/share/zoneinfo/$LOCALTIME /etc/localtime
-
-	# Set boot event and start modem monitor
-	event boot
-	event modem
-
-	# Start web interface
-	pyweb start
-;;
-LS*)
-	# Create bin and lib directories on ramdisk
-	mkdir -p /tmp/bin /tmp/lib
-	ln -fs /tmp/bin bin
-	ln -fs /tmp/lib lib
-	sleep 10
-	[ -d /tmp/measure ] || action update
-;;
-esac


                 reply	other threads:[~2011-04-13 18:30 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=E1QA4tV-00006L-Ss@svn.comics.unina.it \
    --to=bismark@svn.comics.unina.it \
    --cc=bismark-commits@lists.bufferbloat.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox