瀏覽代碼

Tools for automated network profiling.

Jiri Kuthan 24 年之前
父節點
當前提交
f938f5eeb7
共有 2 個文件被更改,包括 171 次插入0 次删除
  1. 103 0
      profile/launch.sh
  2. 68 0
      profile/profile.cfg

+ 103 - 0
profile/launch.sh

@@ -0,0 +1,103 @@
+#!/bin/sh -x
+
+# profile filename
+PREF=$1
+# number of cycles
+NROFCYCLES=4
+# functions to go into report
+MYFN="eat_line|eat_space|eat_token"
+# set to non-zero if only a report is to be generated
+#REPONLY=tru
+
+SRD=${HOME}/sip_router
+PRO=${SRD}/profile
+REP=$PRO/$PREF.txt
+
+
+function usage()
+{
+cat << EOF
+usage: $0 profile_name
+
+currently, this script starts a remote sender at alioth.
+The sender iterates through all messages available in its
+directory and send them many times (should be configurable).
+Sip-router is configured to relay requests to benetnash:sink
+and responses are built to be routed there too.
+This repeats NROFCYCLES-times. Results of all cycles are then
+dumped into <profile_name>-<cycle number>.txt and a
+report <profile_name>.txt is generated.
+
+EOF
+
+exit 1
+}
+
+if [ "$#" -ne 1 ] ; then
+	usage
+fi
+
+cd $SRD
+
+function run()
+{
+j=0
+while [ $j -lt "$NROFCYCLES" ] ; do
+i=`printf "%.3d" $j`
+j=`expr $j + 1`
+
+echo "*** Entering cycle $j"
+
+/usr/bin/time --output="$PRO/${PREF}-${i}-time.txt" ${SRD}/sip_router  -l 192.168.99.100 -D -E -d -f ${PRO}/profile.cfg  &
+
+#rsh -l jku benetnash.fokus.gmd.de 'nohup bin/sock -s -u 5060 '
+
+rsh -l jku alioth.fokus.gmd.de 'nohup tmp/sipp/start.sh '
+
+killall -INT sip_router
+
+gprof sip_router > $PRO/${PREF}-${i}.txt
+
+done
+}
+
+function report()
+{
+cat > $REP << EOF
+first line ... time spent in tested procedure
+second line (yyrestart) ... total time
+third line (receive_msg) ... numer of calls
+   %   cumulative   self              self     total
+ time   seconds   seconds    calls  ms/call  ms/call  name
+EOF
+
+j=0
+while [ $j -lt "$NROFCYCLES" ] ; do
+i=`printf "%.3d" $j`
+j=`expr $j + 1`
+  FN="${PRO}/${PREF}-${i}.txt"
+  echo >> $REP
+  echo >> $REP
+  echo $FN >> $REP
+  egrep "($MYFN|yyrestart)" $FN | grep -v '\[' >> $REP
+  grep 'receive_msg \[.\]' $FN | grep -v '\/' >> $REP
+  echo >> $REP
+  cat $PRO/${PREF}-${i}-time.txt >> $REP
+
+done
+
+cat >> $REP << EOF
+
+
+Execution environment:
+EOF
+cat /proc/cpuinfo /proc/meminfo >> $REP
+}
+
+if [ -z "$REPONLY" ] ; then
+	run
+fi
+report
+
+echo '*** finished ***'
+echo

+ 68 - 0
profile/profile.cfg

@@ -0,0 +1,68 @@
+# first sort out iptel.org requests from those destined somewhere else
+####################################################################################
+
+route[0] {
+# request for iptel.org with IP address in it ... fix it and proceed
+# note: may result in troubles as authentication covers URI
+uri=~"^sip:.*195\.37\.77\.101" rewritehost("iptel.org"); route(1);
+
+# request for iptel.org ... proceed
+uri=~"iptel.org" route(1);
+
+# requests to somewhere else
+# - REGISTERs denied
+method=="REGISTER" log("attempt to relay REGISTERs"); drop;
+
+# - anything else relayed via our outbound proxy
+uri=~"."  forward("benetnash.fokus.gmd.de", 9);
+}
+
+
+# iptel.org traffic
+####################################################################################
+
+route [1] {
+
+# recognize traffic we want to authenticate -- handled first to make sure 
+# it will be captured before we proceed to non-authenticating routes;
+# authentication for registrations or calls via Telekom which start
+# with optional + and 0
+
+#PROFILE
+(method=='REGISTER' | uri=~"sip:+?0[0-9]*@iptel\.org") forward("benetnash.fokus.gmd.de", 9);
+
+# dealing with voicemail 
+# we need to switch traffic to voicemail directly before CSPS
+# would screw it up -- it cannot deal with port numbers
+
+(uri=~'mail.iptel.org' | uri=~'iptel.org:6060' ) forward("benetnash.fokus.gmd.de", 9);
+
+# default route: go to non-authenicating proxy
+#PROFILE
+(method=~".")					forward("benetnash.fokus.gmd.de", 9 );
+
+}
+
+# We split traffic to authenticating and non-authenticating
+# SIP proxies here using sip_router. We only authenticate REGISTERs
+# and PSTN destinations, everything else is not authenticated.
+#
+# This is a work-around for CSPS's authenticate all-or-nothing
+# policy which would eliminate non-iptel.org users calling us.
+# Both proxies run at separate hosts (because they would otherwise
+# conflict with each other).
+#
+# I chose to put the non-authentication proxy on the public host
+# because we use it for outbound routing -- that would not work
+# if the proxy would be in non-routable realm. Drawback:
+# SQL and Cisco synchronization noise between dog and fox.
+# Note that this
+# leaves a non-authenticating port 5060 which could be misued
+# to steal REGISTERs. It would be perhaps a good idea to make
+# it available only for requests from sip_router.
+#
+#                        /--REGISTERs----dog:5061,w/auth
+#      iptel.org:5060---/                             ||   proprietary Cisco contact DB sharing
+#                        \                            ||   and MySQL
+#                        \---anything_else----iptel.org:5061,w/o/auth
+