Makefile (0709f979) Makefile (a91e3c70)
1# $OpenBSD: Makefile,v 1.8 2013/07/23 22:38:45 bluhm Exp $
1# $OpenBSD: Makefile,v 1.9 2013/10/31 01:24:06 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
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# Check wether all required python packages are installed. If some
10# are missing print a warning and skip the tests, but do not fail.
11PYTHON_IMPORT != python2.7 -c 'from scapy.all import *' 2>&1 || true
12.if ! empty(PYTHON_IMPORT)
13regress:
14 @echo '${PYTHON_IMPORT}'
15 @echo install python and the scapy module for additional tests
16.endif
17
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 disabled to test the IPv6 stack.
13# Enable echo udp6 in inetd.conf of DST to test UDP fragments.
14#
15# +---+ 1 +---+
16# |SRC| ----> |DST|
17# +---+ +---+
18# out in
19
20# Configure Addresses on the machines.
21# Adapt interface and addresse variables to your local setup.
22#
18# This test needs a manual setup of two machines
19# Set up machines: SRC DST
20# SRC is the machine where this makefile is running.
21# DST is running OpenBSD with pf disabled to test the IPv6 stack.
22# Enable echo udp6 in inetd.conf of DST to test UDP fragments.
23#
24# +---+ 1 +---+
25# |SRC| ----> |DST|
26# +---+ +---+
27# out in
28
29# Configure Addresses on the machines.
30# Adapt interface and addresse variables to your local setup.
31#
23SRC_IF = tun0
24SRC_MAC = fe:e1:ba:d1:56:1f
25DST_MAC = 52:54:00:12:34:50
32SRC_IF ?=
33SRC_MAC ?=
34DST_MAC ?=
26
35
27SRC_OUT6 = fdd7:e83e:66bc:211:fce1:baff:fed1:561f
28DST_IN6 = fdd7:e83e:66bc:211:5054:ff:fe12:3450
36SRC_OUT6 ?=
37DST_IN6 ?=
29
38
39.if empty (SRC_IF) || empty (SRC_MAC) || empty (DST_MAC) || \
40 empty (SRC_OUT6) || empty (DST_IN6)
41regress:
42 @echo this tests needs a remote machine to operate on
43 @echo SRC_IF SRC_MAC DST_MAC SRC_OUT6 DST_IN6 are empty
44 @echo fill out these variables for additional tests
45.endif
46
30depend: addr.py
31
32# Create python include file containing the addresses.
33addr.py: Makefile
34 rm -f $@ $@.tmp
35 echo 'SRC_IF = "${SRC_IF}"' >>$@.tmp
36 echo 'SRC_MAC = "${SRC_MAC}"' >>$@.tmp
37 echo 'DST_MAC = "${DST_MAC}"' >>$@.tmp
38.for var in SRC_OUT DST_IN
47depend: addr.py
48
49# Create python include file containing the addresses.
50addr.py: Makefile
51 rm -f $@ $@.tmp
52 echo 'SRC_IF = "${SRC_IF}"' >>$@.tmp
53 echo 'SRC_MAC = "${SRC_MAC}"' >>$@.tmp
54 echo 'DST_MAC = "${DST_MAC}"' >>$@.tmp
55.for var in SRC_OUT DST_IN
39 echo '${var} = "${${var}}"' >>$@.tmp
40 echo '${var}6 = "${${var}6}"' >>$@.tmp
41.endfor
42 mv $@.tmp $@
43
56 echo '${var}6 = "${${var}6}"' >>$@.tmp
57.endfor
58 mv $@.tmp $@
59
60# Set variables so that make runs with and without obj directory.
61# Only do that if necessary to keep visible output short.
62.if ${.CURDIR} == ${.OBJDIR}
63PYTHON = python2.7 ./
64.else
65PYTHON = PYTHONPATH=${.OBJDIR} python2.7 ${.CURDIR}/
66.endif
67
44# Ping all addresses. This ensures that the ip addresses are configured
45# and all routing table are set up to allow bidirectional packet flow.
46TARGETS += ping6
47run-regress-ping6:
48 @echo '\n======== $@ ========'
49.for ip in SRC_OUT DST_IN
50 @echo Check ping6 ${ip}6:
51 ping6 -n -c 1 ${${ip}6}

--- 9 unchanged lines hidden (view full) ---

61 ping6 -n -c 1 -s 5000 -m ${${ip}6}
62.endfor
63
64# Send hand-crafted fragmented packet
65TARGETS += frag6
66run-regress-frag6: addr.py
67 @echo '\n======== $@ ========'
68 @echo Check ping6 reassembly
68# Ping all addresses. This ensures that the ip addresses are configured
69# and all routing table are set up to allow bidirectional packet flow.
70TARGETS += ping6
71run-regress-ping6:
72 @echo '\n======== $@ ========'
73.for ip in SRC_OUT DST_IN
74 @echo Check ping6 ${ip}6:
75 ping6 -n -c 1 ${${ip}6}

