The diff add regress scripts for vxlan(4) and etherip(4).
This will be my first commit to regress/. ok?
diff --git a/regress/sys/net/Makefile b/regress/sys/net/Makefile
index 40f49cc..f46c3dd 100644
--- a/regress/sys/net/Makefile
+++ b/regress/sys/net/Makefile
@@ -1,5 +1,6 @@
# $OpenBSD: Makefile,v 1.9 2016/09/21 10:40:39 mpi Exp $
-SUBDIR += pf_divert pf_forward pf_fragment pf_print rdomains rtable
+SUBDIR += etherip pf_divert pf_forward pf_fragment pf_print rdomains
+SUBDIR += rtable
.include <bsd.subdir.mk>
diff --git a/regress/sys/net/etherip/Makefile b/regress/sys/net/etherip/Makefile
new file mode 100644
index 0000000..dd18c5f
--- /dev/null
+++ b/regress/sys/net/etherip/Makefile
@@ -0,0 +1,9 @@
+# $OpenBSD$
+
+REGRESS_TARGETS= etherip_1
+REGRESS_ROOT_TARGETS= etherip_1
+
+etherip_1:
+ ${SUDO} ksh [email protected]
+
+.include <bsd.regress.mk>
diff --git a/regress/sys/net/etherip/etherip_1.sh
b/regress/sys/net/etherip/etherip_1.sh
new file mode 100644
index 0000000..8c08129
--- /dev/null
+++ b/regress/sys/net/etherip/etherip_1.sh
@@ -0,0 +1,78 @@
+#!/bin/ksh
+# $OpenBSD$
+
+
+cleanup()
+{
+ for if in $ALL_IFS; do
+ ifconfig $if destroy 2>/dev/null
+ done
+}
+
+. ./etherip_subr
+
+# rdomains
+RD1=11
+RD2=12
+
+# interface minor numbers
+IFNO1=11
+IFNO2=12
+
+ALL_IFS="bridge$IFNO2 bridge$IFNO1 vether$IFNO2 vether$IFNO1 etherip$IFNO2
+ etherip$IFNO1 pair$IFNO2 pair$IFNO1"
+
+#
+# Check pre-conditions
+#
+# etherip is enabled by sysctl?
+VAL=$(sysctl -n net.inet.etherip.allow)
+VAL=${VAL:-0}
+if [ $VAL -eq 0 ]; then
+ echo "Aborted. Disabled etherip by sysctl net.inet.etherip.allow" >&2
+ exit 255
+fi
+# interfaces are busy?
+for if in $ALL_IFS; do
+ if iface_exists $if; then
+ echo "Aborted. interface \`$if' is used already." >&2
+ exit 255
+ fi
+done
+# rdomains are busy?
+for rt in $RD1 $RD2; do
+ if ! rdomain_is_used $rt; then
+ echo "Aborted. rdomain \`$rt' is used already." >&2
+ exit 255
+ fi
+done
+
+#
+# Prepeare the test
+#
+[ $VERBOSE -gt 0 ] && set -x
+ifconfig pair$IFNO1 rdomain $RD1 172.31.0.1/24
+ifconfig pair$IFNO2 rdomain $RD2 172.31.0.2/24 patch pair$IFNO1
+ifconfig vether$IFNO1 rdomain $RD1 192.168.0.1
+ifconfig vether$IFNO2 rdomain $RD2 192.168.0.2
+ifconfig etherip$IFNO1 rdomain $RD1 tunneldomain $RD1 || abort_test
+ifconfig etherip$IFNO2 rdomain $RD2 tunneldomain $RD2 || abort_test
+ifconfig bridge$IFNO1 rdomain $RD1 add vether$IFNO1 add etherip$IFNO1 up
+ifconfig bridge$IFNO2 rdomain $RD2 add vether$IFNO2 add etherip$IFNO2 up
+
+#
+# Test config
+#
+ifconfig etherip$IFNO1 tunnel 172.31.0.1 172.31.0.2 up || abort_test
+ifconfig etherip$IFNO2 tunnel 172.31.0.2 172.31.0.1 up || abort_test
+
+#
+# Test behavior
+#
+test ping -w 1 -c 1 -V $RD1 192.168.0.2
+test ping -w 1 -c 1 -V $RD2 192.168.0.1
+set +x
+
+# Done
+cleanup
+exit $FAILS
diff --git a/regress/sys/net/etherip/etherip_subr
b/regress/sys/net/etherip/etherip_subr
new file mode 100644
index 0000000..82e03ef
--- /dev/null
+++ b/regress/sys/net/etherip/etherip_subr
@@ -0,0 +1,67 @@
+#
+# Copyright (c) 2015 Vincent Gross <[email protected]>
+#
+# Permission to use, copy, modify, and distribute this software for any
+# purpose with or without fee is hereby granted, provided that the above
+# copyright notice and this permission notice appear in all copies.
+#
+# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+VERBOSE=0
+FAILS=0
+
+iface_exists()
+{
+ ifconfig_out=`ifconfig "$1" 2>&1`
+ [ "${ifconfig_out}" != "$1: no such interface" ]
+}
+
+rdomain_is_used()
+{
+ _rdomains=$(ifconfig | sed -n '/^[a-z].* rdomain \([0-9]*\).*/s//\1/p' \
+ | sort | uniq)
+ for _r in $_rdomains; do
+ if [ $_r = $1 ]; then
+ return 1
+ fi
+ done
+ return 0
+}
+
+abort_test()
+{
+ echo "** Aborted" >&2
+ [ $# -ge 0 ] && echo "$1" >&2
+ cleanup
+ exit 1
+}
+
+test()
+{
+ if [ $VERBOSE -gt 0 ]; then
+ "$@"
+ else
+ "$@" > /dev/null 2>&1
+ fi
+ if [ $? -ne 0 ]; then
+ FAILS=$((FAILS + 1))
+ fi
+}
+
+while getopts 'v' ch $@; do
+ case $ch in
+ v)
+ VERBOSE=$((VERBOSE + 1))
+ ;;
+ *)
+ echo "usage: $(basename $0) [-v]"
+ exit 64
+ ;;
+ esac
+done
diff --git a/regress/sys/net/vxlan/Makefile b/regress/sys/net/vxlan/Makefile
new file mode 100644
index 0000000..33d9c6c
--- /dev/null
+++ b/regress/sys/net/vxlan/Makefile
@@ -0,0 +1,9 @@
+# $OpenBSD$
+
+REGRESS_TARGETS= vxlan_1
+REGRESS_ROOT_TARGETS= vxlan_1
+
+vxlan_1:
+ ${SUDO} ksh [email protected]
+
+.include <bsd.regress.mk>
diff --git a/regress/sys/net/vxlan/vxlan_1.sh b/regress/sys/net/vxlan/vxlan_1.sh
new file mode 100644
index 0000000..00f372d
--- /dev/null
+++ b/regress/sys/net/vxlan/vxlan_1.sh
@@ -0,0 +1,72 @@
+#!/bin/ksh
+# $OpenBSD$
+
+
+cleanup()
+{
+ for if in $ALL_IFS; do
+ ifconfig $if destroy 2>/dev/null
+ done
+}
+
+. ./vxlan_subr
+
+# rdomains
+RD1=11
+RD2=12
+
+# interface minor numbers
+IFNO1=11
+IFNO2=12
+
+ALL_IFS="bridge$IFNO2 bridge$IFNO1 vether$IFNO2 vether$IFNO1 vxlan$IFNO2
+ vxlan$IFNO1 pair$IFNO2 pair$IFNO1"
+
+[ $CLEANUP -gt 0 ] && cleanup
+#
+# Check pre-conditions
+#
+# interfaces are busy?
+for if in $ALL_IFS; do
+ if iface_exists $if; then
+ echo "Aborted. interface \`$if' is used already." >&2
+ exit 255
+ fi
+done
+# rdomains are busy?
+for rt in $RD1 $RD2; do
+ if ! rdomain_is_used $rt; then
+ echo "Aborted. rdomain \`$rt' is used already." >&2
+ exit 255
+ fi
+done
+
+#
+# Prepeare the test
+#
+[ $VERBOSE -gt 0 ] && set -x
+ifconfig pair$IFNO1 rdomain $RD1 172.31.0.1/24
+ifconfig pair$IFNO2 rdomain $RD2 172.31.0.2/24 patch pair$IFNO1
+ifconfig vether$IFNO1 rdomain $RD1 192.168.0.1
+ifconfig vether$IFNO2 rdomain $RD2 192.168.0.2
+ifconfig vxlan$IFNO1 rdomain $RD1 tunneldomain $RD1 || abort_test
+ifconfig vxlan$IFNO2 rdomain $RD2 tunneldomain $RD2 || abort_test
+ifconfig bridge$IFNO1 rdomain $RD1 add vether$IFNO1 add vxlan$IFNO1 up
+ifconfig bridge$IFNO2 rdomain $RD2 add vether$IFNO2 add vxlan$IFNO2 up
+
+#
+# Test config
+#
+ifconfig vxlan$IFNO1 tunnel 172.31.0.1 172.31.0.2 vnetid 100 up || abort_test
+ifconfig vxlan$IFNO2 tunnel 172.31.0.2 172.31.0.1 vnetid 100 up || abort_test
+
+#
+# Test behavior
+#
+test ping -w 1 -c 1 -V $RD1 192.168.0.2
+test ping -w 1 -c 1 -V $RD2 192.168.0.1
+set +x
+
+# Done
+cleanup
+exit $FAILS
diff --git a/regress/sys/net/vxlan/vxlan_subr b/regress/sys/net/vxlan/vxlan_subr
new file mode 100644
index 0000000..c423f3e
--- /dev/null
+++ b/regress/sys/net/vxlan/vxlan_subr
@@ -0,0 +1,71 @@
+#
+# Copyright (c) 2015 Vincent Gross <[email protected]>
+#
+# Permission to use, copy, modify, and distribute this software for any
+# purpose with or without fee is hereby granted, provided that the above
+# copyright notice and this permission notice appear in all copies.
+#
+# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+CLEANUP=0
+VERBOSE=0
+FAILS=0
+
+iface_exists()
+{
+ ifconfig_out=`ifconfig "$1" 2>&1`
+ [ "${ifconfig_out}" != "$1: no such interface" ]
+}
+
+rdomain_is_used()
+{
+ _rdomains=$(ifconfig | sed -n '/^[a-z].* rdomain \([0-9]*\).*/s//\1/p' \
+ | sort | uniq)
+ for _r in $_rdomains; do
+ if [ $_r = $1 ]; then
+ return 1
+ fi
+ done
+ return 0
+}
+
+abort_test()
+{
+ echo "** Aborted" >&2
+ [ $# -ge 0 ] && echo "$1" >&2
+ cleanup
+ exit 1
+}
+
+test()
+{
+ if [ $VERBOSE -gt 0 ]; then
+ "$@"
+ else
+ "$@" > /dev/null 2>&1
+ fi
+ if [ $? -ne 0 ]; then
+ FAILS=$((FAILS + 1))
+ fi
+}
+
+while getopts 'cv' ch $@; do
+ case $ch in
+ c)
+ CLEANUP=1
+ ;;
+ v)
+ VERBOSE=$((VERBOSE + 1))
+ ;;
+ *)
+ echo "usage: $(basename $0) [-cv]"
+ exit 64
+ ;;
+ esac
+done