1# $OpenBSD: Makefile,v 1.11 2023/10/19 18:36:40 anton Exp $ 2 3# The following ports must be installed: 4# 5# scapy powerful interactive packet manipulation in python 6 7RTABLE ?= 1 8PAIR1 ?= pair1 9PAIR2 ?= pair2 10CTR_SOCK ?= /dev/slaacd.sock 11 12.if ! (make(clean) || make(cleandir) || make(obj)) 13# Check whether all required python packages are installed. If some 14# are missing print a warning and skip the tests, but do not fail. 15AUTOCONF6 != sh -c "ifconfig | fgrep AUTOCONF6 2>&1" || true 16INTERFACES != sh -c "ifconfig ${PAIR1} 2>/dev/null; \ 17 ifconfig ${PAIR2} 2>/dev/null" || true 18.endif 19 20.if ! exists(/usr/local/bin/scapy) 21regress: 22 @echo Install scapy package to run this regress. 23 @echo SKIPPED 24.endif 25 26.if ! empty(AUTOCONF6) 27regress: 28 @echo 'AUTOCONF6 interface(s) already present' 29 @echo SKIPPED 30.endif 31.if ! empty(INTERFACES) 32regress: 33 @echo 'pair(4) interfaces already present' 34 @echo SKIPPED 35.endif 36 37# Set variables so that make runs with and without obj directory. 38# Only do that if necessary to keep visible output short. 39.if ${.CURDIR} == ${.OBJDIR} 40PYTHON = python3 -B -u ./ 41.else 42PYTHON = python3 -B -u ${.CURDIR}/ 43.endif 44 45REGRESS_SETUP += setup 46setup: cleanup 47 ${SUDO} ifconfig ${PAIR1} rdomain ${RTABLE} 10.11.12.1/24 up 48 ${SUDO} ifconfig ${PAIR2} rdomain ${RTABLE} 10.11.12.2/24 up 49 ${SUDO} ifconfig ${PAIR1} rdomain ${RTABLE} patch ${PAIR2} 50 ${SUDO} ifconfig ${PAIR1} inet6 rdomain ${RTABLE} eui64 51 ${SUDO} ifconfig ${PAIR2} inet6 rdomain ${RTABLE} eui64 52 ${SUDO} ifconfig ${PAIR2} inet6 rdomain ${RTABLE} autoconf 53 ${SUDO} route -nq -T ${RTABLE} add -host default 10.11.12.1 -reject 54 55REGRESS_CLEANUP += cleanup 56cleanup: 57.for iface in ${PAIR1} ${PAIR2} lo${RTABLE} 58 ${SUDO} ifconfig ${iface} destroy 2>/dev/null || true 59.endfor 60 61REGRESS_TARGETS += run-send-solicitation 62run-send-solicitation: 63 ${SUDO} route -T${RTABLE} exec ${PYTHON}sniff_sol.py ${CTR_SOCK} 64 65 66REGRESS_TARGETS += run-parse-ra 67run-parse-ra: 68 ${SUDO} route -T${RTABLE} exec ${PYTHON}process_ra.py \ 69 ${PAIR1} ${PAIR2} ${CTR_SOCK} 70 71.include <bsd.regress.mk> 72