summaryrefslogtreecommitdiff
path: root/fw/test
diff options
context:
space:
mode:
Diffstat (limited to 'fw/test')
-rwxr-xr-xfw/test/fwtest.rc34
1 files changed, 33 insertions, 1 deletions
diff --git a/fw/test/fwtest.rc b/fw/test/fwtest.rc
index 0325bfd..3f80242 100755
--- a/fw/test/fwtest.rc
+++ b/fw/test/fwtest.rc
@@ -46,7 +46,7 @@ mkdir -p $mtpt
# The stacks the packet checks build for themselves. Fixed numbers are
# fine because they are unbound again at the end of each block, and the
# last check proves it.
-stacks=(20 21 22 23 24 25 26)
+stacks=(20 21 22 23 24 25 26 27 28)
# A port of our own. Conversations outlive the run that made them - a
# devip Conv is never freed - so a fixed port makes one run's leftovers
@@ -551,6 +551,38 @@ echo '== a card'
}
}
+echo '== supervision'
+# fw daemonizes, like every other Plan 9 file server: the process you
+# exec posts to /srv, forks the server and exits. A supervisor watches
+# the /srv name instead of the pid, so the name has to mean what it
+# says - present exactly while the firewall is filtering.
+@{
+ rfork n
+ mkdir -p $tmp/nD $tmp/nE $tmp/sctl
+ bind -a '#I27' $tmp/nD
+ bind -a '#I28' $tmp/nE
+ $fw -s fw.test.$pid -m $tmp/sctl $tmp/empty.ndb \
+ $tmp/nD^'!'^10.9.9.1^'!'^/24 $tmp/nE^'!'^10.9.9.2^'!'^/24 >[2]/dev/null
+ check 'the process that starts it exits, as a file server does' '' $"status
+ sleep 2
+
+ r=`{if(test -e /srv/fw.test.^$pid) echo yes; if not echo no}
+ check 'and leaves its name in /srv' yes $"r
+ r=`{ls $tmp/sctl | wc -l}
+ check 'with the control files mounted' 4 $"r
+
+ # what a supervisor would restart on. Taking the control
+ # filesystem away used to end the server proc and leave the relays
+ # filtering: a firewall nobody could reach, stop, or notice.
+ unmount $tmp/sctl
+ rm /srv/fw.test.$pid
+ sleep 3
+ r=`{ps | awk '$NF == "fw"' | wc -l}
+ check 'losing the control filesystem stops the whole firewall' 0 $"r
+ r=`{sed 1q $tmp/nD/ipifc/0/status | awk '{print $2}'}
+ check 'and the interface it made goes with it' maxtu $"r
+}
+
echo '== fwstart'
if(test -f $lib/fwstart)
@{