--- 9 unchanged lines hidden (view full) ---

85 ping6 -n -c 1 -s 5000 -m ${${ip}6}
86.endfor
87
88# Send hand-crafted fragmented packet
89TARGETS += frag6
90run-regress-frag6: addr.py
91 @echo '\n======== $@ ========'
92 @echo Check ping6 reassembly
69 ${SUDO} python2.7 frag6.py
93 ${SUDO} ${PYTHON}frag6.py
70
71# An hop by hop options extension header before the fragment header
72TARGETS += frag6-ext
73run-regress-frag6-ext: addr.py
74 @echo '\n======== $@ ========'
75 @echo Check ping6 extension header reassembly
94
95# An hop by hop options extension header before the fragment header
96TARGETS += frag6-ext
97run-regress-frag6-ext: addr.py
98 @echo '\n======== $@ ========'
99 @echo Check ping6 extension header reassembly
76 ${SUDO} python2.7 frag6_ext.py
100 ${SUDO} ${PYTHON}frag6_ext.py
77
78# An destination options extension header after the fragment header
79TARGETS += frag6-opt
80run-regress-frag6-opt: addr.py
81 @echo '\n======== $@ ========'
82 @echo Check ping6 destination option reassembly
101
102# An destination options extension header after the fragment header
103TARGETS += frag6-opt
104run-regress-frag6-opt: addr.py
105 @echo '\n======== $@ ========'
106 @echo Check ping6 destination option reassembly
83 ${SUDO} python2.7 frag6_opt.py
107 ${SUDO} ${PYTHON}frag6_opt.py
84
85# fragmented packet with head overlapping first fragment
86TARGETS += frag6-overhead0
87run-regress-frag6-overhead0: addr.py
88 @echo '\n======== $@ ========'
89 @echo Check ping6 head overlapping first fragment
108
109# fragmented packet with head overlapping first fragment
110TARGETS += frag6-overhead0
111run-regress-frag6-overhead0: addr.py
112 @echo '\n======== $@ ========'
113 @echo Check ping6 head overlapping first fragment
90 ${SUDO} python2.7 frag6_overhead0.py
114 ${SUDO} ${PYTHON}frag6_overhead0.py
91
92# fragmented packet with head overlapping second fragment
93TARGETS += frag6-overhead
94run-regress-frag6-overhead: addr.py
95 @echo '\n======== $@ ========'
96 @echo Check ping6 head overlapping second fragment
115
116# fragmented packet with head overlapping second fragment
117TARGETS += frag6-overhead
118run-regress-frag6-overhead: addr.py
119 @echo '\n======== $@ ========'
120 @echo Check ping6 head overlapping second fragment
97 ${SUDO} python2.7 frag6_overhead.py
121 ${SUDO} ${PYTHON}frag6_overhead.py
98
99# fragmented packet with tail overlapping last fragment
100TARGETS += frag6-overtail
101run-regress-frag6-overtail: addr.py
102 @echo '\n======== $@ ========'
103 @echo Check ping6 tail overlapping last fragment
122
123# fragmented packet with tail overlapping last fragment
124TARGETS += frag6-overtail
125run-regress-frag6-overtail: addr.py
126 @echo '\n======== $@ ========'
127 @echo Check ping6 tail overlapping last fragment
104 ${SUDO} python2.7 frag6_overtail.py
128 ${SUDO} ${PYTHON}frag6_overtail.py
105
106# fragmented packet with overlap, drop future fragments
107TARGETS += frag6-overdrop
108run-regress-frag6-overdrop: addr.py
109 @echo '\n======== $@ ========'
110 @echo Check ping6 overlap drop future fragments
129
130# fragmented packet with overlap, drop future fragments
131TARGETS += frag6-overdrop
132run-regress-frag6-overdrop: addr.py
133 @echo '\n======== $@ ========'
134 @echo Check ping6 overlap drop future fragments
111 ${SUDO} python2.7 frag6_overdrop.py
135 ${SUDO} ${PYTHON}frag6_overdrop.py
112
113# fragmented packet with overlap, atomic fragment must be processed
114TARGETS += frag6-overatomic
115run-regress-frag6-overatomic: addr.py
116 @echo '\n======== $@ ========'
117 @echo Check ping6 overlapping and atomic fragments
136
137# fragmented packet with overlap, atomic fragment must be processed
138TARGETS += frag6-overatomic
139run-regress-frag6-overatomic: addr.py
140 @echo '\n======== $@ ========'
141 @echo Check ping6 overlapping and atomic fragments
118 ${SUDO} python2.7 frag6_overatomic.py
142 ${SUDO} ${PYTHON}frag6_overatomic.py
119
120# atomic fragment with short fragmented payload
121TARGETS += frag6-shortatomic
122run-regress-frag6-shortatomic: addr.py
123 @echo '\n======== $@ ========'
124 @echo Check ping6 short atomic fragments
143
144# atomic fragment with short fragmented payload
145TARGETS += frag6-shortatomic
146run-regress-frag6-shortatomic: addr.py
147 @echo '\n======== $@ ========'
148 @echo Check ping6 short atomic fragments
125 ${SUDO} python2.7 frag6_shortatomic.py
149 ${SUDO} ${PYTHON}frag6_shortatomic.py
126
127# fragmented packet permuted fragments
128TARGETS += frag6-permute
129run-regress-frag6-permute: addr.py
130 @echo '\n======== $@ ========'
131 @echo Check ping6 permuted fragments
150
151# fragmented packet permuted fragments
152TARGETS += frag6-permute
153run-regress-frag6-permute: addr.py
154 @echo '\n======== $@ ========'
155 @echo Check ping6 permuted fragments
132 ${SUDO} python2.7 frag6_permute.py
156 ${SUDO} ${PYTHON}frag6_permute.py
133
134# fragmented packet with zero length first fragment
135TARGETS += frag6-zerofirst
136run-regress-frag6-zerofirst: addr.py
137 @echo '\n======== $@ ========'
138 @echo Check ping6 zero length first fragment
157
158# fragmented packet with zero length first fragment
159TARGETS += frag6-zerofirst
160run-regress-frag6-zerofirst: addr.py
161 @echo '\n======== $@ ========'
162 @echo Check ping6 zero length first fragment
139 ${SUDO} python2.7 frag6_zerofirst.py
163 ${SUDO} ${PYTHON}frag6_zerofirst.py
140
141# fragmented packet with zero length second fragment
142TARGETS += frag6-zerosecond
143run-regress-frag6-zerosecond: addr.py
144 @echo '\n======== $@ ========'
145 @echo Check ping6 zero length second fragment
164
165# fragmented packet with zero length second fragment
166TARGETS += frag6-zerosecond
167run-regress-frag6-zerosecond: addr.py
168 @echo '\n======== $@ ========'
169 @echo Check ping6 zero length second fragment
146 ${SUDO} python2.7 frag6_zerosecond.py
170 ${SUDO} ${PYTHON}frag6_zerosecond.py
147
148# atomic fragmented udp packet
149TARGETS += frag6-udpatomic
150run-regress-frag6-udpatomic: addr.py
151 @echo '\n======== $@ ========'
152 @echo Check ping6 atomic udp fragment
171
172# atomic fragmented udp packet
173TARGETS += frag6-udpatomic
174run-regress-frag6-udpatomic: addr.py
175 @echo '\n======== $@ ========'
176 @echo Check ping6 atomic udp fragment
153 ${SUDO} python2.7 frag6_udpatomic.py
177 ${SUDO} ${PYTHON}frag6_udpatomic.py
154
155# fragmented udp packet after header
156TARGETS += frag6-udpheader
157run-regress-frag6-udpheader: addr.py
158 @echo '\n======== $@ ========'
159 @echo Check ping6 udp header fragment
178
179# fragmented udp packet after header
180TARGETS += frag6-udpheader
181run-regress-frag6-udpheader: addr.py
182 @echo '\n======== $@ ========'
183 @echo Check ping6 udp header fragment
160 ${SUDO} python2.7 frag6_udpheader.py
184 ${SUDO} ${PYTHON}frag6_udpheader.py
161
162# fragmented udp packet within payload
163TARGETS += frag6-udppayload
164run-regress-frag6-udppayload: addr.py
165 @echo '\n======== $@ ========'
166 @echo Check ping6 udp payload fragment
185
186# fragmented udp packet within payload
187TARGETS += frag6-udppayload
188run-regress-frag6-udppayload: addr.py
189 @echo '\n======== $@ ========'
190 @echo Check ping6 udp payload fragment
167 ${SUDO} python2.7 frag6_udppayload.py
191 ${SUDO} ${PYTHON}frag6_udppayload.py
168
169# fragmented icmp packet not within 60 second timeout, test takes 90 seconds
170TARGETS += frag6-timeout
171run-regress-frag6-timeout: addr.py
172 @echo '\n======== $@ ========'
173 @echo Check ping6 fragment timeout
192
193# fragmented icmp packet not within 60 second timeout, test takes 90 seconds
194TARGETS += frag6-timeout
195run-regress-frag6-timeout: addr.py
196 @echo '\n======== $@ ========'
197 @echo Check ping6 fragment timeout
174 ${SUDO} python2.7 frag6_timeout.py
198 ${SUDO} ${PYTHON}frag6_timeout.py
175
176REGRESS_TARGETS = ${TARGETS:S/^/run-regress-/}
177
178CLEANFILES += addr.py *.pyc *.log
179
180.include <bsd.regress.mk>
199
200REGRESS_TARGETS = ${TARGETS:S/^/run-regress-/}
201
202CLEANFILES += addr.py *.pyc *.log
203
204.include <bsd.regress.mk>