diff options
author | Florian Obser <florian@cvs.openbsd.org> | 2017-08-25 17:02:14 +0000 |
---|---|---|
committer | Florian Obser <florian@cvs.openbsd.org> | 2017-08-25 17:02:14 +0000 |
commit | fb139b80769abcdc7160c7207cbde905fc23d698 (patch) | |
tree | 2189f8fb25be00bcbf9e614b33714ab3b9b2cf8d /regress/sbin/slaacd/Makefile | |
parent | 9d25993e28af1e2bfac861dadfbbaa60107f745e (diff) |
regress for slaacd(8); not yet hooked to the build
Diffstat (limited to 'regress/sbin/slaacd/Makefile')
-rw-r--r-- | regress/sbin/slaacd/Makefile | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/regress/sbin/slaacd/Makefile b/regress/sbin/slaacd/Makefile new file mode 100644 index 00000000000..6c33e066884 --- /dev/null +++ b/regress/sbin/slaacd/Makefile @@ -0,0 +1,75 @@ +# $OpenBSD: Makefile,v 1.1 2017/08/25 17:02:13 florian Exp $ + +# The following ports must be installed: +# +# python-2.7 interpreted object-oriented programming language +# scapy powerful interactive packet manipulation in python + +RTABLE ?= 1 +PAIR1 ?= pair1 +PAIR2 ?= pair2 +CTR_SOCK ?= ${.OBJDIR}/slaacd.sock + +.if ! (make(clean) || make(cleandir) || make(obj)) +# Check whether all required python packages are installed. If some +# are missing print a warning and skip the tests, but do not fail. +PYTHON_IMPORT != python2.7 -c 'from scapy.all import *' 2>&1 || true +AUTOCONF6 != sh -c "ifconfig | fgrep AUTOCONF6 2>&1" || true +INTERFACES != sh -c "ifconfig ${PAIR1} 2>/dev/null; \ + ifconfig ${PAIR2} 2>/dev/null" || true +.endif + +.if ! empty(PYTHON_IMPORT) +regress: + @echo '${PYTHON_IMPORT}' + @echo install python and the scapy module for additional tests + @echo SKIPPED +.endif + +.if ! empty(AUTOCONF6) +regress: + @echo 'AUTOCONF6 interface(s) already present' + @echo SKIPPED +.endif +.if ! empty(INTERFACES) +regress: + @echo 'pair(4) interfaces already present' + @echo SKIPPED +.endif + +# Set variables so that make runs with and without obj directory. +# Only do that if necessary to keep visible output short. +.if ${.CURDIR} == ${.OBJDIR} +PYTHON = python2.7 ./ +.else +PYTHON = python2.7 ${.CURDIR}/ +.endif + +setup: + @ifconfig ${PAIR1} rdomain ${RTABLE} 10.11.12.1/24 up + @ifconfig ${PAIR2} rdomain ${RTABLE} 10.11.12.2/24 up + @ifconfig ${PAIR1} rdomain ${RTABLE} patch ${PAIR2} + @ifconfig ${PAIR1} inet6 rdomain ${RTABLE} eui64 + @ifconfig ${PAIR2} inet6 rdomain ${RTABLE} eui64 + @ifconfig ${PAIR2} inet6 rdomain ${RTABLE} autoconf + @route -nq -T ${RTABLE} add -host default 10.11.12.1 -reject + @route -T ${RTABLE} exec slaacd -s ${CTR_SOCK} + +cleanup: + @pkill -T ${RTABLE} -xf "slaacd -s ${CTR_SOCK}" || true +.for iface in ${PAIR1} ${PAIR2} + @ifconfig ${iface} destroy 2>/dev/null || true +.endfor + +TARGETS += send-solicitation +run-regress-send-solicitation: cleanup setup + @echo '\n======== $@ ========' + @route -T${RTABLE} exec ${PYTHON}sniff_sol.py ${CTR_SOCK} + +TARGETS += cleanup +run-regress-cleanup: cleanup + @echo '\n======== $@ ========' + +REGRESS_TARGETS = ${TARGETS:S/^/run-regress-/} + +.include <bsd.regress.mk> |