summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--regress/sys/net/pflow/Makefile12
-rw-r--r--regress/sys/net/pflow/ifconfig.ok79
-rw-r--r--regress/sys/net/pflow/ifconfig.sh34
3 files changed, 124 insertions, 1 deletions
diff --git a/regress/sys/net/pflow/Makefile b/regress/sys/net/pflow/Makefile
index f1a8d263185..8f0e72e029c 100644
--- a/regress/sys/net/pflow/Makefile
+++ b/regress/sys/net/pflow/Makefile
@@ -1,4 +1,4 @@
-# $OpenBSD: Makefile,v 1.2 2013/08/23 08:25:57 florian Exp $
+# $OpenBSD: Makefile,v 1.3 2013/09/13 14:51:50 florian Exp $
#
# template_v{9,10}
# ----------------
@@ -20,8 +20,14 @@
# * wait for flow and compare it with known good flow
# * destroy pflow0
# * delete 10.11.12.13 and 2001:db8::13 from lo0
+#
+# ifconfig
+# --------
+# Take up pflow0 and test various combinations of flowdst, flowsrc and proto.
+# Destroy it in the end.
REGRESS_TARGETS=template_v9 template_v10 flow_9_4 flow_9_6 flow_10_4 flow_10_6
+REGRESS_TARGETS+=ifconfig
PROG= gen_traffic
LDADD= -levent
@@ -46,6 +52,10 @@ flow_10_6: gen_traffic
perl -I ${.CURDIR} ${.CURDIR}/flow.pl 10 6 \
| cmp -s ${.CURDIR}/flow.10_6 /dev/stdin
+ifconfig:
+ sh ${.CURDIR}/ifconfig.sh 2>&1 \
+ | cmp -s ${.CURDIR}/ifconfig.ok /dev/stdin
+
.PHONY: ${REGRESS_TARGETS}
.include <bsd.regress.mk>
diff --git a/regress/sys/net/pflow/ifconfig.ok b/regress/sys/net/pflow/ifconfig.ok
new file mode 100644
index 00000000000..f98376a58a0
--- /dev/null
+++ b/regress/sys/net/pflow/ifconfig.ok
@@ -0,0 +1,79 @@
+#### up
+pflow0: flags=1<UP> mtu 1492
+ priority: 0
+ pflow: sender: INVALID receiver: INVALID:INVALID version: 5
+ groups: pflow
+#### flowdst syntax error
+ifconfig: 127.0.0.1 bad value
+pflow0: flags=1<UP> mtu 1492
+ priority: 0
+ pflow: sender: INVALID receiver: INVALID:INVALID version: 5
+ groups: pflow
+#### invalid flowdst port
+pflow0: flags=1<UP> mtu 1492
+ priority: 0
+ pflow: sender: INVALID receiver: 127.0.0.1:INVALID version: 5
+ groups: pflow
+#### flowdst set, invalid flowsrc
+pflow0: flags=1<UP> mtu 1492
+ priority: 0
+ pflow: sender: INVALID receiver: 127.0.0.1:9996 version: 5
+ groups: pflow
+#### flowsrc and flowdst set
+pflow0: flags=41<UP,RUNNING> mtu 1492
+ priority: 0
+ pflow: sender: 127.0.0.1 receiver: 127.0.0.1:9996 version: 5
+ groups: pflow
+#### unset flowdst
+pflow0: flags=1<UP> mtu 1492
+ priority: 0
+ pflow: sender: 127.0.0.1 receiver: INVALID:INVALID version: 5
+ groups: pflow
+#### unset flowsrc
+pflow0: flags=1<UP> mtu 1492
+ priority: 0
+ pflow: sender: INVALID receiver: INVALID:INVALID version: 5
+ groups: pflow
+#### flowsrc and flowdst set one command
+pflow0: flags=41<UP,RUNNING> mtu 1492
+ priority: 0
+ pflow: sender: 127.0.0.1 receiver: 127.0.0.1:9996 version: 5
+ groups: pflow
+#### proto 9
+pflow0: flags=41<UP,RUNNING> mtu 1428
+ priority: 0
+ pflow: sender: 127.0.0.1 receiver: 127.0.0.1:9996 version: 9
+ groups: pflow
+#### proto 10
+pflow0: flags=41<UP,RUNNING> mtu 1448
+ priority: 0
+ pflow: sender: 127.0.0.1 receiver: 127.0.0.1:9996 version: 10
+ groups: pflow
+#### proto 5
+pflow0: flags=41<UP,RUNNING> mtu 1492
+ priority: 0
+ pflow: sender: 127.0.0.1 receiver: 127.0.0.1:9996 version: 5
+ groups: pflow
+#### syntax error proto
+ifconfig: Invalid pflow protocol: 23
+pflow0: flags=41<UP,RUNNING> mtu 1492
+ priority: 0
+ pflow: sender: 127.0.0.1 receiver: 127.0.0.1:9996 version: 5
+ groups: pflow
+#### flowdst 0.0.0.0:0; INVALID:INVALID
+pflow0: flags=1<UP> mtu 1492
+ priority: 0
+ pflow: sender: 127.0.0.1 receiver: INVALID:INVALID version: 5
+ groups: pflow
+#### flowdst 0.0.0.0:1234; INVALID:1234
+pflow0: flags=1<UP> mtu 1492
+ priority: 0
+ pflow: sender: 127.0.0.1 receiver: INVALID:1234 version: 5
+ groups: pflow
+#### flowsrc 0.0.0.0; INVALID
+pflow0: flags=1<UP> mtu 1492
+ priority: 0
+ pflow: sender: INVALID receiver: INVALID:1234 version: 5
+ groups: pflow
+#### destroy
+pflow0: no such interface
diff --git a/regress/sys/net/pflow/ifconfig.sh b/regress/sys/net/pflow/ifconfig.sh
new file mode 100644
index 00000000000..086f4155f33
--- /dev/null
+++ b/regress/sys/net/pflow/ifconfig.sh
@@ -0,0 +1,34 @@
+#! /bin/sh
+
+echo '#### up'
+ifconfig pflow0 up; ifconfig pflow0
+echo '#### flowdst syntax error'
+ifconfig pflow0 flowdst 127.0.0.1; ifconfig pflow0
+echo '#### invalid flowdst port'
+ifconfig pflow0 flowdst 127.0.0.1:0; ifconfig pflow0
+echo '#### flowdst set, invalid flowsrc'
+ifconfig pflow0 flowdst 127.0.0.1:9996; ifconfig pflow0
+echo '#### flowsrc and flowdst set'
+ifconfig pflow0 flowsrc 127.0.0.1; ifconfig pflow0
+echo '#### unset flowdst'
+ifconfig pflow0 -flowdst; ifconfig pflow0
+echo '#### unset flowsrc'
+ifconfig pflow0 -flowsrc; ifconfig pflow0
+echo '#### flowsrc and flowdst set one command'
+ifconfig pflow0 flowsrc 127.0.0.1 flowdst 127.0.0.1:9996; ifconfig pflow0
+echo '#### proto 9'
+ifconfig pflow0 pflowproto 9; ifconfig pflow0
+echo '#### proto 10'
+ifconfig pflow0 pflowproto 10; ifconfig pflow0
+echo '#### proto 5'
+ifconfig pflow0 pflowproto 5; ifconfig pflow0
+echo '#### syntax error proto'
+ifconfig pflow0 pflowproto 23; ifconfig pflow0
+echo '#### flowdst 0.0.0.0:0; INVALID:INVALID'
+ifconfig pflow0 flowdst 0.0.0.0:0; ifconfig pflow0
+echo '#### flowdst 0.0.0.0:1234; INVALID:1234'
+ifconfig pflow0 flowdst 0.0.0.0:1234; ifconfig pflow0
+echo '#### flowsrc 0.0.0.0; INVALID'
+ifconfig pflow0 flowsrc 0.0.0.0; ifconfig pflow0
+echo '#### destroy'
+ifconfig pflow0 destroy; ifconfig pflow0