Module Name: src
Committed By: pooka
Date: Mon Mar 29 02:11:15 UTC 2010
Modified Files:
src/share/examples/rump/virtual_ip_router: README.txt
Added Files:
src/share/examples/rump/virtual_ip_router: startrouters.sh
Log Message:
amazing grep, how sweet the find
that saved a hack like me
script once was lost but now it's found
was -x, but now I sh
To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/share/examples/rump/virtual_ip_router/README.txt
cvs rdiff -u -r0 -r1.1 \
src/share/examples/rump/virtual_ip_router/startrouters.sh
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/share/examples/rump/virtual_ip_router/README.txt
diff -u src/share/examples/rump/virtual_ip_router/README.txt:1.1 src/share/examples/rump/virtual_ip_router/README.txt:1.2
--- src/share/examples/rump/virtual_ip_router/README.txt:1.1 Mon Mar 29 02:01:47 2010
+++ src/share/examples/rump/virtual_ip_router/README.txt Mon Mar 29 02:11:14 2010
@@ -1,4 +1,4 @@
- $NetBSD: README.txt,v 1.1 2010/03/29 02:01:47 pooka Exp $
+ $NetBSD: README.txt,v 1.2 2010/03/29 02:11:14 pooka Exp $
Using rump it is possible to build a router test setup consisting
of thousands of NetBSD IP stacks within a single host OS, one
@@ -92,8 +92,7 @@
./a.out 10.0.253.1 10.0.253.255 /tmp/rumpshm_253 10.0.253.2 10.0.255.1 10.0.255.
255 /tmp/rumpshm_255 0
-Unfortunately I lost script used to produce that, but the algorithm
-is quickly obvious.
+(see startrouters.sh for a script to produce that output)
Easy but slightly more interesting setups, such as a M^N matrix
(hyper-matrix?) are also possible, but left as an exercise to the
Added files:
Index: src/share/examples/rump/virtual_ip_router/startrouters.sh
diff -u /dev/null src/share/examples/rump/virtual_ip_router/startrouters.sh:1.1
--- /dev/null Mon Mar 29 02:11:15 2010
+++ src/share/examples/rump/virtual_ip_router/startrouters.sh Mon Mar 29 02:11:14 2010
@@ -0,0 +1,68 @@
+#!/bin/sh
+#
+# $NetBSD: startrouters.sh,v 1.1 2010/03/29 02:11:14 pooka Exp $
+#
+
+dummy=
+amp="&"
+LIF="10.0.XXX.1"
+LBCAST="10.0.XXX.255"
+LFILE="/tmp/rumpshm_XXX"
+LROUTE="10.0.XXX.2"
+
+RIF="10.0.YYY.2"
+RBCAST="10.0.YYY.255"
+RFILE="/tmp/rumpshm_YYY"
+RROUTE="10.0.YYY.1"
+
+die ()
+{
+
+ echo $1
+ exit 1
+}
+
+[ $# != "1" ] && die "usage: script.sh nrouters"
+n=${1}
+
+[ "$n" -lt "1" ] && die "n must be between 1 and 254"
+[ "$n" -gt "254" ] && die "n must be between 1 and 254"
+
+pkill a.out
+rm /tmp/rumpshm_*
+rm -f cmds
+
+i=1
+ip=0
+while [ ${i} -le ${n} ]
+do
+ lif=`echo ${LIF} | sed "s/XXX/${ip}/"`
+ lbcast=`echo ${LBCAST} | sed "s/XXX/${ip}/"`
+ lfile=`echo ${LFILE} | sed "s/XXX/${ip}/"`
+ lroute=`echo ${LROUTE} | sed "s/XXX/${ip}/"`
+
+ rif=`echo ${RIF} | sed "s/YYY/${i}/"`
+ rbcast=`echo ${RBCAST} | sed "s/YYY/${i}/"`
+ rfile=`echo ${RFILE} | sed "s/YYY/${i}/"`
+ rroute=`echo ${RROUTE} | sed "s/YYY/${i}/"`
+
+ if [ $i = 1 ]
+ then
+ lroute="0"
+ fi
+
+ if [ $i = $n ]
+ then
+ rif="10.0.255.1"
+ rbcast="10.0.255.255"
+ rfile="/tmp/rumpshm_255"
+ rroute="0"
+ fi
+
+ echo ./a.out ${lif} ${lbcast} ${lfile} ${lroute} ${rif} ${rbcast} ${rfile} ${rroute} >> cmds
+
+ ip=${i}
+ i=$((i+1))
+done
+
+#echo ./specialpint send tcp 10.0.255.10 >> cmds