xref: /openbsd/regress/sys/netinet6/nd6/Makefile (revision cca36db2)
1#	$OpenBSD: Makefile,v 1.1 2012/01/31 00:14:02 bluhm Exp $
2
3# The following ports must be installed:
4#
5# python-2.7          interpreted object-oriented programming language
6# py-libdnet          python interface to libdnet
7# scapy               powerful interactive packet manipulation in python
8
9# This test needs a manual setup of two machines
10# Set up machines: SRC DST
11# SRC is the machine where this makefile is running.
12# DST is running OpenBSD with pf to test the neighbor discovery states.
13#
14# +---+   1   +---+
15# |SRC| ----> |DST|
16# +---+       +---+
17#     out    in
18
19# Configure Addresses on the machines.
20# Adapt interface and addresse variables to your local setup.
21#
22SRC_IF =	tun0
23SRC_MAC =	fe:e1:ba:d1:56:1f
24DST_MAC =	52:54:00:12:34:50
25
26SRC_OUT6 =	fdd7:e83e:66bc:211:fce1:baff:fed1:561f
27DST_IN6 =	fdd7:e83e:66bc:211:5054:ff:fe12:3450
28
29# pf rules on DST should look like this:
30#
31# block log
32# pass inet6 proto icmp6 icmp6-type echoreq keep state
33# pass inet6 proto icmp6 icmp6-type neighbrsol keep state
34# pass inet6 proto icmp6 icmp6-type neighbradv keep state
35
36# RFC 4861 7. describes the following test cases for ND:
37#
38# Duplicate Address Detection
39# - request  NS from unspecified address to target solicitated-node multicast
40# - response NA from interface address   to all-nodes multicast
41#
42# Address Resolution
43# - request  NS from interface address   to target solicitated-node multicast
44# - response NA from interface address   to source of NS
45#
46# Unsolicited Neighbor Advertisements
47# - request  NA from interface address   to all-nodes multicast
48#
49# Neighbor Unreachability Detection
50# - request  NS from interface address   to target unicast
51# - response NA from interface address   to source of NS
52
53depend: addr.py
54
55# Create python include file containing the addresses.
56addr.py: Makefile
57	rm -f $@ $@.tmp
58	echo 'SRC_IF = "${SRC_IF}"' >>$@.tmp
59	echo 'SRC_MAC = "${SRC_MAC}"' >>$@.tmp
60	echo 'DST_MAC = "${DST_MAC}"' >>$@.tmp
61.for var in SRC_OUT DST_IN
62	echo '${var} = "${${var}}"' >>$@.tmp
63	echo '${var}6 = "${${var}6}"' >>$@.tmp
64.endfor
65	mv $@.tmp $@
66
67# Clear neighbor cache and ping all addresses.  This ensures that
68# the ip addresses are configured and all routing table are set up
69# to allow bidirectional packet flow.
70TARGETS +=	ping6
71run-regress-ping6:
72	@echo '\n======== $@ ========'
73	sudo ndp -c
74.for ip in SRC_OUT DST_IN
75	@echo Check ping6 ${ip}6:
76	ping6 -n -c 1 ${${ip}6}
77.endfor
78
79# Send hand-crafted duplicate address detection neighbor solicitation packet
80TARGETS +=	nd6_dad
81run-regress-nd6_dad: addr.py
82	@echo '\n======== $@ ========'
83	@echo Check duplicate address detection
84	${SUDO} python2.7 nd6_dad.py
85
86# Send hand-crafted address resolution neighbor solicitation packet
87TARGETS +=	nd6_ar
88run-regress-nd6_ar: addr.py
89	@echo '\n======== $@ ========'
90	@echo Check address resolution
91	${SUDO} python2.7 nd6_ar.py
92
93# Send hand-crafted unsolicited neighbor advertisement packet
94TARGETS +=	nd6_una
95run-regress-nd6_una: addr.py
96	@echo '\n======== $@ ========'
97	@echo Check unsolicited neighbor advertisement
98	${SUDO} python2.7 nd6_una.py
99
100# Send hand-crafted neighbor unreachability detection solicitation packet
101TARGETS +=	nd6_nud
102run-regress-nd6_nud: addr.py
103	@echo '\n======== $@ ========'
104	@echo Check neighbor unreachability detection
105	${SUDO} python2.7 nd6_nud.py
106
107REGRESS_TARGETS =	${TARGETS:S/^/run-regress-/}
108
109CLEANFILES +=		addr.py *.pyc *.log
110
111.include <bsd.regress.mk>
112