From: walter@svn.comics.unina.it
To: bismark-commits@lists.bufferbloat.net
Subject: [Bismark-commits] rev 334 - trunk/device/OpenWrt_common/etc trunk/device/OpenWrt_common/scripts
Date: Fri, 13 May 2011 15:44:21 +0200 [thread overview]
Message-ID: <E1QKsfF-0001PP-6E@svn.comics.unina.it> (raw)
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
reply other threads:[~2011-05-13 13:31 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=E1QKsfF-0001PP-6E@svn.comics.unina.it \
--to=walter@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