summaryrefslogtreecommitdiff
path: root/regress/sys/netinet6/srcaddr/Makefile
blob: 7669fea30af38557a43fc943ef944b0d3ea3ef48 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# $OpenBSD: Makefile,v 1.2 2020/12/16 22:59:55 bluhm Exp $

RTABLE		?=	1
VETHER		?=	vether1
PROG		=	srcaddr
VETHER_LL	=	${VETHER}_ll
REXEC		=	route -T ${RTABLE} exec

CLEANFILES	+=	${VETHER_LL}

.if ! (make(clean) || make(cleandir) || make(obj))
INTERFACES != sh -c "ifconfig ${VETHER} 2>/dev/null" || true
.endif

.if ! empty(INTERFACES)
regress:
	@echo 'vether(4) interfaces already present'
	@echo SKIPPED
.endif

REGRESS_SETUP +=	setup
setup: cleanup
	${SUDO} ifconfig ${VETHER} inet6 rdomain ${RTABLE} eui64 up
	sh -c "ifconfig ${VETHER} | awk '/inet6/ {print \$$2}' > ${VETHER_LL}"
	${SUDO} ifconfig lo${RTABLE} inet rdomain ${RTABLE} 127.0.0.1/8 up
	${SUDO} ifconfig lo${RTABLE} inet6 rdomain ${RTABLE} eui64

REGRESS_CLEANUP +=	cleanup
cleanup:
.for iface in ${VETHER} lo${RTABLE}
	${SUDO} ifconfig ${iface} destroy 2>/dev/null || true
.endfor

REGRESS_SETUP +=	${PROG}

REGRESS_TARGETS +=	run-localhost
run-localhost:
	${REXEC} ./srcaddr ::1 | \
	    diff -up ${.CURDIR}/localhost.ok /dev/stdin

REGRESS_TARGETS +=	run-linklocal
run-linklocal:
	${REXEC} ./srcaddr fe80::1%${VETHER} | \
	    diff -up ${VETHER_LL} /dev/stdin

.include <bsd.regress.mk>