summaryrefslogtreecommitdiff
path: root/sbin
diff options
context:
space:
mode:
authorHakan Olsson <ho@cvs.openbsd.org>2002-06-17 12:23:32 +0000
committerHakan Olsson <ho@cvs.openbsd.org>2002-06-17 12:23:32 +0000
commit7313fede1500f9660f65efe8061f26991aa94a9b (patch)
treeded40fa56008445060416c59cee5268d3991a8f0 /sbin
parent5d681d40220f58cbcd19bf1e99767d7262243003 (diff)
A bit better. Remove debug cruft.
Diffstat (limited to 'sbin')
-rw-r--r--sbin/isakmpd/samples/singlehost-setup.sh34
1 files changed, 24 insertions, 10 deletions
diff --git a/sbin/isakmpd/samples/singlehost-setup.sh b/sbin/isakmpd/samples/singlehost-setup.sh
index aaa57702edc..3be2f40014a 100644
--- a/sbin/isakmpd/samples/singlehost-setup.sh
+++ b/sbin/isakmpd/samples/singlehost-setup.sh
@@ -1,5 +1,5 @@
#!/bin/sh
-# $OpenBSD: singlehost-setup.sh,v 1.3 2002/06/12 21:32:43 ho Exp $
+# $OpenBSD: singlehost-setup.sh,v 1.4 2002/06/17 12:23:31 ho Exp $
# $EOM: singlehost-setup.sh,v 1.3 2000/11/23 12:24:43 niklas Exp $
# A script to test single-host VPNs
@@ -12,6 +12,13 @@ PF_CONF=/etc/pf.conf
PFCTL=/sbin/pfctl
ISAKMPD=/sbin/isakmpd
+do_routes()
+{
+ /sbin/route $1 -net 192.168.11.0/24 192.168.11.1 -iface >/dev/null
+ /sbin/route $1 -net 192.168.12.0/24 192.168.12.1 -iface >/dev/null
+ /sbin/route $1 -net 10.1.0.0/16 10.1.0.11 -iface >/dev/null
+}
+
# Called on script exit
cleanup () {
if [ "X${pf}" = "xYES" -a -f ${PF_CONF} ]; then
@@ -24,9 +31,11 @@ cleanup () {
chown $USER singlehost-east.conf singlehost-west.conf policy
chmod 644 singlehost-east.conf singlehost-west.conf policy
- [ -f east.pid ] && kill `cat east.pid`
- [ -f west.pid ] && kill `cat west.pid`
- rm -f east.pid west.pid east.fifo west.fifo
+ [ -p east.fifo ] && echo "Q" >> east.fifo
+ [ -p west.fifo ] && echo "Q" >> west.fifo
+ rm -f east.fifo west.fifo
+
+ do_routes delete
}
# Start by initializing interfaces
@@ -34,6 +43,8 @@ cleanup () {
/sbin/ifconfig lo3 192.168.12.1 netmask 0xffffff00 up
/sbin/ifconfig lo4 10.1.0.11 netmask 0xffff0000 up
/sbin/ifconfig lo5 10.1.0.12 netmask 0xffff0000 up
+# ... and by adding the required routes
+do_routes add
# Add rules
(
@@ -50,7 +61,7 @@ EOF
else
pfctl -qe >/dev/null
fi
-) | tee /tmp/aa | pfctl -R -f -
+) | pfctl -R -f -
trap cleanup 1 2 3 15
@@ -60,12 +71,15 @@ chown $USER singlehost-east.conf singlehost-west.conf policy
chmod 600 singlehost-east.conf singlehost-west.conf policy
# Start the daemons
-rm -f east.pid west.pid east.fifo west.fifo
-${ISAKMPD} -c singlehost-east.conf -f east.fifo -i east.pid "$@"
-${ISAKMPD} -c singlehost-west.conf -f west.fifo -i west.pid "$@"
+rm -f east.fifo west.fifo
+${ISAKMPD} -c singlehost-east.conf -f east.fifo "$@"
+${ISAKMPD} -c singlehost-west.conf -f west.fifo "$@"
# Give them some time to negotiate their stuff...
-sleep 10
-ping -I 192.168.11.1 -c 30 192.168.12.1
+SECS=3
+echo "Waiting $SECS seconds..."
+sleep $SECS
+echo "Running 'ping', using the tunnel..."
+ping -I 192.168.11.1 -c 5 192.168.12.1
cleanup