From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-23-ewr.dyndns.com (mxout-113-ewr.mailhop.org [216.146.33.113]) by lists.bufferbloat.net (Postfix) with ESMTP id 28FA12E03C2 for ; Thu, 14 Apr 2011 17:34:57 -0700 (PDT) Received: from scan-21-ewr.mailhop.org (scan-21-ewr.local [10.0.141.243]) by mail-23-ewr.dyndns.com (Postfix) with ESMTP id 3D1D73FD8C for ; Thu, 14 Apr 2011 15:06:13 +0000 (UTC) X-Spam-Score: 0.1 () X-Mail-Handler: MailHop by DynDNS X-Originating-IP: 143.225.229.147 Received: from svn.comics.unina.it (unknown [143.225.229.147]) by mail-23-ewr.dyndns.com (Postfix) with ESMTP id 77A9B3F85C for ; Thu, 14 Apr 2011 15:06:08 +0000 (UTC) Received: from www-data by svn.comics.unina.it with local (Exim 4.69) (envelope-from ) id 1QAOAz-0001E9-De for bismark-commits@lists.bufferbloat.net; Thu, 14 Apr 2011 17:09:45 +0200 To: bismark-commits@lists.bufferbloat.net From: walter@svn.comics.unina.it Message-Id: Date: Thu, 14 Apr 2011 17:09:45 +0200 X-Mailman-Approved-At: Thu, 14 Apr 2011 21:25:17 -0700 Subject: [Bismark-commits] rev 318 - trunk/device/OpenWrt_common/etc trunk/device/OpenWrt_common/keys trunk/device/OpenWrt_common/lib trunk/device/OpenWrt_common/scripts trunk/device/OpenWrt_i586 X-BeenThere: bismark-commits@lists.bufferbloat.net X-Mailman-Version: 2.1.13 Precedence: list List-Id: Commit log for the bismark source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Apr 2011 00:34:58 -0000 Author: walter Date: 2011-04-14 17:09:45 +0200 (Thu, 14 Apr 2011) New Revision: 318 Added: trunk/device/OpenWrt_common/keys/bismark_key trunk/device/OpenWrt_common/keys/bismark_key.pub trunk/device/OpenWrt_common/lib/gd.list trunk/device/OpenWrt_common/lib/hosts.list trunk/device/OpenWrt_common/scripts/bismark-ditg trunk/device/OpenWrt_common/scripts/bismark-dns trunk/device/OpenWrt_common/scripts/bismark-measure-active trunk/device/OpenWrt_common/scripts/bismark-mstats trunk/device/OpenWrt_common/scripts/bismark-netperf trunk/device/OpenWrt_common/scripts/bismark-netperf-thread trunk/device/OpenWrt_common/scripts/bismark-ping trunk/device/OpenWrt_common/scripts/bismark-rtr trunk/device/OpenWrt_common/scripts/bismark-scp trunk/device/OpenWrt_common/scripts/bismark-sp trunk/device/OpenWrt_common/scripts/bismark-tr Removed: trunk/device/OpenWrt_common/etc/gd.list trunk/device/OpenWrt_common/etc/hosts.list trunk/device/OpenWrt_common/keys/bismark trunk/device/OpenWrt_common/keys/bismark.pub trunk/device/OpenWrt_common/scripts/bditg trunk/device/OpenWrt_common/scripts/bdns trunk/device/OpenWrt_common/scripts/bping trunk/device/OpenWrt_common/scripts/brtr trunk/device/OpenWrt_common/scripts/bscp trunk/device/OpenWrt_common/scripts/bsp trunk/device/OpenWrt_common/scripts/btr trunk/device/OpenWrt_common/scripts/measure trunk/device/OpenWrt_common/scripts/mstats trunk/device/OpenWrt_i586/rc.local Modified: trunk/device/OpenWrt_common/etc/bismark.conf trunk/device/OpenWrt_common/etc/crontab trunk/device/OpenWrt_common/lib/functions.inc.sh trunk/device/OpenWrt_common/scripts/bismark-bootstrap Log: imported srikanth modifications Modified: trunk/device/OpenWrt_common/etc/bismark.conf =================================================================== --- trunk/device/OpenWrt_common/etc/bismark.conf 2011-04-13 18:34:25 UTC (rev 317) +++ trunk/device/OpenWrt_common/etc/bismark.conf 2011-04-14 15:09:45 UTC (rev 318) @@ -3,17 +3,10 @@ # Here are defined the default values shared among all the devices # Local modifications can be applied overriding variables in local.conf -# Main folder -BISMARK_DIR=/tmp/bismark - -# Environment -PATH=$BISMARK_DIR/bin:$BISMARK_DIR/scripts:/bin:/sbin:/usr/bin:/usr/sbin -export LD_LIBRARY_PATH=$BISMARK_DIR/lib - # Bismark Central Server SERVER=143.215.131.215 USER=bismark -SSH_KEY=$BISMARK_DIR/keys/bismark +SSH_KEY=/etc/bismark/bismark_key PROBE_PORT=53 LOCALTIME=America/New_York @@ -22,7 +15,7 @@ PROXY_PORT=123 # Device info -DEVICE_ID=$(cat ~/ID) +DEVICE_ID=$(cat /etc/bismark/ID) PLATFORM=$(uname -nm | tr ' ' '_') VERSION=$(svn info $BISMARK_DIR | awk '/^Rev/{ print $2 }') ZONE=NorthAm @@ -36,10 +29,6 @@ PASSIVE_MACS=off # ARP based IP-MAC history PASSIVE_WIFI=off # Airodump-based wifi dump -# Internet access info -DW_KBPS= -UP_KBPS= - # Measurement frequencies (n*5 minutes) TR_FQ=6 BR_FQ=6 @@ -65,7 +54,7 @@ UDP_PPS=10 # Include device specific customizations -[ -e $BISMARK_DIR/etc/local.conf ] && . $BISMARK_DIR/etc/local.conf +[ -e /tmp/bismark/local.conf ] && . /tmp/bismark/local.conf # Immutable options NC_OPTS="-nc" Modified: trunk/device/OpenWrt_common/etc/crontab =================================================================== --- trunk/device/OpenWrt_common/etc/crontab 2011-04-13 18:34:25 UTC (rev 317) +++ trunk/device/OpenWrt_common/etc/crontab 2011-04-14 15:09:45 UTC (rev 318) @@ -1,6 +1,3 @@ -SHELL=/bin/bash -BISMARK_DIR="/tmp/bismark" - -*/1 * * * * $BISMARK_DIR/scripts/probe -*/5 * * * * $BISMARK_DIR/scripts/rshell -#*/5 * * * * ~/scripts/measure +*/1 * * * * /usr/bin/bismark-probe +*/5 * * * * /usr/bin/bismark-rshell +#*/5 * * * * ~/scripts/bismark-measure-active Deleted: trunk/device/OpenWrt_common/etc/gd.list =================================================================== --- trunk/device/OpenWrt_common/etc/gd.list 2011-04-13 18:34:25 UTC (rev 317) +++ trunk/device/OpenWrt_common/etc/gd.list 2011-04-14 15:09:45 UTC (rev 318) @@ -1,4 +0,0 @@ -# California -128.48.110.150 -# Italy -143.225.229.254 Deleted: trunk/device/OpenWrt_common/etc/hosts.list =================================================================== --- trunk/device/OpenWrt_common/etc/hosts.list 2011-04-13 18:34:25 UTC (rev 317) +++ trunk/device/OpenWrt_common/etc/hosts.list 2011-04-14 15:09:45 UTC (rev 318) @@ -1,10 +0,0 @@ -www.google.com -www.facebook.com -www.youtube.com -www.yahoo.com -www.live.com -www.wikipedia.org -www.blogger.com -www.msn.com -www.twitter.com -www.amazon.com Deleted: trunk/device/OpenWrt_common/keys/bismark =================================================================== (Binary files differ) Deleted: trunk/device/OpenWrt_common/keys/bismark.pub =================================================================== --- trunk/device/OpenWrt_common/keys/bismark.pub 2011-04-13 18:34:25 UTC (rev 317) +++ trunk/device/OpenWrt_common/keys/bismark.pub 2011-04-14 15:09:45 UTC (rev 318) @@ -1 +0,0 @@ -ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAgwCOk/RAmZsX6q/KFtEM4+8fz7KK1BxKERH8ehX3nZVO+pSyyGPRwOuTs7V/TgHoXLAqBiVrS+GKSrkTAydXftSHE2cZcHZQWQEmHAbArEMCA8rgkLXDmT70Ee4xelA1CLmC8o7fHv40D30Fi2LMAWYZLl0HWiN7fbboYJ3Wm4E+WJYF box@bismark Copied: trunk/device/OpenWrt_common/keys/bismark_key (from rev 317, trunk/device/OpenWrt_common/keys/bismark) =================================================================== (Binary files differ) Copied: trunk/device/OpenWrt_common/keys/bismark_key.pub (from rev 317, trunk/device/OpenWrt_common/keys/bismark.pub) =================================================================== --- trunk/device/OpenWrt_common/keys/bismark_key.pub (rev 0) +++ trunk/device/OpenWrt_common/keys/bismark_key.pub 2011-04-14 15:09:45 UTC (rev 318) @@ -0,0 +1 @@ +ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAgwCOk/RAmZsX6q/KFtEM4+8fz7KK1BxKERH8ehX3nZVO+pSyyGPRwOuTs7V/TgHoXLAqBiVrS+GKSrkTAydXftSHE2cZcHZQWQEmHAbArEMCA8rgkLXDmT70Ee4xelA1CLmC8o7fHv40D30Fi2LMAWYZLl0HWiN7fbboYJ3Wm4E+WJYF box@bismark Modified: trunk/device/OpenWrt_common/lib/functions.inc.sh =================================================================== --- trunk/device/OpenWrt_common/lib/functions.inc.sh 2011-04-13 18:34:25 UTC (rev 317) +++ trunk/device/OpenWrt_common/lib/functions.inc.sh 2011-04-14 15:09:45 UTC (rev 318) @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/ash # Ausiliary functions library # # author: walter.dedonato@unina.it @@ -68,7 +68,7 @@ ( 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 + awk $OPT -F", |," -f /dev/stdin $file > ${file%.*}.filt.csv <<-end function tstamp(d,ts){ cmd = "date -d \"" d "\" +%s" cmd | getline ts @@ -123,7 +123,7 @@ { ( cd /tmp/measure/ for file in $(find -name "*.t2" -a ! -name "*.filt.*"); do - gawk -f /dev/stdin $file > ${file%.*}.filt.t2 <<-end + awk -f /dev/stdin $file > ${file%.*}.filt.t2 <<-end function anon(ip,d){ split(ip,d,".") return d[1]"."d[2]"."d[3]".0" Copied: trunk/device/OpenWrt_common/lib/gd.list (from rev 317, trunk/device/OpenWrt_common/etc/gd.list) =================================================================== --- trunk/device/OpenWrt_common/lib/gd.list (rev 0) +++ trunk/device/OpenWrt_common/lib/gd.list 2011-04-14 15:09:45 UTC (rev 318) @@ -0,0 +1,4 @@ +# California +128.48.110.150 +# Italy +143.225.229.254 Copied: trunk/device/OpenWrt_common/lib/hosts.list (from rev 317, trunk/device/OpenWrt_common/etc/hosts.list) =================================================================== --- trunk/device/OpenWrt_common/lib/hosts.list (rev 0) +++ trunk/device/OpenWrt_common/lib/hosts.list 2011-04-14 15:09:45 UTC (rev 318) @@ -0,0 +1,10 @@ +www.google.com +www.facebook.com +www.youtube.com +www.yahoo.com +www.live.com +www.wikipedia.org +www.blogger.com +www.msn.com +www.twitter.com +www.amazon.com Deleted: trunk/device/OpenWrt_common/scripts/bditg =================================================================== --- trunk/device/OpenWrt_common/scripts/bditg 2011-04-13 18:34:25 UTC (rev 317) +++ trunk/device/OpenWrt_common/scripts/bditg 2011-04-14 15:09:45 UTC (rev 318) @@ -1,99 +0,0 @@ -#!/bin/bash -# Bismark ditg wrapper (output in Kbps) -# -# author: walter.dedonato@unina.it - -# Load configuration file -. ~/conf/dev.conf -. ~/scripts/functions - -# Help screen -[ $6 ] || { - echo "usage: $(basename $0) tcp " - echo " $(basename $0) udp " - echo " $(basename $0) udpflood " - exit -} - -# AWK log filter -filter=' - /bitrate/{ out="bitrate.dat" ; next } - /jitter/{ out="jitter.dat" ; next } - /pktloss/{ out="packetloss.dat" ; next } - (out != ""){ print >> out } -' - -# Change path -cd /tmp -[ -e itgfifo ] || mkfifo itgfifo -get_ip -tstamp=$(date +%s) - -# Select protocol -case $1 in -tcp) - pkt_size=1460 - pkt_rate=$(( ((${6}000 / 8) / $pkt_size) + 1 )) - - # Select direction - case $4 in - up) - ITGSend -a $2 -rp 0 -T TCP -c $pkt_size -C $pkt_rate -t ${5}000 -x /tmp/${DEVICE_ID}_$tstamp.log >/dev/null 2>&1 - echo "log /tmp/${DEVICE_ID}_$tstamp.log" | nc -n $2 $3 | awk "$filter" - cat bitrate.dat | mstats BITRATE DITG $src $2 | grep -v nan - ;; - dw) - RANDOM=$(( `date +%s` % 32767 )) - port=$(( RANDOM % 5000 + 10000 )) - { echo "send -H -Ssp $port -rp 0 -T TCP -c $pkt_size -C $pkt_rate -t ${5}000" ; sleep 1 ; } | nc $NC_OPTS $2 $3 - ITGRecv -H $2 -Sp $port -l itgfifo 2>/dev/null | ITGDec itgfifo -b 1000 > /dev/null 2>&1 - awk '(NR > 1){ print $3 }' bitrate.dat | mstats BITRATE DITG $2 $src | grep -v nan - ;; - esac -;; -udp) - pkt_size=512 - pkt_rate=$6 - - # Select direction - case $4 in - up) - ITGSend -a $2 -rp 0 -T UDP -c $pkt_size -C $pkt_rate -t ${5}000 -x /tmp/${DEVICE_ID}_$tstamp.log >/dev/null 2>&1 - echo "log /tmp/${DEVICE_ID}_$tstamp.log" | nc -n $2 $3 | awk "$filter" - cat jitter.dat | mstats JITTER DITG $src $2 | grep -v nan - cat packetloss.dat | mstats PKTLOSS DITG $src $2 | grep -v nan - ;; - dw) - RANDOM=$(( `date +%s` % 32767 )) - port=$(( RANDOM % 5000 + 10000 )) - { echo "send -H -Ssp $port -rp 0 -T UDP -c $pkt_size -C $pkt_rate -t ${5}000" ; sleep 1 ; } | nc $NC_OPTS $2 $3 - ITGRecv -H $2 -Sp $port -l itgfifo 2>/dev/null | ITGDec itgfifo -p 1000 -j 1000 > /dev/null 2>&1 - awk '(NR > 1){ print $3 }' jitter.dat | mstats JITTER DITG $2 $src | grep -v nan - awk '(NR > 1){ print $3 }' packetloss.dat | mstats PKTLOSS DITG $2 $src | grep -v nan - ;; - esac -;; -udpflood) - pkt_size=1472 - pkt_rate=$(( ((${6}000 / 8) / $pkt_size) + 1 )) - - # Select direction - case $4 in - up) - ITGSend -a $2 -rp 0 -T UDP -c $pkt_size -C $pkt_rate -t ${5}000 -x /tmp/${DEVICE_ID}_$tstamp.log >/dev/null 2>&1 - echo "log /tmp/${DEVICE_ID}_$tstamp.log" | nc -n $2 $3 | awk "$filter" - cat bitrate.dat | mstats UDPBITRATE DITG $src $2 | grep -v nan - ;; - dw) - RANDOM=$(( `date +%s` % 32767 )) - port=$(( RANDOM % 5000 + 10000 )) - { echo "send -H -Ssp $port -rp 0 -T UDP -c $pkt_size -C $pkt_rate -t ${5}000" ; sleep 1 ; } | nc $NC_OPTS $2 $3 - ITGRecv -H $2 -Sp $port -l itgfifo 2>/dev/null | ITGDec itgfifo -b 1000 > /dev/null 2>&1 - awk '(NR > 1){ print $3 }' bitrate.dat | mstats UDPBITRATE DITG $2 $src | grep -v nan - ;; - esac -;; -esac - -rm -f bitrate.dat jitter.dat packetloss.dat - Deleted: trunk/device/OpenWrt_common/scripts/bdns =================================================================== --- trunk/device/OpenWrt_common/scripts/bdns 2011-04-13 18:34:25 UTC (rev 317) +++ trunk/device/OpenWrt_common/scripts/bdns 2011-04-14 15:09:45 UTC (rev 318) @@ -1,49 +0,0 @@ -#!/bin/bash -# Bismark dns wrapper -# -# author: walter.dedonato@unina.it - -# Load configuration files -. ~/conf/dev.conf -. ~/scripts/functions - -# Get IP and default DNS server -get_ip -[ -e /etc/resolv.conf ] && dds=$(awk '/^nameserver/{ print $2 ; exit }' /etc/resolv.conf) - -case $DEVICE_ID in -NB*|WS*) - # Cycle DNS servers (default and OpenDNS) - mkdir -p /tmp/host - for s in "$dds" "8.8.8.8"; do - - # Cycle cache no-cache - for m in NC C; do - # Cycle top 10 hosts list - fail=0 - count=0 - rm /tmp/host/delays - - IFS=$'\n' - for h in $(cat ~/conf/hosts.list); do - ~/bin/time -f %e --append -o /tmp/host/delays host $h $s >/dev/null || : $((fail++)) - : $((count++)) - done - - # Output - [ $s ] || s="127.0.0.1" - grep '^[0-9]' /tmp/host/delays | mstats DNSDELAY$m HOST $src $s - awk 'BEGIN{ print ('$fail'/'$count') * 100 }' | mstats DNSFAIL$m HOST $src $s - done - done -;; -LS*) - # Create named pipe - pipe=/tmp/dns.fifo - [ -e $pipe ] || mkfifo $pipe - - # Compute DNS delay (output to stderr) - mdns 2>$pipe | mstats DNSDELAY MDNS $src $dds >&2 | mstats DNSFAIL MDNS $src $dds <$pipe >&2 -;; -esac - Property changes on: trunk/device/OpenWrt_common/scripts/bismark-bootstrap ___________________________________________________________________ Name: svn:executable + * Added: trunk/device/OpenWrt_common/scripts/bismark-ditg =================================================================== --- trunk/device/OpenWrt_common/scripts/bismark-ditg (rev 0) +++ trunk/device/OpenWrt_common/scripts/bismark-ditg 2011-04-14 15:09:45 UTC (rev 318) @@ -0,0 +1,100 @@ +#!/bin/ash +# Bismark ditg wrapper (output in Kbps) +# +# author: walter.dedonato@unina.it + +# Load configuration file +. /etc/bismark/bismark.conf +. /usr/lib/bismark/functions.inc.sh + +exit 0 +# Help screen +[ $6 ] || { + echo "usage: $(basename $0) tcp " + echo " $(basename $0) udp " + echo " $(basename $0) udpflood " + exit +} + +# AWK log filter +filter=' + /bitrate/{ out="bitrate.dat" ; next } + /jitter/{ out="jitter.dat" ; next } + /pktloss/{ out="packetloss.dat" ; next } + (out != ""){ print >> out } +' + +# Change path +cd /tmp +[ -e itgfifo ] || mkfifo itgfifo +get_ip +tstamp=$(date +%s) + +# Select protocol +case $1 in +tcp) + pkt_size=1460 + pkt_rate=$(( ((${6}000 / 8) / $pkt_size) + 1 )) + + # Select direction + case $4 in + up) + ITGSend -a $2 -rp 0 -T TCP -c $pkt_size -C $pkt_rate -t ${5}000 -x /tmp/${DEVICE_ID}_$tstamp.log >/dev/null 2>&1 + echo "log /tmp/${DEVICE_ID}_$tstamp.log" | nc -n $2 $3 | awk "$filter" + cat bitrate.dat | mstats BITRATE DITG $src $2 | grep -v nan + ;; + dw) + RANDOM=$(( `date +%s` % 32767 )) + port=$(( RANDOM % 5000 + 10000 )) + { echo "send -H -Ssp $port -rp 0 -T TCP -c $pkt_size -C $pkt_rate -t ${5}000" ; sleep 1 ; } | nc $NC_OPTS $2 $3 + ITGRecv -H $2 -Sp $port -l itgfifo 2>/dev/null | ITGDec itgfifo -b 1000 > /dev/null 2>&1 + awk '(NR > 1){ print $3 }' bitrate.dat | mstats BITRATE DITG $2 $src | grep -v nan + ;; + esac +;; +udp) + pkt_size=512 + pkt_rate=$6 + + # Select direction + case $4 in + up) + ITGSend -a $2 -rp 0 -T UDP -c $pkt_size -C $pkt_rate -t ${5}000 -x /tmp/${DEVICE_ID}_$tstamp.log >/dev/null 2>&1 + echo "log /tmp/${DEVICE_ID}_$tstamp.log" | nc -n $2 $3 | awk "$filter" + cat jitter.dat | mstats JITTER DITG $src $2 | grep -v nan + cat packetloss.dat | mstats PKTLOSS DITG $src $2 | grep -v nan + ;; + dw) + RANDOM=$(( `date +%s` % 32767 )) + port=$(( RANDOM % 5000 + 10000 )) + { echo "send -H -Ssp $port -rp 0 -T UDP -c $pkt_size -C $pkt_rate -t ${5}000" ; sleep 1 ; } | nc $NC_OPTS $2 $3 + ITGRecv -H $2 -Sp $port -l itgfifo 2>/dev/null | ITGDec itgfifo -p 1000 -j 1000 > /dev/null 2>&1 + awk '(NR > 1){ print $3 }' jitter.dat | mstats JITTER DITG $2 $src | grep -v nan + awk '(NR > 1){ print $3 }' packetloss.dat | mstats PKTLOSS DITG $2 $src | grep -v nan + ;; + esac +;; +udpflood) + pkt_size=1472 + pkt_rate=$(( ((${6}000 / 8) / $pkt_size) + 1 )) + + # Select direction + case $4 in + up) + ITGSend -a $2 -rp 0 -T UDP -c $pkt_size -C $pkt_rate -t ${5}000 -x /tmp/${DEVICE_ID}_$tstamp.log >/dev/null 2>&1 + echo "log /tmp/${DEVICE_ID}_$tstamp.log" | nc -n $2 $3 | awk "$filter" + cat bitrate.dat | mstats UDPBITRATE DITG $src $2 | grep -v nan + ;; + dw) + RANDOM=$(( `date +%s` % 32767 )) + port=$(( RANDOM % 5000 + 10000 )) + { echo "send -H -Ssp $port -rp 0 -T UDP -c $pkt_size -C $pkt_rate -t ${5}000" ; sleep 1 ; } | nc $NC_OPTS $2 $3 + ITGRecv -H $2 -Sp $port -l itgfifo 2>/dev/null | ITGDec itgfifo -b 1000 > /dev/null 2>&1 + awk '(NR > 1){ print $3 }' bitrate.dat | mstats UDPBITRATE DITG $2 $src | grep -v nan + ;; + esac +;; +esac + +rm -f bitrate.dat jitter.dat packetloss.dat + Property changes on: trunk/device/OpenWrt_common/scripts/bismark-ditg ___________________________________________________________________ Name: svn:executable + * Added: trunk/device/OpenWrt_common/scripts/bismark-dns =================================================================== --- trunk/device/OpenWrt_common/scripts/bismark-dns (rev 0) +++ trunk/device/OpenWrt_common/scripts/bismark-dns 2011-04-14 15:09:45 UTC (rev 318) @@ -0,0 +1,38 @@ +#!/bin/ash +# Bismark dns wrapper +# +# author: walter.dedonato@unina.it + +# Load configuration files +. /etc/bismark/bismark.conf +. /usr/lib/bismark/functions.inc.sh +exit 0 + +# Get IP and default DNS server +get_ip +[ -e /etc/resolv.conf ] && dds=$(awk '/^nameserver/{ print $2 ; exit }' /etc/resolv.conf) + +# Cycle DNS servers (default and OpenDNS) +mkdir -p /tmp/host +for s in "$dds" "8.8.8.8"; do + + # Cycle cache no-cache + for m in NC C; do + # Cycle top 10 hosts list + fail=0 + count=0 + rm /tmp/host/delays + + IFS=$'\n' + for h in $(cat ~/conf/hosts.list); do + ~/bin/time -f %e --append -o /tmp/host/delays host $h $s >/dev/null || : $((fail++)) + : $((count++)) + done + + # Output + [ $s ] || s="127.0.0.1" + grep '^[0-9]' /tmp/host/delays | mstats DNSDELAY$m HOST $src $s + awk 'BEGIN{ print ('$fail'/'$count') * 100 }' | mstats DNSFAIL$m HOST $src $s + done +done + Property changes on: trunk/device/OpenWrt_common/scripts/bismark-dns ___________________________________________________________________ Name: svn:executable + * Added: trunk/device/OpenWrt_common/scripts/bismark-measure-active =================================================================== --- trunk/device/OpenWrt_common/scripts/bismark-measure-active (rev 0) +++ trunk/device/OpenWrt_common/scripts/bismark-measure-active 2011-04-14 15:09:45 UTC (rev 318) @@ -0,0 +1,185 @@ +#!/bin/ash +# Executes a measurement cycle +# +# author: walter.dedonato@unina.it + +# Load configuration file +. /etc/bismark/bismark.conf +. /usr/lib/bismark/functions.inc.sh + +# Measure message generator +# $1 = options +msg () +{ + echo "$DEVICE_ID measure $1" + sleep 3 +} + +# Get target info +# $1 = category +# $2 = type +# $3 = zone +# $4 = duration +get_target () +{ + # Send message + msg "$1 $2 $3 $4" | nc -u $NC_OPTS $SERVER $PROBE_PORT > /tmp/mreply + + # Get reply + read dst info wait < /tmp/mreply + [ $dst ] || return 1 +} + +# Create dirs and files +mkdir -p /tmp/measure +[ -e /tmp/measure/counter ] || echo 0 > /tmp/measure/counter + +# Get and update count +count=$(cat /tmp/measure/counter) +echo $(( (count + 1) % 288 )) > /tmp/measure/counter + +# Random wait +sleep $((RANDOM % 3)) + +# Globals +xml_file="/tmp/${DEVICE_ID}_$(date +%s).xml" + +# Get source IP +get_ip + +# XML file header +cat > $xml_file <<-end + + + +end + +## Concurrent measurements ## +count=0 +if [ $((count % TR_FQ)) -eq 0 ]; then + # Traceroute + if get_target Bismark TR $ZONE 0 ; then + hops=$(bismark-tr $dst) + hops_cnt=$(echo "$hops" | wc -l) + if [ $hops_cnt -gt 0 ]; then + cat >> $xml_file <<-end + + $(echo "$hops" | awk '{ print " " $0 }') + + end + fi + gwip=$(cat /tmp/gwip) + fi + + # Reverse traceroute + if get_target Bismark RTR $ZONE 0 ; then + hops=$(bismark-rtr $dst $info) + hops_cnt=$(echo "$hops" | wc -l) + if [ $hops_cnt -gt 0 ]; then + cat >> $xml_file <<-end + + $(echo "$hops" | awk '{ print " " $0 }') + + end + fi + fi +fi +echo "Done TR" +# Get Gateway IP +if [ ! "$gwip" ]; then + bismark-tr "8.8.8.8" > /dev/null + [ -e /tmp/gwip ] && gwip=$(cat /tmp/gwip) +fi + +# RTT measurements using PING +if get_target Bismark PING $ZONE 10 ; then + # Last mile RTT + if [ "$gwip" ]; then + ( bismark-ping $gwip | bismark-mstats LMRTT PING $src $gwip > /tmp/lmrtt ; cat /tmp/lmrtt >> $xml_file ) & + fi + + # Geo-distributed servers RTT + mkdir -p /tmp/gdrtt + for srv in $(grep -v ^# ~/conf/gd.list); do + ( bismark-ping $srv | bismark-mstats RTT PING $src $srv > /tmp/gdrtt/$srv ; cat /tmp/gdrtt/$srv >> $xml_file ) & + done + + # MServer RTT + bismark-ping $dst | bismark-mstats RTT PING $src $dst >> $xml_file +fi +echo "Done PING" +# DNS delay and failure +if [ $((count % DNS_FQ)) -eq 0 ]; then + bismark-dns >> $xml_file +fi +echo "Done DNS" + +## Serial measurements ## +if [ ! -e /tmp/mlock ]; then + # Set measure lock + echo $(date +%s) > /tmp/mlock + + # Bitrate + if [ $((count % BR_FQ)) -eq 0 ]; then + # Downstream bitrate using NETPERF + if get_target Bismark NETPERF $ZONE $BR_DURATION ; then + sleep $wait + ( sleep 3 ; bismark-ping $dst | bismark-mstats ULRTTDW PING $src $dst >> $xml_file ) & + bismark-netperf $BR_DURATION $NTHREADS $dst dw | bismark-mstats BITRATE NETPERF $dst $src | grep -v nan >> $xml_file + fi + + # Upstream bitrate using NETPERF + if get_target Bismark NETPERF $ZONE $BR_DURATION ; then + sleep $wait + ( sleep 3 ; bismark-ping $dst | bismark-mstats ULRTTUP PING $src $dst >> $xml_file ) & + bismark-netperf $BR_DURATION $NTHREADS $dst up | bismark-mstats BITRATE NETPERF $src $dst | grep -v nan >> $xml_file + fi + fi + + # Jitter & Packet loss using DITG + if [ $((count % UDP_FQ)) -eq 0 ]; then + # Downstream + if get_target Bismark ITGDL $ZONE $UDP_DURATION ; then + sleep $wait + bismark-ditg udp $dst $info dw $UDP_DURATION $UDP_PPS >> $xml_file + fi + + # Upstream + if get_target Bismark ITGUL $ZONE $UDP_DURATION ; then + sleep $wait + bismark-ditg udp $dst $info up $UDP_DURATION $UDP_PPS >> $xml_file + fi + fi + + # Shaper probe + if [ $((count % SP_FQ)) -eq 0 ]; then + if get_target Bismark SP $ZONE 150 ; then + sleep $wait + bismark-sp $dst >> $xml_file + fi + fi + + # Release measure lock + rm /tmp/mlock +else + # Check lock + locktime=$(cat /tmp/mlock) + currtime=$(date +%s) + if [ $((currtime - locktime)) -gt 400 ]; then + killall netperf prober ITGRecv ITGSend + rm /tmp/mlock + fi +fi +echo "Done ALL" + +# XML file footer +cat >> $xml_file <<-end + +end + +# Move file to measure folder +sleep 2 +mv $xml_file /tmp/measure + +# Upload result + Property changes on: trunk/device/OpenWrt_common/scripts/bismark-measure-active ___________________________________________________________________ Name: svn:executable + * Added: trunk/device/OpenWrt_common/scripts/bismark-mstats =================================================================== --- trunk/device/OpenWrt_common/scripts/bismark-mstats (rev 0) +++ trunk/device/OpenWrt_common/scripts/bismark-mstats 2011-04-14 15:09:45 UTC (rev 318) @@ -0,0 +1,43 @@ +#!/bin/ash +# Calculates statistics from stdin samples and outputs XML measure +# +# author: walter.dedonato@unina.it + +[ $4 ] || { echo "usage: samples_generator | $(basename $0) " ; exit ; } + +sort -n | awk ' +BEGIN { n = sum = qsum = 0 } +($1 > 0){ + sum += $1 + qsum += $1 ^ 2 + data[++n] = $1 +} +END { + if (n > 1) { + # Mean - Std - Min - Max + avg = sum/n + std = sqrt((n*qsum - sum^2) / (n * (n - 1))) + min = data[1] + max = data[n] + + # Median + if (n % 2 == 0) median = (data[n/2] + data[n/2 + 1]) / 2 + else median = data[(n + 1) / 2] + + # IQR + n1 = 0.25 * (n - 1) + 1; k1 = int(n1); d1 = n1 - k1 + n3 = 0.75 * (n - 1) + 1; k3 = int(n3); d3 = n3 - k3 + q1 = data[k1] + d1 * (data[k1 + 1] - data[k1]) + q3 = data[k3] + d3 * (data[k3 + 1] - data[k3]) + iqr = q3 - q1 + + # XML output + printf "\t\n", avg, std, min, max, median, iqr + } else if (n == 1) { + # XML output + printf "\t\n", sum, sum, sum, sum + } else { + # XML output + print "\t" + } +}' Property changes on: trunk/device/OpenWrt_common/scripts/bismark-mstats ___________________________________________________________________ Name: svn:executable + * Added: trunk/device/OpenWrt_common/scripts/bismark-netperf =================================================================== --- trunk/device/OpenWrt_common/scripts/bismark-netperf (rev 0) +++ trunk/device/OpenWrt_common/scripts/bismark-netperf 2011-04-14 15:09:45 UTC (rev 318) @@ -0,0 +1,12 @@ +#!/bin/ash +# Bismark netperf wrapper +# +# author: walter.dedonato@unina.it + +# Load configuration files +. /etc/bismark/bismark.conf + +# Help screen +[ $4 ] || { echo "usage: $(basename $0) " ; exit ; } + +bismark-netperf-thread $1 $2 $3 $4 Property changes on: trunk/device/OpenWrt_common/scripts/bismark-netperf ___________________________________________________________________ Name: svn:executable + * Added: trunk/device/OpenWrt_common/scripts/bismark-netperf-thread =================================================================== --- trunk/device/OpenWrt_common/scripts/bismark-netperf-thread (rev 0) +++ trunk/device/OpenWrt_common/scripts/bismark-netperf-thread 2011-04-14 15:09:45 UTC (rev 318) @@ -0,0 +1,62 @@ +#!/usr/bin/env ash + +T=$1 +#i=$2 +N=$2 +host=$3 +dir=$4 + +cmd=./netperf +out='/tmp/netperf-out' +err='/tmp/netperf-err' +port=12865 + +clean() { + ls $out* +} +check() { + nlines=$1 + c=1 + while [ $c -le $N ] + do + ilines=`awk 'END{print NR}' $out$c` + errors=`awk 'END{print NR}' $err$c` + if [ $nlines -ne $ilines ] || [ $errors -gt 0 ] + then + echo "Error running netperf" + clean + exit 1 + fi + c=`expr $c + 1` + done +} + +parse() { + nlines=1 + check $nlines + head -$c -q "$out"* | awk '{print $5}' | awk 'BEGIN{sum=0;}{sum+=$1}END{print sum}'; +} + +keys=" -l$T -P0 -fk" +if [ $dir = 'rev' ] +then + keys=$keys' -t TCP_MAERTS' +fi +if [ $dir = 'fwd' ] +then + keys=$keys' -t TCP_STREAM' +fi +#echo $keys $host +c=1 +while [ $c -le $N ] +do + #echo $c + echo $cmd $keys -p$port $host + $cmd $keys -p$port -H $host > $out$c 2>$err$c & + c=`expr $c + 1` + #port=`expr $port + 1` +done +wait +parse +#clean +exit 0 Property changes on: trunk/device/OpenWrt_common/scripts/bismark-netperf-thread ___________________________________________________________________ Name: svn:executable + * Added: trunk/device/OpenWrt_common/scripts/bismark-ping =================================================================== --- trunk/device/OpenWrt_common/scripts/bismark-ping (rev 0) +++ trunk/device/OpenWrt_common/scripts/bismark-ping 2011-04-14 15:09:45 UTC (rev 318) @@ -0,0 +1,19 @@ +#!/bin/ash +# Bismark ping wrapper +# +# author: walter.dedonato@unina.it + +# Load configuration files +. /etc/bismark/bismark.conf + +# Help screen +[ $1 ] || { echo "usage: $(basename $0) " ; exit ; } + +# Options selection +opts="$opts -c $PING_COUNT" +opts="$opts -s $PING_PSIZE" +opts="$opts -W $PING_TIMEOUT" +[ -e /etc/openwrt_release ] || opts="$opts -i $PING_INTERVAL" + +# Execute ping +ping $opts $1 | awk -F"=|ms" '/ttl/{ print $4 }' Property changes on: trunk/device/OpenWrt_common/scripts/bismark-ping ___________________________________________________________________ Name: svn:executable + * Added: trunk/device/OpenWrt_common/scripts/bismark-rtr =================================================================== --- trunk/device/OpenWrt_common/scripts/bismark-rtr (rev 0) +++ trunk/device/OpenWrt_common/scripts/bismark-rtr 2011-04-14 15:09:45 UTC (rev 318) @@ -0,0 +1,17 @@ +#!/bin/ash +# Bismark reverse traceroute wrapper +# +# author: walter.dedonato@unina.it + +# Load configuration files +. /etc/bismark/bismark.conf + +# Help screen +[ $2 ] || { echo "usage: $(basename $0) " ; exit 1 ; } + +# AWK filters +filter='! /trace/{ print "" }' + +# Exec reverse traceroute +{ echo $RTR_TYPE ; sleep 10 ; } | nc $NC_OPTS $1 $2 | awk "$filter" + Property changes on: trunk/device/OpenWrt_common/scripts/bismark-rtr ___________________________________________________________________ Name: svn:executable + * Added: trunk/device/OpenWrt_common/scripts/bismark-scp =================================================================== --- trunk/device/OpenWrt_common/scripts/bismark-scp (rev 0) +++ trunk/device/OpenWrt_common/scripts/bismark-scp 2011-04-14 15:09:45 UTC (rev 318) @@ -0,0 +1,26 @@ +#!/bin/ash +# Transfers files to the bismark server +# +# author: walter.dedonato@unina.it + +# Load configuration file +. /etc/bismark/bismark.conf + +# Help screen +[ $2 ] || { echo "usage: $(basename $0) [...]" ; exit ; } + +# Copy files using scp +case $1 in +up) + shift + for file in $*; do + scp -i $SSH_KEY $file $USER@$SERVER:~/bismark/device/$PLATFORM/$file + done +;; +dw) + shift + for file in $*; do + scp -i $SSH_KEY $USER@$SERVER:~/bismark/device/$PLATFORM/$file $file + done +;; +esac Property changes on: trunk/device/OpenWrt_common/scripts/bismark-scp ___________________________________________________________________ Name: svn:executable + * Added: trunk/device/OpenWrt_common/scripts/bismark-sp =================================================================== --- trunk/device/OpenWrt_common/scripts/bismark-sp (rev 0) +++ trunk/device/OpenWrt_common/scripts/bismark-sp 2011-04-14 15:09:45 UTC (rev 318) @@ -0,0 +1,23 @@ +#!/bin/ash +# Bismark shaperprobe wrapper (output in Kbps) +# +# author: walter.dedonato@unina.it + +# Load configuration file +. /etc/bismark/bismark.conf +. /usr/lib/bismark/functions.inc.sh + +exit 0 +# Get measure info +get_ip +dst=$1 +tstamp=$(date +%s) + +prober | awk ' + BEGIN{ RS="[\r\n]" } + /^Upstream:/{ print "\t" } + /^Downstream:/{ print "\t" } + /^Up:/{ print "\t" } + /^Down:/{ print "\t" } +' + Property changes on: trunk/device/OpenWrt_common/scripts/bismark-sp ___________________________________________________________________ Name: svn:executable + * Added: trunk/device/OpenWrt_common/scripts/bismark-tr =================================================================== --- trunk/device/OpenWrt_common/scripts/bismark-tr (rev 0) +++ trunk/device/OpenWrt_common/scripts/bismark-tr 2011-04-14 15:09:45 UTC (rev 318) @@ -0,0 +1,61 @@ +#!/bin/ash +# Bismark traceroute wrapper +# +# author: walter.dedonato@unina.it + +# Load configuration files +. /etc/bismark/bismark.conf + +# Help screen +[ $1 ] || { echo "usage: $(basename $0) " ; exit 1 ; } + +# AWK filters +filter_common=' +if (! gwip) { + if (! ($2 ~ /^10\./ || $2 ~ /^192\.168/ || $2 ~ /^172\.16/) ) { + gwip=$2 + print gwip > "/tmp/gwip" + } +}' +filter_std=' +! /trace/{ + print "" + '$filter_common' +}' +filter_tcp='{ rtt=$3 } ; /\[.*\]/{ rtt=$4 } +{ + print "" + '$filter_common' +}' + +# Select traceroute type +echo $TR_TYPE +case $TR_TYPE in +UDP) + cmd="traceroute" + opts="-n -q1" + filter=$filter_std +;; +TCP) + if which tcptraceroute > /dev/null; then + cmd="tcptraceroute" + opts="-n -q1" + filter=$filter_tcp + else + cmd="traceroute" + opts="-n -q1 -T" + filter=$filter_std + fi + [ $(id -u) -eq 0 ] || cmd="sudo $cmd" +;; +ICMP) + cmd="traceroute" + opts="-n -q1 -I" + filter=$filter_std + [ $(id -u) -eq 0 ] || cmd="sudo $cmd" +;; +esac + +# Run traceroute +$cmd $opts $1 | awk "$filter" + Property changes on: trunk/device/OpenWrt_common/scripts/bismark-tr ___________________________________________________________________ Name: svn:executable + * Deleted: trunk/device/OpenWrt_common/scripts/bping =================================================================== --- trunk/device/OpenWrt_common/scripts/bping 2011-04-13 18:34:25 UTC (rev 317) +++ trunk/device/OpenWrt_common/scripts/bping 2011-04-14 15:09:45 UTC (rev 318) @@ -1,19 +0,0 @@ -#!/bin/bash -# Bismark ping wrapper -# -# author: walter.dedonato@unina.it - -# Load configuration files -. ~/conf/dev.conf - -# Help screen -[ $1 ] || { echo "usage: $(basename $0) " ; exit ; } - -# Options selection -opts="$opts -c $PING_COUNT" -opts="$opts -s $PING_PSIZE" -opts="$opts -W $PING_TIMEOUT" -[ ${DEVICE_ID:0:2} == LS ] || opts="$opts -i $PING_INTERVAL" - -# Execute ping -ping $opts $1 | awk -F"=|ms" '/ttl/{ print $4 }' Deleted: trunk/device/OpenWrt_common/scripts/brtr =================================================================== --- trunk/device/OpenWrt_common/scripts/brtr 2011-04-13 18:34:25 UTC (rev 317) +++ trunk/device/OpenWrt_common/scripts/brtr 2011-04-14 15:09:45 UTC (rev 318) @@ -1,17 +0,0 @@ -#!/bin/bash -# Bismark reverse traceroute wrapper -# -# author: walter.dedonato@unina.it - -# Load configuration files -. ~/conf/dev.conf - -# Help screen -[ $2 ] || { echo "usage: $(basename $0) " ; exit 1 ; } - -# AWK filters -filter='! /trace/{ print "" }' - -# Exec reverse traceroute -{ echo $RTR_TYPE ; sleep 10 ; } | nc $NC_OPTS $1 $2 | awk "$filter" - Deleted: trunk/device/OpenWrt_common/scripts/bscp =================================================================== --- trunk/device/OpenWrt_common/scripts/bscp 2011-04-13 18:34:25 UTC (rev 317) +++ trunk/device/OpenWrt_common/scripts/bscp 2011-04-14 15:09:45 UTC (rev 318) @@ -1,26 +0,0 @@ -#!/bin/bash -# Transfers files to the bismark server -# -# author: walter.dedonato@unina.it - -# Load configuration file -. ~/conf/dev.conf - -# Help screen -[ $2 ] || { echo "usage: $(basename $0) [...]" ; exit ; } - -# Copy files using scp -case $1 in -up) - shift - for file in $*; do - scp -i $SSH_KEY $file $USER@$SERVER:~/bismark/device/$file - done -;; -dw) - shift - for file in $*; do - scp -i $SSH_KEY $USER@$SERVER:~/bismark/device/$file $file - done -;; -esac Deleted: trunk/device/OpenWrt_common/scripts/bsp =================================================================== --- trunk/device/OpenWrt_common/scripts/bsp 2011-04-13 18:34:25 UTC (rev 317) +++ trunk/device/OpenWrt_common/scripts/bsp 2011-04-14 15:09:45 UTC (rev 318) @@ -1,22 +0,0 @@ -#!/bin/bash -# Bismark ditg wrapper (output in Kbps) -# -# author: walter.dedonato@unina.it - -# Load configuration file -. ~/conf/dev.conf -. ~/scripts/functions - -# Get measure info -get_ip -dst=$1 -tstamp=$(date +%s) - -prober | awk ' - BEGIN{ RS="[\r\n]" } - /^Upstream:/{ print "\t" } - /^Downstream:/{ print "\t" } - /^Up:/{ print "\t" } - /^Down:/{ print "\t" } -' - Deleted: trunk/device/OpenWrt_common/scripts/btr =================================================================== --- trunk/device/OpenWrt_common/scripts/btr 2011-04-13 18:34:25 UTC (rev 317) +++ trunk/device/OpenWrt_common/scripts/btr 2011-04-14 15:09:45 UTC (rev 318) @@ -1,60 +0,0 @@ -#!/bin/bash -# Bismark traceroute wrapper -# -# author: walter.dedonato@unina.it - -# Load configuration files -. ~/conf/dev.conf - -# Help screen -[ $1 ] || { echo "usage: $(basename $0) " ; exit 1 ; } - -# AWK filters -filter_common=' -if (! gwip) { - if (! ($2 ~ /^10\./ || $2 ~ /^192\.168/ || $2 ~ /^172\.16/) ) { - gwip=$2 - print gwip > "/tmp/gwip" - } -}' -filter_std=' -! /trace/{ - print "" - '$filter_common' -}' -filter_tcp='{ rtt=$3 } ; /\[.*\]/{ rtt=$4 } -{ - print "" - '$filter_common' -}' - -# Select traceroute type -case $TR_TYPE in -UDP) - cmd="traceroute" - opts="-n -q1" - filter=$filter_std -;; -TCP) - if which tcptraceroute > /dev/null; then - cmd="tcptraceroute" - opts="-n -q1" - filter=$filter_tcp - else - cmd="traceroute" - opts="-n -q1 -T" - filter=$filter_std - fi - [ $(id -u) -eq 0 ] || cmd="sudo $cmd" -;; -ICMP) - cmd="traceroute" - opts="-n -q1 -I" - filter=$filter_std - [ $(id -u) -eq 0 ] || cmd="sudo $cmd" -;; -esac - -# Run traceroute -$cmd $opts $1 | awk "$filter" - Deleted: trunk/device/OpenWrt_common/scripts/measure =================================================================== --- trunk/device/OpenWrt_common/scripts/measure 2011-04-13 18:34:25 UTC (rev 317) +++ trunk/device/OpenWrt_common/scripts/measure 2011-04-14 15:09:45 UTC (rev 318) @@ -1,219 +0,0 @@ -#!/bin/bash -# Executes a measurement cycle -# -# author: walter.dedonato@unina.it - -# Load configuration file -. ~/conf/dev.conf -. ~/scripts/functions - -# Measure message generator -# $1 = options -msg () -{ - echo "$DEVICE_ID measure $1" - sleep 3 -} - -# Get target info -# $1 = category -# $2 = type -# $3 = zone -# $4 = duration -get_target () -{ - # Send message - msg "$1 $2 $3 $4" | nc -u $NC_OPTS $SERVER $PROBE_PORT > /tmp/mreply - - # Get reply - read dst info wait < /tmp/mreply - [ $dst ] || return 1 -} - -# Create dirs and files -mkdir -p /tmp/measure -[ -e /tmp/measure/counter ] || echo 0 > /tmp/measure/counter - -# Get and update count -count=$(cat /tmp/measure/counter) -echo $(( (count + 1) % 288 )) > /tmp/measure/counter - -# Launch continous measurements -if [ ${DEVICE_ID:0:2} == NB ]; then - # Start/Restart TIE daemon - [ $PRIVACY_MODE ] || plstream="-S1400" - ptime=`~/www/cgi-bin/sql.py 'SELECT valint FROM val WHERE valid="privend"'| sed -e 's/[(),]//g'` - [ -e /tmp/restart ] && ( rm /tmp/restart && killall tie ) - if [ $(date +%s) -gt $ptime ]; then - [ $(pgrep -n tie) ] || ( tie -n -m c -i any -E $DEVICE_ID -d /tmp/measure/ -P32 $plstream -f prttstat,plstat,iptstat >/dev/null 2>&1 & ) - fi - - bwdump # Start/restart airodump - barp # Dump arp table - event alive # Update alive TS -fi - -# Random wait -sleep $((RANDOM % 30)) - -# Globals -xml_file="/tmp/${DEVICE_ID}_$(date +%s).xml" - -# Get source IP -get_ip - -# XML file header -cat > $xml_file <<-end - - - -end - -## Concurrent measurements ## - -if [ $((count % TR_FQ)) -eq 0 ]; then - # Traceroute - if get_target Bismark TR $ZONE 0 ; then - hops=$(btr $dst) - hops_cnt=$(echo "$hops" | wc -l) - if [ $hops_cnt -gt 1 ]; then - cat >> $xml_file <<-end - - $(echo "$hops" | awk '{ print " " $0 }') - - end - fi - gwip=$(cat /tmp/gwip) - fi - - # Reverse traceroute - if get_target Bismark RTR $ZONE 0 ; then - hops=$(brtr $dst $info) - hops_cnt=$(echo "$hops" | wc -l) - if [ $hops_cnt -gt 1 ]; then - cat >> $xml_file <<-end - - $(echo "$hops" | awk '{ print " " $0 }') - - end - fi - fi -fi - -# Get Gateway IP -if [ ! "$gwip" ]; then - btr "8.8.8.8" > /dev/null - [ -e /tmp/gwip ] && gwip=$(cat /tmp/gwip) -fi - -# RTT measurements using PING -if get_target Bismark PING $ZONE 10 ; then - # Last mile RTT - if [ "$gwip" ]; then - ( bping $gwip | mstats LMRTT PING $src $gwip > /tmp/lmrtt ; cat /tmp/lmrtt >> $xml_file ) & - fi - - # Geo-distributed servers RTT - mkdir -p /tmp/gdrtt - for srv in $(grep -v ^# ~/conf/gd.list); do - ( bping $srv | mstats RTT PING $src $srv > /tmp/gdrtt/$srv ; cat /tmp/gdrtt/$srv >> $xml_file ) & - done - - # MServer RTT - bping $dst | mstats RTT PING $src $dst >> $xml_file -fi - -# DNS delay and failure -if [ $((count % DNS_FQ)) -eq 0 ]; then - bdns >> $xml_file -fi - -## Serial measurements ## -if [ ! -e /tmp/mlock ]; then - # Set measure lock - echo $(date +%s) > /tmp/mlock - - # Bitrate - if [ $((count % BR_FQ)) -eq 0 ]; then - if [ ${DEVICE_ID:0:2} != LS ]; then - # Downstream bitrate using curl and HTTP - if get_target Bismark HTTPDL $ZONE $HTTP_DURATION ; then - sleep $wait - ( sleep 3 ; bping $dst | mstats ULRTTDW PING $src $dst >> $xml_file ) & - bcurl "http://$dst$info" dw $HTTP_DURATION $DW_KBPS | mstats BITRATE CURL $dst $src | grep -v nan >> $xml_file - cut -f1 /tmp/curl/rates | mstats AGGL3BITRATE IFACE $dst $src >> $xml_file - cut -f2 /tmp/curl/rates | mstats FILEBITRATE CURL $dst $src >> $xml_file - fi - - # Upstream bitrate using curl and HTTP - if get_target Bismark HTTPUL $ZONE $HTTP_DURATION ; then - sleep $wait - ( sleep 3 ; bping $dst | mstats ULRTTUP PING $src $dst >> $xml_file ) & - pid=$(echo "start" | nc $dst 777) - bcurl "http://$dst$info" up $HTTP_DURATION $UP_KBPS | mstats BITRATE CURL $src $dst | grep -v nan >> $xml_file - cut -f1 /tmp/curl/rates | mstats AGGL3BITRATE IFACE $src $dst >> $xml_file - cut -f2 /tmp/curl/rates | mstats FILEBITRATE CURL $src $dst >> $xml_file - echo "stop $pid" | nc $dst 777 | mstats BITRATE TCPDUMP $src $dst >> $xml_file - fi - else - # Downstream bitrate using DITG - if get_target Bismark ITGDL $ZONE $HTTP_DURATION ; then - sleep $wait - ( sleep 3 ; bping $dst | mstats ULRTTDW PING $src $dst >> $xml_file ) & - bditg tcp $dst $info dw $HTTP_DURATION $DW_KBPS >> $xml_file - fi - - # Upstream bitrate using DITG - if get_target Bismark ITGUL $ZONE $HTTP_DURATION ; then - sleep $wait - ( sleep 3 ; bping $dst | mstats ULRTTUP PING $src $dst >> $xml_file ) & - bditg tcp $dst $info up $HTTP_DURATION $UP_KBPS >> $xml_file - fi - fi - fi - - # Jitter & Packet loss using DITG - if [ $((count % UDP_FQ)) -eq 0 ]; then - # Downstream - if get_target Bismark ITGDL $ZONE $UDP_DURATION ; then - sleep $wait - bditg udp $dst $info dw $UDP_DURATION $UDP_PPS >> $xml_file - fi - - # Upstream - if get_target Bismark ITGUL $ZONE $UDP_DURATION ; then - sleep $wait - bditg udp $dst $info up $UDP_DURATION $UDP_PPS >> $xml_file - fi - fi - - # Shaper probe - if [ $((count % SP_FQ)) -eq 0 ]; then - if get_target Bismark SP $ZONE 150 ; then - sleep $wait - bsp $dst >> $xml_file - fi - fi - - # Release measure lock - rm /tmp/mlock -else - # Check lock - locktime=$(cat /tmp/mlock) - currtime=$(date +%s) - if [ $((currtime - locktime)) -gt 400 ]; then - killall curl prober ITGRecv ITGSend - rm /tmp/mlock - fi -fi - -# XML file footer -cat >> $xml_file <<-end - -end - -# Move file to measure folder -sleep 2 -mv $xml_file /tmp/measure - - Deleted: trunk/device/OpenWrt_common/scripts/mstats =================================================================== --- trunk/device/OpenWrt_common/scripts/mstats 2011-04-13 18:34:25 UTC (rev 317) +++ trunk/device/OpenWrt_common/scripts/mstats 2011-04-14 15:09:45 UTC (rev 318) @@ -1,43 +0,0 @@ -#!/bin/bash -# Calculates statistics from stdin samples and outputs XML measure -# -# author: walter.dedonato@unina.it - -[ $4 ] || { echo "usage: samples_generator | $(basename $0) " ; exit ; } - -sort -n | awk ' -BEGIN { n = sum = qsum = 0 } -($1 > 0){ - sum += $1 - qsum += $1 ^ 2 - data[++n] = $1 -} -END { - if (n > 1) { - # Mean - Std - Min - Max - avg = sum/n - std = sqrt((n*qsum - sum^2) / (n * (n - 1))) - min = data[1] - max = data[n] - - # Median - if (n % 2 == 0) median = (data[n/2] + data[n/2 + 1]) / 2 - else median = data[(n + 1) / 2] - - # IQR - n1 = 0.25 * (n - 1) + 1; k1 = int(n1); d1 = n1 - k1 - n3 = 0.75 * (n - 1) + 1; k3 = int(n3); d3 = n3 - k3 - q1 = data[k1] + d1 * (data[k1 + 1] - data[k1]) - q3 = data[k3] + d3 * (data[k3 + 1] - data[k3]) - iqr = q3 - q1 - - # XML output - printf "\t\n", avg, std, min, max, median, iqr - } else if (n == 1) { - # XML output - printf "\t\n", sum, sum, sum, sum - } else { - # XML output - print "\t" - } -}' Deleted: trunk/device/OpenWrt_i586/rc.local =================================================================== --- trunk/device/OpenWrt_i586/rc.local 2011-04-13 18:34:25 UTC (rev 317) +++ trunk/device/OpenWrt_i586/rc.local 2011-04-14 15:09:45 UTC (rev 318) @@ -1 +0,0 @@ -link ../OpenWrt_common/rc.local \ No newline at end of file