summaryrefslogtreecommitdiff
path: root/fw/test
diff options
context:
space:
mode:
Diffstat (limited to 'fw/test')
-rwxr-xr-xfw/test/fwtest.rc16
1 files changed, 13 insertions, 3 deletions
diff --git a/fw/test/fwtest.rc b/fw/test/fwtest.rc
index bd7423d..a7267ed 100755
--- a/fw/test/fwtest.rc
+++ b/fw/test/fwtest.rc
@@ -333,6 +333,8 @@ if(! test -f /sys/log/fw){
chmod 666 /sys/log/fw
madelog=yes
}
+logdeny=`{grep -c 'deny tcp connect 127.0.0.2!'^$port^': denied by rule 1' /sys/log/fw}
+logallow=`{grep -c 'allow tcp connect 127.0.0.1!'^$port /sys/log/fw}
@{
rfork n
{
@@ -345,10 +347,18 @@ if(! test -f /sys/log/fw){
wr /net/tcp/clone 'connect 127.0.0.1!'^$port >/dev/null
}
sleep 1
-# the port is this run's, so the whole file can be searched
-r=`{grep -c 'deny tcp connect 127.0.0.2!'^$port^': denied by rule 1' /sys/log/fw}
+# Differences, not totals. This asked for a total on the grounds that
+# the port belonged to this run, and the port is 17000 + pid%900 while
+# the log keeps every run there has ever been: 30 entries over 900
+# ports collides about two times in five, and it duly did, on the
+# second run of a pair. Nothing that reads an accumulating file may
+# ask it for a total - that is the third check in this suite to learn
+# it, after the fragment count and the listen log.
+after=`{grep -c 'deny tcp connect 127.0.0.2!'^$port^': denied by rule 1' /sys/log/fw}
+r=`{echo $logdeny $after | awk '{print $2 - $1}'}
check 'a denied connection is logged, with the rule that said so' 1 $"r
-r=`{grep -c 'allow tcp connect 127.0.0.1!'^$port /sys/log/fw}
+after=`{grep -c 'allow tcp connect 127.0.0.1!'^$port /sys/log/fw}
+r=`{echo $logallow $after | awk '{print $2 - $1}'}
check 'and a permitted one, when the rule asks' 1 $"r
if(~ $madelog yes)
rm -f /sys/log/fw