xref: /openbsd-src/regress/sys/netinet6/srcaddr/Makefile (revision 44e35349da9ebb313cc9a2780e50f022a53bc8ad)
1# $OpenBSD: Makefile,v 1.2 2020/12/16 22:59:55 bluhm Exp $
2
3RTABLE		?=	1
4VETHER		?=	vether1
5PROG		=	srcaddr
6VETHER_LL	=	${VETHER}_ll
7REXEC		=	route -T ${RTABLE} exec
8
9CLEANFILES	+=	${VETHER_LL}
10
11.if ! (make(clean) || make(cleandir) || make(obj))
12INTERFACES != sh -c "ifconfig ${VETHER} 2>/dev/null" || true
13.endif
14
15.if ! empty(INTERFACES)
16regress:
17	@echo 'vether(4) interfaces already present'
18	@echo SKIPPED
19.endif
20
21REGRESS_SETUP +=	setup
22setup: cleanup
23	${SUDO} ifconfig ${VETHER} inet6 rdomain ${RTABLE} eui64 up
24	sh -c "ifconfig ${VETHER} | awk '/inet6/ {print \$$2}' > ${VETHER_LL}"
25	${SUDO} ifconfig lo${RTABLE} inet rdomain ${RTABLE} 127.0.0.1/8 up
26	${SUDO} ifconfig lo${RTABLE} inet6 rdomain ${RTABLE} eui64
27
28REGRESS_CLEANUP +=	cleanup
29cleanup:
30.for iface in ${VETHER} lo${RTABLE}
31	${SUDO} ifconfig ${iface} destroy 2>/dev/null || true
32.endfor
33
34REGRESS_SETUP +=	${PROG}
35
36REGRESS_TARGETS +=	run-localhost
37run-localhost:
38	${REXEC} ./srcaddr ::1 | \
39	    diff -up ${.CURDIR}/localhost.ok /dev/stdin
40
41REGRESS_TARGETS +=	run-linklocal
42run-linklocal:
43	${REXEC} ./srcaddr fe80::1%${VETHER} | \
44	    diff -up ${VETHER_LL} /dev/stdin
45
46.include <bsd.regress.mk>
47