Historic archive of defunct list bismark-commits@lists.bufferbloat.net
 help / color / mirror / Atom feed
* [Bismark-commits] rev 334 - trunk/device/OpenWrt_common/etc trunk/device/OpenWrt_common/scripts
@ 2011-05-13 13:44 walter
  0 siblings, 0 replies; only message in thread
From: walter @ 2011-05-13 13:44 UTC (permalink / raw)
  To: bismark-commits

Author: walter
Date: 2011-05-13 15:44:21 +0200 (Fri, 13 May 2011)
New Revision: 334

Modified:
   trunk/device/OpenWrt_common/etc/bismark.conf
   trunk/device/OpenWrt_common/scripts/bismark-probe
   trunk/device/OpenWrt_common/scripts/bismark-rshell
Log:
recovery tunnel management fixed
added round-robin multi-port probing

Modified: trunk/device/OpenWrt_common/etc/bismark.conf
===================================================================
--- trunk/device/OpenWrt_common/etc/bismark.conf	2011-05-13 13:33:46 UTC (rev 333)
+++ trunk/device/OpenWrt_common/etc/bismark.conf	2011-05-13 13:44:21 UTC (rev 334)
@@ -7,7 +7,7 @@
 SERVER=143.215.131.215
 USER=bismark
 SSH_KEY=/etc/bismark/bismark_key
-PROBE_PORT=53
+PROBE_PORTS="53 1028 1234 5353 54321"
 LOCALTIME=America/New_York
 
 # Bismark Proxy Server

Modified: trunk/device/OpenWrt_common/scripts/bismark-probe
===================================================================
--- trunk/device/OpenWrt_common/scripts/bismark-probe	2011-05-13 13:33:46 UTC (rev 333)
+++ trunk/device/OpenWrt_common/scripts/bismark-probe	2011-05-13 13:44:21 UTC (rev 334)
@@ -24,11 +24,12 @@
 # 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
+[ -e /tmp/bismark/var/port_counter ] || echo 0 > /tmp/bismark/var/port_counter
 
 # Check faults count
-faults=$(cat /tmp/bismark/var/faults)
+read faults < /tmp/bismark/var/faults
 if [ $faults -ge 20 ]; then
-	proxy=$(cat /tmp/bismark/var/proxy)
+	read proxy < /tmp/bismark/var/proxy
 	echo $(( (proxy + 1) % 2 )) > /tmp/bismark/var/proxy
 	echo 0 > /tmp/bismark/var/faults
 	faults=0
@@ -37,6 +38,10 @@
 # Random delay wait
 sleep $(random 0 $MAX_SLEEP)
 
+# Select probe port
+read port_counter < /tmp/bismark/var/port_counter
+PROBE_PORT=$(echo $PROBE_PORTS | awk '{print $'$((port_counter + 1))'}')
+
 # 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
@@ -44,12 +49,18 @@
 	msg | nc -u $NC_OPTS $SERVER $PROBE_PORT > /tmp/bismark/var/reply
 fi
 
-# Refresh faults count
+# Faults control 
 if [ "`cat /tmp/bismark/var/reply`" ]; then
-	echo 0 > /tmp/faults
+	# Reset faults count
+	echo 0 > /tmp/bismark/var/faults
 	#event uplink up
 else
-	echo $((++faults)) > /tmp/faults
+	# Update faults count
+	echo $((++faults)) > /tmp/bismark/var/faults
+
+	# Cycle server port
+	ports=$(echo $PROBE_PORTS | awk '{print NF}')
+	echo $(( (port_counter + 1) % ports )) > /tmp/bismark/var/port_counter
 	#event uplink down
 fi
 

Modified: trunk/device/OpenWrt_common/scripts/bismark-rshell
===================================================================
--- trunk/device/OpenWrt_common/scripts/bismark-rshell	2011-05-13 13:33:46 UTC (rev 333)
+++ trunk/device/OpenWrt_common/scripts/bismark-rshell	2011-05-13 13:44:21 UTC (rev 334)
@@ -15,15 +15,16 @@
 
 # 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
+	if [ -e /tmp/bismark/var/tunnel ]; then
 		# Check pre-existing recovery tunnel
-		pid=$(cat /tmp/bismark/var/tunnel)
+		read pid < /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 & )
+		sleep 2
+		ssh -i $SSH_KEY $USER@$SERVER "bin/bdm updatetunnels"
 		echo $! > /tmp/bismark/var/tunnel
 	fi
 fi


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2011-05-13 13:31 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-13 13:44 [Bismark-commits] rev 334 - trunk/device/OpenWrt_common/etc trunk/device/OpenWrt_common/scripts walter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox