xref: /openbsd-src/regress/usr.bin/snmp/Makefile (revision 92c6079fadf96e1babcde0781194afc3f678ff01)
1# $OpenBSD: Makefile,v 1.5 2022/09/02 07:07:45 martijn Exp $
2
3SNMP?=			/usr/bin/snmp
4SNMPD?=			/usr/sbin/snmpd -f ${.OBJDIR}/snmpd.conf
5
6SNMPGET?=		${SNMP} get
7SNMPGETNEXT?=		${SNMP} getnext
8SNMPBULKGET?=		${SNMP}	bulkget
9SNMPWALK?=		${SNMP} walk
10SNMPBULKWALK?=		${SNMP} bulkwalk
11SNMPSET?=		${SNMP} set
12SNMPTRAP?=		${SNMP} trap
13
14REGRESS_ROOT_TARGETS=	start stop
15REGRESS_SETUP_ONCE=	start
16REGRESS_TARGETS=
17REGRESS_CLEANUP=	stop
18REGRESS_SKIP_TARGETS=
19CLEANFILES=
20
21IFIDX!=			ifconfig egress | awk '/index/{print $$2}'
22IFLLADDR!=		ifconfig egress | awk '/lladdr/{gsub(":", " ", $$2); print toupper($$2)}'
23
24CLEANFILES+=		snmpd.conf
25snmpd.conf: Makefile
26	printf 'listen_addr="127.0.0.1"\n' > snmpd.conf
27	printf 'listen6_addr="::1"\n\n' >> snmpd.conf
28	printf '# Restrict daemon to listen on localhost only\n' >> snmpd.conf
29	printf 'listen on $$listen_addr snmpv1 snmpv2c snmpv3\n' >> snmpd.conf
30	printf 'listen on tcp $$listen_addr snmpv1 snmpv2c snmpv3\n' >> snmpd.conf
31	printf 'listen on $$listen6_addr snmpv1 snmpv2c snmpv3\n' >> snmpd.conf
32	printf 'listen on tcp $$listen6_addr snmpv1 snmpv2c snmpv3\n' >> snmpd.conf
33	printf 'listen on $$listen_addr notify snmpv1 snmpv2c snmpv3\n\n' >> snmpd.conf
34	printf 'read-only community public\n' >> snmpd.conf
35	printf 'read-write community private\n' >> snmpd.conf
36	printf 'trap community public\n\n' >> snmpd.conf
37	printf '# (ab)use sysContact for DisplayString (255a) testing\n' >> snmpd.conf
38	printf 'system contact "Reyk Fl\303\266ter"\n' >> snmpd.conf
39	printf 'system services 74\n\n' >> snmpd.conf
40	printf '# Provide static user-defined SNMP OIDs\n' >> snmpd.conf
41	printf 'oid 1.3.6.1.4.1.30155.42.3.1 name testStringValue read-only string "Test"\n' >> snmpd.conf
42	printf 'oid 1.3.6.1.4.1.30155.42.3.2 name testStringValue read-only string "abcdefghijklmnopqrstuvwxyz"\n' >> snmpd.conf
43	printf 'oid 1.3.6.1.4.1.30155.42.3.3 name testIntValue read-write string a\n' >> snmpd.conf
44	printf 'oid 1.3.6.1.4.1.30155.42.3.4 name testIntValue read-write integer 1\n' >> snmpd.conf
45	printf '# (ab)use usmUserName for SnmpAdminString (255t) tests\n' >> snmpd.conf
46	printf 'oid 1.3.6.1.6.3.15.1.2.2.1.2.1 name testStringValue read-only string "Reyk Fl\303\266ter"\n' >> snmpd.conf
47	printf 'oid 1.3.6.1.6.3.15.1.2.2.1.2.2 name testStringValue read-only string "Reyk Fl\303ter"\n' >> snmpd.conf
48	printf "# 256 a's\n" >> snmpd.conf
49	printf 'oid 1.3.6.1.6.3.15.1.2.2.1.2.3 name testStringValue read-only string "%s"\n' "$$(jot -ba 256 | tr -d '\n')" >> snmpd.conf
50	printf "# 254 a's + replacement character\n" >> snmpd.conf
51	printf 'oid 1.3.6.1.6.3.15.1.2.2.1.2.4 name testStringValue read-only string "%s\357\277\275"\n\n' "$$(jot -ba 254 | tr -d '\n')" >> snmpd.conf
52	printf '# Enable SNMPv3 USM with authentication, encryption and two defined users\n' >> snmpd.conf
53	printf 'seclevel none\n\n' >> snmpd.conf
54	printf 'user md5_des authkey testtest auth hmac-md5 enckey testtest enc des\n' >> snmpd.conf
55	printf 'user md5_aes authkey testtest auth hmac-md5 enckey testtest enc aes\n' >> snmpd.conf
56	printf 'user sha1_des authkey testtest auth hmac-sha1 enckey testtest enc des\n' >> snmpd.conf
57	printf 'user sha1_aes authkey testtest auth hmac-sha1 enckey testtest enc aes\n' >> snmpd.conf
58	printf 'user sha224_des authkey testtest auth hmac-sha224 enckey testtest enc des\n' >> snmpd.conf
59	printf 'user sha224_aes authkey testtest auth hmac-sha224 enckey testtest enc aes\n' >> snmpd.conf
60	printf 'user sha256_des authkey testtest auth hmac-sha256 enckey testtest enc des\n' >> snmpd.conf
61	printf 'user sha256_aes authkey testtest auth hmac-sha256 enckey testtest enc aes\n' >> snmpd.conf
62	printf 'user sha384_des authkey testtest auth hmac-sha384 enckey testtest enc des\n' >> snmpd.conf
63	printf 'user sha384_aes authkey testtest auth hmac-sha384 enckey testtest enc aes\n' >> snmpd.conf
64	printf 'user sha512_des authkey testtest auth hmac-sha512 enckey testtest enc des\n' >> snmpd.conf
65	printf 'user sha512_aes authkey testtest auth hmac-sha512 enckey testtest enc aes\n\n' >> snmpd.conf
66	printf 'trap handle 1.3 "${.OBJDIR}/traphandle.sh"\n' >> snmpd.conf
67
68CLEANFILES+=		traphandle.sh
69traphandle.sh: Makefile
70	printf '#!/bin/sh\n\n' > traphandle.sh
71	printf 'while read line; do\n' >> traphandle.sh
72	printf '\tprintf "%%s\\n" "$$line" >> ${.OBJDIR}/trap_output\n' >> traphandle.sh
73	printf 'done\n' >> traphandle.sh
74	chmod +x traphandle.sh
75
76CLEANFILES+=		trap_output
77trap_output: Makefile
78	touch trap_output
79	chmod a+rw trap_output
80
81start: stop snmpd.conf traphandle.sh trap_output
82	${SUDO} ${SNMPD}
83
84stop:
85	-${SUDO} pkill -xf "${SNMPD}"
86
87### AGENT FORMAT
88
89REGRESS_TARGETS+=	agent_udp_v4
90CLEANFILES+=		agent_udp_v4.res agent_udp_v4.exp
91agent_udp_v4:
92	printf "sysServices.0 = INTEGER: 74\n" > $@.exp
93	${SNMPGET} -v2c -cpublic udp:127.0.0.1 sysServices.0 > $@.res
94	diff -up $@.exp $@.res
95
96REGRESS_TARGETS+=	agent_udp_v4_port
97CLEANFILES+=		agent_udp_v4_port.res agent_udp_v4_port.exp
98agent_udp_v4_port:
99	printf "sysServices.0 = INTEGER: 74\n" > $@.exp
100	${SNMPGET} -v2c -cpublic udp:127.0.0.1:161 sysServices.0 > $@.res
101	diff -up $@.exp $@.res
102
103REGRESS_TARGETS+=	agent_udp_v4_service
104CLEANFILES+=		agent_udp_v4_service.res agent_udp_v4_service.exp
105agent_udp_v4_service:
106	printf "sysServices.0 = INTEGER: 74\n" > $@.exp
107	${SNMPGET} -v2c -cpublic udp:127.0.0.1:snmp sysServices.0 > $@.res
108	diff -up $@.exp $@.res
109
110REGRESS_TARGETS+=	agent_v4_port
111CLEANFILES+=		agent_v4_port.res agent_v4_port.exp
112agent_v4_port:
113	printf "sysServices.0 = INTEGER: 74\n" > $@.exp
114	${SNMPGET} -v2c -cpublic 127.0.0.1:161 sysServices.0 > $@.res
115	diff -up $@.exp $@.res
116
117REGRESS_TARGETS+=	agent_v4_service
118CLEANFILES+=		agent_v4_service.res agent_v4_service.exp
119agent_v4_service:
120	printf "sysServices.0 = INTEGER: 74\n" > $@.exp
121	${SNMPGET} -v2c -cpublic 127.0.0.1:snmp sysServices.0 > $@.res
122	diff -up $@.exp $@.res
123
124REGRESS_TARGETS+=	agent_tcp_v4
125CLEANFILES+=		agent_tcp_v4.res agent_tcp_v4.exp
126agent_tcp_v4:
127	printf "sysServices.0 = INTEGER: 74\n" > $@.exp
128	${SNMPGET} -v2c -cpublic tcp:127.0.0.1 sysServices.0 > $@.res
129	diff -up $@.exp $@.res
130
131REGRESS_TARGETS+=	agent_tcp_v4_port
132CLEANFILES+=		agent_tcp_v4_port.res agent_tcp_v4_port.exp
133agent_tcp_v4_port:
134	printf "sysServices.0 = INTEGER: 74\n" > $@.exp
135	${SNMPGET} -v2c -cpublic tcp:127.0.0.1:161 sysServices.0 > $@.res
136	diff -up $@.exp $@.res
137
138REGRESS_TARGETS+=	agent_udp_udp6plain
139CLEANFILES+=		agent_udp_udp6plain.res agent_udp_udp6plain.exp
140agent_udp_udp6plain:
141	printf "sysServices.0 = INTEGER: 74\n" > $@.exp
142	${SNMPGET} -v2c -cpublic udp6:::1:snmp sysServices.0 > $@.res
143	diff -up $@.exp $@.res
144
145REGRESS_TARGETS+=	agent_udp_udp6bracket
146CLEANFILES+=		agent_udp_udp6bracket.res agent_udp_udp6bracket.exp
147agent_udp_udp6bracket:
148	printf "sysServices.0 = INTEGER: 74\n" > $@.exp
149	${SNMPGET} -v2c -cpublic udp6:[::1] sysServices.0 > $@.res
150	diff -up $@.exp $@.res
151
152REGRESS_TARGETS+=	agent_udp_udp6bracket_port
153CLEANFILES+=		agent_udp_udp6bracket_port.res agent_udp_udp6bracket_port.exp
154agent_udp_udp6bracket_port:
155	printf "sysServices.0 = INTEGER: 74\n" > $@.exp
156	${SNMPGET} -v2c -cpublic udp6:[::1]:snmp sysServices.0 > $@.res
157	diff -up $@.exp $@.res
158
159REGRESS_TARGETS+=	agent_udp_UDP6plain
160CLEANFILES+=		agent_udp_UDP6plain.res agent_udp_UDP6plain.exp
161agent_udp_UDP6plain:
162	printf "sysServices.0 = INTEGER: 74\n" > $@.exp
163	${SNMPGET} -v2c -cpublic UDP6:::1:snmp sysServices.0 > $@.res
164	diff -up $@.exp $@.res
165
166REGRESS_TARGETS+=	agent_udp_UDP6bracket
167CLEANFILES+=		agent_udp_UDP6bracket.res agent_udp_UDP6bracket.exp
168agent_udp_UDP6bracket:
169	printf "sysServices.0 = INTEGER: 74\n" > $@.exp
170	${SNMPGET} -v2c -cpublic UDP6:[::1] sysServices.0 > $@.res
171	diff -up $@.exp $@.res
172
173REGRESS_TARGETS+=	agent_udp_UDP6bracket_port
174CLEANFILES+=		agent_udp_UDP6bracket_port.res agent_udp_UDP6bracket_port.exp
175agent_udp_UDP6bracket_port:
176	printf "sysServices.0 = INTEGER: 74\n" > $@.exp
177	${SNMPGET} -v2c -cpublic UDP6:[::1]:snmp sysServices.0 > $@.res
178	diff -up $@.exp $@.res
179
180REGRESS_TARGETS+=	agent_udp_udpv6plain
181CLEANFILES+=		agent_udp_udpv6plain.res agent_udp_udpv6plain.exp
182agent_udp_udpv6plain:
183	printf "sysServices.0 = INTEGER: 74\n" > $@.exp
184	${SNMPGET} -v2c -cpublic udpv6:::1:snmp sysServices.0 > $@.res
185	diff -up $@.exp $@.res
186
187REGRESS_TARGETS+=	agent_udp_udpv6bracket
188CLEANFILES+=		agent_udp_udpv6bracket.res agent_udp_udpv6bracket.exp
189agent_udp_udpv6bracket:
190	printf "sysServices.0 = INTEGER: 74\n" > $@.exp
191	${SNMPGET} -v2c -cpublic udpv6:[::1] sysServices.0 > $@.res
192	diff -up $@.exp $@.res
193
194REGRESS_TARGETS+=	agent_udp_udpv6bracket_port
195CLEANFILES+=		agent_udp_udpv6bracket_port.res agent_udp_udpv6bracket_port.exp
196agent_udp_udpv6bracket_port:
197	printf "sysServices.0 = INTEGER: 74\n" > $@.exp
198	${SNMPGET} -v2c -cpublic udpv6:[::1]:snmp sysServices.0 > $@.res
199	diff -up $@.exp $@.res
200
201REGRESS_TARGETS+=	agent_udp_UDPv6plain
202CLEANFILES+=		agent_udp_UDPv6plain.res agent_udp_UDPv6plain.exp
203agent_udp_UDPv6plain:
204	printf "sysServices.0 = INTEGER: 74\n" > $@.exp
205	${SNMPGET} -v2c -cpublic UDPv6:::1:snmp sysServices.0 > $@.res
206	diff -up $@.exp $@.res
207
208REGRESS_TARGETS+=	agent_udp_UDPv6bracket
209CLEANFILES+=		agent_udp_UDPv6bracket.res agent_udp_UDPv6bracket.exp
210agent_udp_UDPv6bracket:
211	printf "sysServices.0 = INTEGER: 74\n" > $@.exp
212	${SNMPGET} -v2c -cpublic UDPv6:[::1] sysServices.0 > $@.res
213	diff -up $@.exp $@.res
214
215REGRESS_TARGETS+=	agent_udp_UDPv6bracket_port
216CLEANFILES+=		agent_udp_UDPv6bracket_port.res agent_udp_UDPv6bracket_port.exp
217agent_udp_UDPv6bracket_port:
218	printf "sysServices.0 = INTEGER: 74\n" > $@.exp
219	${SNMPGET} -v2c -cpublic UDPv6:[::1]:snmp sysServices.0 > $@.res
220	diff -up $@.exp $@.res
221
222REGRESS_TARGETS+=	agent_udp_udpipv6plain
223CLEANFILES+=		agent_udp_udpipv6plain.res agent_udp_udpipv6plain.exp
224agent_udp_udpipv6plain:
225	printf "sysServices.0 = INTEGER: 74\n" > $@.exp
226	${SNMPGET} -v2c -cpublic udpipv6:::1:snmp sysServices.0 > $@.res
227	diff -up $@.exp $@.res
228
229REGRESS_TARGETS+=	agent_udp_udpipv6bracket
230CLEANFILES+=		agent_udp_udpipv6bracket.res agent_udp_udpipv6bracket.exp
231agent_udp_udpipv6bracket:
232	printf "sysServices.0 = INTEGER: 74\n" > $@.exp
233	${SNMPGET} -v2c -cpublic udpipv6:[::1] sysServices.0 > $@.res
234	diff -up $@.exp $@.res
235
236REGRESS_TARGETS+=	agent_udp_udpipv6bracket_port
237CLEANFILES+=		agent_udp_udpipv6bracket_port.res agent_udp_udpipv6bracket_port.exp
238agent_udp_udpipv6bracket_port:
239	printf "sysServices.0 = INTEGER: 74\n" > $@.exp
240	${SNMPGET} -v2c -cpublic udpipv6:[::1]:snmp sysServices.0 > $@.res
241	diff -up $@.exp $@.res
242
243REGRESS_TARGETS+=	agent_udp_UDPIPv6plain
244CLEANFILES+=		agent_udp_UDPIPv6plain.res agent_udp_UDPIPv6plain.exp
245agent_udp_UDPIPv6plain:
246	printf "sysServices.0 = INTEGER: 74\n" > $@.exp
247	${SNMPGET} -v2c -cpublic UDPIPv6:::1:snmp sysServices.0 > $@.res
248	diff -up $@.exp $@.res
249
250REGRESS_TARGETS+=	agent_udp_UDPIPv6bracket
251CLEANFILES+=		agent_udp_UDPIPv6bracket.res agent_udp_UDPIPv6bracket.exp
252agent_udp_UDPIPv6bracket:
253	printf "sysServices.0 = INTEGER: 74\n" > $@.exp
254	${SNMPGET} -v2c -cpublic UDPIPv6:[::1] sysServices.0 > $@.res
255	diff -up $@.exp $@.res
256
257REGRESS_TARGETS+=	agent_udp_UDPIPv6bracket_port
258CLEANFILES+=		agent_udp_UDPIPv6bracket_port.res agent_udp_UDPIPv6bracket_port.exp
259agent_udp_UDPIPv6bracket_port:
260	printf "sysServices.0 = INTEGER: 74\n" > $@.exp
261	${SNMPGET} -v2c -cpublic UDPIPv6:[::1]:snmp sysServices.0 > $@.res
262	diff -up $@.exp $@.res
263
264REGRESS_TARGETS+=	agent_tcp_tcp6plain
265CLEANFILES+=		agent_tcp_tcp6plain.res agent_tcp_tcp6plain.exp
266agent_tcp_tcp6plain:
267	printf "sysServices.0 = INTEGER: 74\n" > $@.exp
268	${SNMPGET} -v2c -cpublic tcp6:::1:161 sysServices.0 > $@.res
269	diff -up $@.exp $@.res
270
271REGRESS_TARGETS+=	agent_tcp_tcp6bracket
272CLEANFILES+=		agent_tcp_tcp6bracket.res agent_tcp_tcp6bracket.exp
273agent_tcp_tcp6bracket:
274	printf "sysServices.0 = INTEGER: 74\n" > $@.exp
275	${SNMPGET} -v2c -cpublic tcp6:[::1] sysServices.0 > $@.res
276	diff -up $@.exp $@.res
277
278REGRESS_TARGETS+=	agent_tcp_tcp6bracket_port
279CLEANFILES+=		agent_tcp_tcp6bracket_port.res agent_tcp_tcp6bracket_port.exp
280agent_tcp_tcp6bracket_port:
281	printf "sysServices.0 = INTEGER: 74\n" > $@.exp
282	${SNMPGET} -v2c -cpublic tcp6:[::1]:161 sysServices.0 > $@.res
283	diff -up $@.exp $@.res
284
285REGRESS_TARGETS+=	agent_tcp_TCP6plain
286CLEANFILES+=		agent_tcp_TCP6plain.res agent_tcp_TCP6plain.exp
287agent_tcp_TCP6plain:
288	printf "sysServices.0 = INTEGER: 74\n" > $@.exp
289	${SNMPGET} -v2c -cpublic TCP6:::1:161 sysServices.0 > $@.res
290	diff -up $@.exp $@.res
291
292REGRESS_TARGETS+=	agent_tcp_TCP6bracket
293CLEANFILES+=		agent_tcp_TCP6bracket.res agent_tcp_TCP6bracket.exp
294agent_tcp_TCP6bracket:
295	printf "sysServices.0 = INTEGER: 74\n" > $@.exp
296	${SNMPGET} -v2c -cpublic TCP6:[::1] sysServices.0 > $@.res
297	diff -up $@.exp $@.res
298
299REGRESS_TARGETS+=	agent_tcp_TCP6bracket_port
300CLEANFILES+=		agent_tcp_TCP6bracket_port.res agent_tcp_TCP6bracket_port.exp
301agent_tcp_TCP6bracket_port:
302	printf "sysServices.0 = INTEGER: 74\n" > $@.exp
303	${SNMPGET} -v2c -cpublic TCP6:[::1]:161 sysServices.0 > $@.res
304	diff -up $@.exp $@.res
305
306REGRESS_TARGETS+=	agent_tcp_tcpv6plain
307CLEANFILES+=		agent_tcp_tcpv6plain.res agent_tcp_tcpv6plain.exp
308agent_tcp_tcpv6plain:
309	printf "sysServices.0 = INTEGER: 74\n" > $@.exp
310	${SNMPGET} -v2c -cpublic tcpv6:::1:161 sysServices.0 > $@.res
311	diff -up $@.exp $@.res
312
313REGRESS_TARGETS+=	agent_tcp_tcpv6bracket
314CLEANFILES+=		agent_tcp_tcpv6bracket.res agent_tcp_tcpv6bracket.exp
315agent_tcp_tcpv6bracket:
316	printf "sysServices.0 = INTEGER: 74\n" > $@.exp
317	${SNMPGET} -v2c -cpublic tcpv6:[::1] sysServices.0 > $@.res
318	diff -up $@.exp $@.res
319
320REGRESS_TARGETS+=	agent_tcp_tcpv6bracket_port
321CLEANFILES+=		agent_tcp_tcpv6bracket_port.res agent_tcp_tcpv6bracket_port.exp
322agent_tcp_tcpv6bracket_port:
323	printf "sysServices.0 = INTEGER: 74\n" > $@.exp
324	${SNMPGET} -v2c -cpublic tcpv6:[::1]:161 sysServices.0 > $@.res
325	diff -up $@.exp $@.res
326
327REGRESS_TARGETS+=	agent_tcp_TCPv6plain
328CLEANFILES+=		agent_tcp_TCPv6plain.res agent_tcp_TCPv6plain.exp
329agent_tcp_TCPv6plain:
330	printf "sysServices.0 = INTEGER: 74\n" > $@.exp
331	${SNMPGET} -v2c -cpublic TCPv6:::1:161 sysServices.0 > $@.res
332	diff -up $@.exp $@.res
333
334REGRESS_TARGETS+=	agent_tcp_TCPv6bracket
335CLEANFILES+=		agent_tcp_TCPv6bracket.res agent_tcp_TCPv6bracket.exp
336agent_tcp_TCPv6bracket:
337	printf "sysServices.0 = INTEGER: 74\n" > $@.exp
338	${SNMPGET} -v2c -cpublic TCPv6:[::1] sysServices.0 > $@.res
339	diff -up $@.exp $@.res
340
341REGRESS_TARGETS+=	agent_tcp_TCPv6bracket_port
342CLEANFILES+=		agent_tcp_TCPv6bracket_port.res agent_tcp_TCPv6bracket_port.exp
343agent_tcp_TCPv6bracket_port:
344	printf "sysServices.0 = INTEGER: 74\n" > $@.exp
345	${SNMPGET} -v2c -cpublic TCPv6:[::1]:161 sysServices.0 > $@.res
346	diff -up $@.exp $@.res
347
348REGRESS_TARGETS+=	agent_tcp_TCPv6bracket_port
349CLEANFILES+=		agent_tcp_TCPv6bracket_port.res agent_tcp_TCPv6bracket_port.exp
350agent_tcp_tcpipv6plain:
351	printf "sysServices.0 = INTEGER: 74\n" > $@.exp
352	${SNMPGET} -v2c -cpublic tcpipv6:::1:161 sysServices.0 > $@.res
353	diff -up $@.exp $@.res
354
355REGRESS_TARGETS+=	agent_tcp_tcpipv6bracket
356CLEANFILES+=		agent_tcp_tcpipv6bracket.res agent_tcp_tcpipv6bracket.exp
357agent_tcp_tcpipv6bracket:
358	printf "sysServices.0 = INTEGER: 74\n" > $@.exp
359	${SNMPGET} -v2c -cpublic tcpipv6:[::1] sysServices.0 > $@.res
360	diff -up $@.exp $@.res
361
362REGRESS_TARGETS+=	agent_tcp_tcpipv6bracket_port
363CLEANFILES+=		agent_tcp_tcpipv6bracket_port.res agent_tcp_tcpipv6bracket_port.exp
364agent_tcp_tcpipv6bracket_port:
365	printf "sysServices.0 = INTEGER: 74\n" > $@.exp
366	${SNMPGET} -v2c -cpublic tcpipv6:[::1]:161 sysServices.0 > $@.res
367	diff -up $@.exp $@.res
368
369REGRESS_TARGETS+=	agent_tcp_TCPIPv6plain
370CLEANFILES+=		agent_tcp_TCPIPv6plain.res agent_tcp_TCPIPv6plain.exp
371agent_tcp_TCPIPv6plain:
372	printf "sysServices.0 = INTEGER: 74\n" > $@.exp
373	${SNMPGET} -v2c -cpublic TCPIPv6:::1:161 sysServices.0 > $@.res
374	diff -up $@.exp $@.res
375
376REGRESS_TARGETS+=	agent_tcp_TCPIPv6bracket
377CLEANFILES+=		agent_tcp_TCPIPv6bracket.res agent_tcp_TCPIPv6bracket.exp
378agent_tcp_TCPIPv6bracket:
379	printf "sysServices.0 = INTEGER: 74\n" > $@.exp
380	${SNMPGET} -v2c -cpublic TCPIPv6:[::1] sysServices.0 > $@.res
381	diff -u $@.exp $@.res
382
383REGRESS_TARGETS+=	agent_tcp_TCPIPv6bracket_port
384CLEANFILES+=		agent_tcp_TCPIPv6bracket_port.res agent_tcp_TCPIPv6bracket_port.exp
385agent_tcp_TCPIPv6bracket_port:
386	printf "sysServices.0 = INTEGER: 74\n" > $@.exp
387	${SNMPGET} -v2c -cpublic TCPIPv6:[::1]:161 sysServices.0 > $@.res
388	diff -up $@.exp $@.res
389
390### USM
391
392REGRESS_TARGETS+=	usm_noauthnopriv
393CLEANFILES+=		usm_noauthnopriv.res usm_noauthnopriv.exp
394usm_noauthnopriv:
395	printf "sysServices.0 = INTEGER: 74\n" > $@.exp
396	${SNMPGET} -v3 -l noauthnopriv -u md5_des 127.0.0.1 sysServices.0 > $@.res
397	diff -up $@.exp $@.res
398
399REGRESS_TARGETS+=	usm_authnopriv_md5
400CLEANFILES+=		usm_authnopriv_md5.res usm_authnopriv_md5.exp
401usm_authnopriv_md5:
402	printf "sysServices.0 = INTEGER: 74\n" > $@.exp
403	${SNMPGET} -v3 -l authnopriv -u md5_des -a md5 -A testtest 127.0.0.1 sysServices.0 > $@.res
404	diff -up $@.exp $@.res
405
406REGRESS_TARGETS+=	usm_authnopriv_sha1
407CLEANFILES+=		usm_authnopriv_sha1.res usm_authnopriv_sha1.exp
408usm_authnopriv_sha1:
409	printf "sysServices.0 = INTEGER: 74\n" > $@.exp
410	${SNMPGET} -v3 -l authnopriv -u sha1_des -a sha -A testtest 127.0.0.1 sysServices.0 > $@.res
411	diff -up $@.exp $@.res
412
413REGRESS_TARGETS+=	usm_authnopriv_sha224
414CLEANFILES+=		usm_authnopriv_sha224.res usm_authnopriv_sha224.exp
415usm_authnopriv_sha224:
416	printf "sysServices.0 = INTEGER: 74\n" > $@.exp
417	${SNMPGET} -v3 -l authnopriv -u sha224_des -a sha-224 -A testtest 127.0.0.1 sysServices.0 > $@.res
418	diff -up $@.exp $@.res
419
420REGRESS_TARGETS+=	usm_authnopriv_sha256
421CLEANFILES+=		usm_authnopriv_sha256.res usm_authnopriv_sha256.exp
422usm_authnopriv_sha256:
423	printf "sysServices.0 = INTEGER: 74\n" > $@.exp
424	${SNMPGET} -v3 -l authnopriv -u sha256_des -a sha-256 -A testtest 127.0.0.1 sysServices.0 > $@.res
425	diff -up $@.exp $@.res
426
427REGRESS_TARGETS+=	usm_authnopriv_sha384
428CLEANFILES+=		usm_authnopriv_sha384.res usm_authnopriv_sha384.exp
429usm_authnopriv_sha384:
430	printf "sysServices.0 = INTEGER: 74\n" > $@.exp
431	${SNMPGET} -v3 -l authnopriv -u sha384_des -a sha-384 -A testtest 127.0.0.1 sysServices.0 > $@.res
432	diff -up $@.exp $@.res
433
434REGRESS_TARGETS+=	usm_authnopriv_sha512
435CLEANFILES+=		usm_authnopriv_sha512.res usm_authnopriv_sha512.exp
436usm_authnopriv_sha512:
437	printf "sysServices.0 = INTEGER: 74\n" > $@.exp
438	${SNMPGET} -v3 -l authnopriv -u sha512_des -a sha-512 -A testtest 127.0.0.1 sysServices.0 > $@.res
439	diff -up $@.exp $@.res
440
441REGRESS_TARGETS+=	usm_authpriv_md5_des
442CLEANFILES+=		usm_authpriv_md5_des.res usm_authpriv_md5_des.exp
443usm_authpriv_md5_des:
444	printf "sysServices.0 = INTEGER: 74\n" > $@.exp
445	${SNMPGET} -v3 -l authpriv -u md5_des -a md5 -A testtest -x des -X testtest 127.0.0.1 sysServices.0 > $@.res
446	diff -up $@.exp $@.res
447
448REGRESS_TARGETS+=	usm_authpriv_md5_aes
449CLEANFILES+=		usm_authpriv_md5_aes.res usm_authpriv_md5_aes.exp
450usm_authpriv_md5_aes:
451	printf "sysServices.0 = INTEGER: 74\n" > $@.exp
452	${SNMPGET} -v3 -l authpriv -u md5_aes -a md5 -A testtest -x aes -X testtest 127.0.0.1 sysServices.0 > $@.res
453	diff -up $@.exp $@.res
454
455REGRESS_TARGETS+=	usm_authpriv_sha1_des
456CLEANFILES+=		usm_authpriv_sha1_des.res usm_authpriv_sha1_des.exp
457usm_authpriv_sha1_des:
458	printf "sysServices.0 = INTEGER: 74\n" > $@.exp
459	${SNMPGET} -v3 -l authpriv -u sha1_des -a sha -A testtest -x des -X testtest 127.0.0.1 sysServices.0 > $@.res
460	diff -up $@.exp $@.res
461
462REGRESS_TARGETS+=	usm_authpriv_sha1_aes
463CLEANFILES+=		usm_authpriv_sha1_aes.res usm_authpriv_sha1_aes.exp
464usm_authpriv_sha1_aes:
465	printf "sysServices.0 = INTEGER: 74\n" > $@.exp
466	${SNMPGET} -v3 -l authpriv -u sha1_aes -a sha -A testtest -x aes -X testtest 127.0.0.1 sysServices.0 > $@.res
467	diff -up $@.exp $@.res
468
469REGRESS_TARGETS+=	usm_authpriv_sha224_des
470CLEANFILES+=		usm_authpriv_sha224_des.res usm_authpriv_sha224_des.exp
471usm_authpriv_sha224_des:
472	printf "sysServices.0 = INTEGER: 74\n" > $@.exp
473	${SNMPGET} -v3 -l authpriv -u sha224_des -a sha-224 -A testtest -x des -X testtest 127.0.0.1 sysServices.0 > $@.res
474	diff -up $@.exp $@.res
475
476REGRESS_TARGETS+=	usm_authpriv_sha224_aes
477CLEANFILES+=		usm_authpriv_sha224_aes.res usm_authpriv_sha224_aes.exp
478usm_authpriv_sha224_aes:
479	printf "sysServices.0 = INTEGER: 74\n" > $@.exp
480	${SNMPGET} -v3 -l authpriv -u sha224_aes -a sha-224 -A testtest -x aes -X testtest 127.0.0.1 sysServices.0 > $@.res
481	diff -up $@.exp $@.res
482
483REGRESS_TARGETS+=	usm_authpriv_sha256_des
484CLEANFILES+=		usm_authpriv_sha256_des.res usm_authpriv_sha256_des.exp
485usm_authpriv_sha256_des:
486	printf "sysServices.0 = INTEGER: 74\n" > $@.exp
487	${SNMPGET} -v3 -l authpriv -u sha256_des -a sha-256 -A testtest -x des -X testtest 127.0.0.1 sysServices.0 > $@.res
488	diff -up $@.exp $@.res
489
490REGRESS_TARGETS+=	usm_authpriv_sha256_aes
491CLEANFILES+=		usm_authpriv_sha256_aes.res usm_authpriv_sha256_aes.exp
492usm_authpriv_sha256_aes:
493	printf "sysServices.0 = INTEGER: 74\n" > $@.exp
494	${SNMPGET} -v3 -l authpriv -u sha256_aes -a sha-256 -A testtest -x aes -X testtest 127.0.0.1 sysServices.0 > $@.res
495	diff -up $@.exp $@.res
496
497REGRESS_TARGETS+=	usm_authpriv_sha384_des
498CLEANFILES+=		usm_authpriv_sha384_des.res usm_authpriv_sha384_des.exp
499usm_authpriv_sha384_des:
500	printf "sysServices.0 = INTEGER: 74\n" > $@.exp
501	${SNMPGET} -v3 -l authpriv -u sha384_des -a sha-384 -A testtest -x des -X testtest 127.0.0.1 sysServices.0 > $@.res
502	diff -up $@.exp $@.res
503
504REGRESS_TARGETS+=	usm_authpriv_sha384_aes
505CLEANFILES+=		usm_authpriv_sha384_aes.res usm_authpriv_sha384_aes.exp
506usm_authpriv_sha384_aes:
507	printf "sysServices.0 = INTEGER: 74\n" > $@.exp
508	${SNMPGET} -v3 -l authpriv -u sha384_aes -a sha-384 -A testtest -x aes -X testtest 127.0.0.1 sysServices.0 > $@.res
509	diff -up $@.exp $@.res
510
511REGRESS_TARGETS+=	usm_authpriv_sha512_des
512CLEANFILES+=		usm_authpriv_sha512_des.res usm_authpriv_sha512_des.exp
513usm_authpriv_sha512_des:
514	printf "sysServices.0 = INTEGER: 74\n" > $@.exp
515	${SNMPGET} -v3 -l authpriv -u sha512_des -a sha-512 -A testtest -x des -X testtest 127.0.0.1 sysServices.0 > $@.res
516	diff -up $@.exp $@.res
517
518REGRESS_TARGETS+=	usm_authpriv_sha512_aes
519CLEANFILES+=		usm_authpriv_sha512_aes.res usm_authpriv_sha512_aes.exp
520usm_authpriv_sha512_aes:
521	printf "sysServices.0 = INTEGER: 74\n" > $@.exp
522	${SNMPGET} -v3 -l authpriv -u sha512_aes -a sha-512 -A testtest -x aes -X testtest 127.0.0.1 sysServices.0 > $@.res
523	diff -up $@.exp $@.res
524
525### OUTPUT FORMAT
526
527REGRESS_TARGETS+=	output_string
528CLEANFILES+=		output_string.exp output_string.res
529output_string:
530	printf "sysDescr.0 = STRING: %s\n" "$$(uname -a)" > $@.exp
531	${SNMPGET} -v2c -cpublic 127.0.0.1 sysDescr.0 > $@.res
532	diff -up $@.exp $@.res
533
534REGRESS_TARGETS+=	output_integer
535CLEANFILES+=		output_integer.res output_integer.exp
536output_integer:
537	printf "sysServices.0 = INTEGER: 74\n" > $@.exp
538	${SNMPGET} -v2c -cpublic 127.0.0.1 sysServices.0 > $@.res
539	diff -up $@.exp $@.res
540
541REGRESS_TARGETS+=	output_oid
542CLEANFILES+=		output_oid.res output_oid.exp
543output_oid:
544# The OID name used here is not compatible with net-snmp, so this
545# might change in the future.
546	printf "sysObjectID.0 = OID: localSystem.1\n" > $@.exp
547	${SNMPGET} -v2c -cpublic 127.0.0.1 sysObjectID.0 > $@.res
548	diff -up $@.exp $@.res
549
550REGRESS_TARGETS+=	output_hexstring
551CLEANFILES+=		output_hexstring.res output_hexstring.exp
552.if ${IFIDX} == ""
553REGRESS_SKIP_TARGETS+=	output_hexstring
554.endif
555output_hexstring:
556# (Ab)use table for known unknown Hex-string. In this case: lladdr
557	printf "ifPhysAddress.%d = Hex-STRING: %s\n" "${IFIDX}" "${IFLLADDR}" > $@.exp
558	${SNMPGET} -v2c -cpublic 127.0.0.1 ifPhysAddress.${IFIDX} > $@.res
559	diff -up $@.exp $@.res
560
561REGRESS_TARGETS+=	output_ipstring
562CLEANFILES+=		output_ipstring.res output_ipstring.exp
563output_ipstring:
564	printf "ipAdEntAddr.127.0.0.1 = IpAddress: 127.0.0.1\n" > $@.exp
565	${SNMPGET} -v2c -cpublic 127.0.0.1 ipAdEntAddr.127.0.0.1 > $@.res
566	diff -up $@.exp $@.res
567
568REGRESS_TARGETS+=	output_quiettype_string
569CLEANFILES+=		output_quiettype_string.res output_quiettype_string.exp
570output_quiettype_string:
571	printf "sysDescr.0 = %s\n" "$$(uname -a)" > $@.exp
572	${SNMPGET} -v2c -cpublic -OQ 127.0.0.1 sysDescr.0 > $@.res
573	diff -up $@.exp $@.res
574
575REGRESS_TARGETS+=	output_quiettype_integer
576CLEANFILES+=		output_quiettype_integer.res output_quiettype_integer.exp
577output_quiettype_integer:
578	printf "sysServices.0 = 74\n" > $@.exp
579	${SNMPGET} -v2c -cpublic -OQ 127.0.0.1 sysServices.0 > $@.res
580	diff -up $@.exp $@.res
581
582REGRESS_TARGETS+=	output_quiettype_oid
583CLEANFILES+=		output_quiettype_oid.res output_quiettype_oid.exp
584output_quiettype_oid:
585# The OID name used here is not compatible with net-snmp, so this
586# might change in the future.
587	printf "sysObjectID.0 = localSystem.1\n" > $@.exp
588	${SNMPGET} -v2c -cpublic -OQ 127.0.0.1 sysObjectID.0 > $@.res
589	diff -up $@.exp $@.res
590
591REGRESS_TARGETS+=	output_quiettype_ipstring
592CLEANFILES+=		output_quiettype_ipstring.res output_quiettype_ipstring.exp
593output_quiettype_ipstring:
594	printf "ipAdEntAddr.127.0.0.1 = 127.0.0.1\n" > $@.exp
595	${SNMPGET} -v2c -cpublic -OQ 127.0.0.1 ipAdEntAddr.127.0.0.1 > $@.res
596	diff -up $@.exp $@.res
597
598REGRESS_TARGETS+=	output_quiettype_hexstring
599CLEANFILES+=		output_quiettype_hexstring.res output_quiettype_hexstring.exp
600.if ${IFIDX} == ""
601REGRESS_SKIP_TARGETS+=	output_quiettype_hexstring
602.endif
603output_quiettype_hexstring:
604# (Ab)use table for known unknown Hex-string. In this case: lladdr
605	printf "ifPhysAddress.%d = %s\n" "${IFIDX}" "${IFLLADDR}" > $@.exp
606	${SNMPGET} -v2c -cpublic -OQ 127.0.0.1 ifPhysAddress.${IFIDX} > $@.res
607	diff -up $@.exp $@.res
608
609REGRESS_TARGETS+=	output_varbind_string
610CLEANFILES+=		output_varbind_string.res output_varbind_string.exp
611output_varbind_string:
612	printf "STRING: %s\n" "$$(uname -a)" > $@.exp
613	${SNMPGET} -v2c -cpublic -Ov 127.0.0.1 sysDescr.0 > $@.res
614	diff -up $@.exp $@.res
615
616REGRESS_TARGETS+=	output_varbind_integer
617CLEANFILES+=		output_varbind_integer.res output_varbind_integer.exp
618output_varbind_integer:
619	printf "INTEGER: 74\n" > $@.exp
620	${SNMPGET} -v2c -cpublic -Ov 127.0.0.1 sysServices.0 > $@.res
621	diff -up $@.exp $@.res
622
623REGRESS_TARGETS+=	output_varbind_oid
624CLEANFILES+=		output_varbind_oid.res output_varbind_oid.exp
625output_varbind_oid:
626# The OID name used here is not compatible with net-snmp, so this
627# might change in the future.
628	printf "OID: localSystem.1\n" > $@.exp
629	${SNMPGET} -v2c -cpublic -Ov 127.0.0.1 sysObjectID.0 > $@.res
630	diff -up $@.exp $@.res
631
632REGRESS_TARGETS+=	output_varbind_ipstring
633CLEANFILES+=		output_varbind_ipstring.res output_varbind_ipstring.exp
634output_varbind_ipstring:
635	printf "IpAddress: 127.0.0.1\n" > $@.exp
636	${SNMPGET} -v2c -cpublic -Ov 127.0.0.1 ipAdEntAddr.127.0.0.1 > $@.res
637	diff -up $@.exp $@.res
638
639REGRESS_TARGETS+=	output_varbind_hexstring
640CLEANFILES+=		output_varbind_hexstring.res output_varbind_hexstring.exp
641.if ${IFIDX} == ""
642REGRESS_SKIP_TARGETS+=	output_varbind_hexstring
643.endif
644output_varbind_hexstring:
645# (Ab)use table for known unknown Hex-string. In this case: lladdr
646	printf "Hex-STRING: %s\n" "${IFLLADDR}" > $@.exp
647	${SNMPGET} -v2c -cpublic -Ov 127.0.0.1 ifPhysAddress.${IFIDX} > $@.res
648	diff -up $@.exp $@.res
649
650REGRESS_TARGETS+=	output_quiettype_varbind
651CLEANFILES+=		output_quiettype_varbind.res output_quiettype_varbind.exp
652output_quiettype_varbind:
653	uname -a > $@.exp
654	${SNMPGET} -v2c -cpublic -OvQ 127.0.0.1 sysDescr.0 > $@.res
655	diff -up $@.exp $@.res
656
657REGRESS_TARGETS+=	output_ascii
658CLEANFILES+=		output_ascii.res output_ascii.exp
659.if ${IFIDX} == ""
660REGRESS_SKIP_TARGETS+=	output_ascii
661.endif
662output_ascii:
663# Not a full test, since a mac-address can contain all kind of weirdness,
664# so no guarantee that we handle everything. But I don't know a better
665# alternative at this moment.
666# Abuse $@.res for intermediate variable for easier cleanup.
667	printf 'ifPhysAddress.%d = STRING: "' "${IFIDX}" > $@.exp
668	printf "%s\n" "${IFLLADDR}" | tr ' ' '\n' | while read byte; do printf "\x$${byte}" | tr -c '[:print:]' '.'; done >> $@.exp
669	printf '"\n' >> $@.exp
670	${SNMPGET} -v2c -cpublic -Oa 127.0.0.1 ifPhysAddress.${IFIDX} > $@.res
671	diff -up $@.exp $@.res
672
673REGRESS_TARGETS+=	output_fulloid_mib
674CLEANFILES+=		output_fulloid_mib.res output_fulloid_mib.exp
675output_fulloid_mib:
676	printf ".iso.org.dod.internet.mgmt.mib_2.system.sysDescr.0 = STRING: %s\n" "$$(uname -a)" > $@.exp
677	${SNMPGET} -v2c -cpublic -Of 127.0.0.1 sysDescr.0 > $@.res
678	diff -up $@.exp $@.res
679
680REGRESS_TARGETS+=	output_fulloid_varbind
681CLEANFILES+=		output_fulloid_varbind.res output_fulloid_varbind.exp
682output_fulloid_varbind:
683	printf ".iso.org.dod.internet.mgmt.mib_2.system.sysObjectID.0 = OID: .iso.org.dod.internet.private.enterprises.openBSD.localSystem.1\n" > $@.exp
684	${SNMPGET} -v2c -cpublic -Of 127.0.0.1 sysObjectID.0 > $@.res
685	diff -up $@.exp $@.res
686
687REGRESS_TARGETS+=	output_numoid_mib
688CLEANFILES+=		output_numoid_mib.res output_numoid_mib.exp
689output_numoid_mib:
690	printf ".1.3.6.1.2.1.1.1.0 = STRING: %s\n" "$$(uname -a)" > $@.exp
691	${SNMPGET} -v2c -cpublic -On 127.0.0.1 sysDescr.0 > $@.res
692	diff -up $@.exp $@.res
693
694REGRESS_TARGETS+=	output_numoid_varbind
695CLEANFILES+=		output_numoid_varbind.res output_numoid_varbind.exp
696output_numoid_varbind:
697	printf ".1.3.6.1.2.1.1.2.0 = OID: .1.3.6.1.4.1.30155.23.1\n" > $@.exp
698	${SNMPGET} -v2c -cpublic -On 127.0.0.1 sysObjectID.0 > $@.res
699	diff -up $@.exp $@.res
700
701REGRESS_TARGETS+=	output_quiet_string
702CLEANFILES+=		output_quiet_string.res output_quiet_string.exp
703output_quiet_string:
704	printf "sysDescr.0 %s\n" "$$(uname -a)" > $@.exp
705	${SNMPGET} -v2c -cpublic -Oq 127.0.0.1 sysDescr.0 > $@.res
706	diff -up $@.exp $@.res
707
708REGRESS_TARGETS+=	output_quiet_integer
709CLEANFILES+=		output_quiet_integer.res output_quiet_integer.exp
710output_quiet_integer:
711	printf "sysServices.0 74\n" > $@.exp
712	${SNMPGET} -v2c -cpublic -Oq 127.0.0.1 sysServices.0 > $@.res
713	diff -up $@.exp $@.res
714
715REGRESS_TARGETS+=	output_quiet_oid
716CLEANFILES+=		output_quiet_oid.res output_quiet_oid.exp
717output_quiet_oid:
718# The OID name used here is not compatible with net-snmp, so this
719# might change in the future.
720	printf "sysObjectID.0 localSystem.1\n" > $@.exp
721	${SNMPGET} -v2c -cpublic -Oq 127.0.0.1 sysObjectID.0 > $@.res
722	diff -up $@.exp $@.res
723
724REGRESS_TARGETS+=	output_quiet_ipstring
725CLEANFILES+=		output_quiet_ipstring.res output_quiet_ipstring.exp
726output_quiet_ipstring:
727	printf "ipAdEntAddr.127.0.0.1 127.0.0.1\n" > $@.exp
728	${SNMPGET} -v2c -cpublic -Oq 127.0.0.1 ipAdEntAddr.127.0.0.1 > $@.res
729	diff -up $@.exp $@.res
730
731REGRESS_TARGETS+=	output_quiet_hexstring
732CLEANFILES+=		output_quiet_hexstring.res output_quiet_hexstring.exp
733.if ${IFIDX} == ""
734REGRESS_SKIP_TARGETS+=	output_quiet_hexstring
735.endif
736output_quiet_hexstring:
737# (Ab)use table for known unknown Hex-string. In this case: lladdr
738	printf "ifPhysAddress.%d %s\n" "${IFIDX}" "${IFLLADDR}" > $@.exp
739	${SNMPGET} -v2c -cpublic -Oq 127.0.0.1 ifPhysAddress.${IFIDX} > $@.res
740	diff -up $@.exp $@.res
741
742REGRESS_TARGETS+=	output_hex
743CLEANFILES+=		output_hex.res output_hex.exp
744output_hex:
745# From testing net-snmp: hex mode wraps each 16 bytes.
746# It happens that od does the same.
747	printf "localTest.3.2.0 = Hex-STRING: " > $@.exp
748	printf "abcdefghijklmnopqrstuvwxyz" | od -An -tx1 | sed 's/^ *//;s/  / /g;s/ *$$//' | tr '[:lower:]' '[:upper:]' >> $@.exp
749	${SNMPGET} -v2c -cpublic -Ox 127.0.0.1 1.3.6.1.4.1.30155.42.3.2.0 > $@.res
750	diff -up $@.exp $@.res
751
752REGRESS_TARGETS+=	output_displayhint_255t_utf8
753CLEANFILES+=		output_displayhint_255t_utf8.res output_displayhint_255t_utf8.exp
754output_displayhint_255t_utf8:
755	printf "STRING: Reyk Flöter\n" > $@.exp
756	LC_ALL=en_US.UTF-8 ${SNMPGET} -Ov -v2c -cpublic 127.0.0.1 1.3.6.1.6.3.15.1.2.2.1.2.1.0 > $@.res
757	diff -up $@.exp $@.res
758
759REGRESS_TARGETS+=	output_displayhint_255t_ascii
760CLEANFILES+=		output_displayhint_255t_ascii.res output_displayhint_255t_ascii.exp
761output_displayhint_255t_ascii:
762	printf "STRING: Reyk Fl.ter\n" > $@.exp
763	LC_ALL=C ${SNMPGET} -Ov -v2c -cpublic 127.0.0.1 1.3.6.1.6.3.15.1.2.2.1.2.1.0 > $@.res
764	diff -up $@.exp $@.res
765
766REGRESS_TARGETS+=	output_displayhint_255t_invalchar_utf8
767CLEANFILES+=		output_displayhint_255t_invalchar_utf8.res output_displayhint_255t_invalchar_utf8.exp
768output_displayhint_255t_invalchar_utf8:
769	printf "STRING: Reyk Fl�ter\n" > $@.exp
770	LC_ALL=en_US.UTF-8 ${SNMPGET} -Ov -v2c -cpublic 127.0.0.1 1.3.6.1.6.3.15.1.2.2.1.2.2.0 > $@.res
771	diff -up $@.exp $@.res
772
773REGRESS_TARGETS+=	output_displayhint_255t_invalchar_ascii
774CLEANFILES+=		output_displayhint_255t_invalchar_ascii.res output_displayhint_255t_invalchar_ascii.exp
775output_displayhint_255t_invalchar_ascii:
776	printf "STRING: Reyk Fl?ter\n" > $@.exp
777	LC_ALL=C ${SNMPGET} -Ov -v2c -cpublic 127.0.0.1 1.3.6.1.6.3.15.1.2.2.1.2.2.0 > $@.res
778	diff -up $@.exp $@.res
779
780REGRESS_TARGETS+=	output_displayhint_255t_truncatefull
781CLEANFILES+=		output_displayhint_255t_truncatefull.res output_displayhint_255t_truncatefull.exp
782output_displayhint_255t_truncatefull:
783	printf "STRING: %s\n" "$$(jot -ba 255 | tr -d '\n')" > $@.exp
784	LC_ALL=en_US.UTF-8 ${SNMPGET} -Ov -v2c -cpublic 127.0.0.1 1.3.6.1.6.3.15.1.2.2.1.2.3.0 > $@.res
785	diff -up $@.exp $@.res
786
787REGRESS_TARGETS+=	output_displayhint_255t_truncatehalf
788CLEANFILES+=		output_displayhint_255t_truncatehalf.res output_displayhint_255t_truncatehalf.exp
789output_displayhint_255t_truncatehalf:
790	printf "STRING: %s\n" "$$(jot -ba 254 | tr -d '\n')" > $@.exp
791	LC_ALL=en_US.UTF-8 ${SNMPGET} -Ov -v2c -cpublic 127.0.0.1 1.3.6.1.6.3.15.1.2.2.1.2.4.0 > $@.res
792	diff -up $@.exp $@.res
793
794REGRESS_TARGETS+=	output_displayhint_255a_utf8
795CLEANFILES+=		output_displayhint_255a_utf8.res output_displayhint_255a_utf8.exp
796output_displayhint_255a_utf8:
797	printf "STRING: Reyk Fl��ter\n" > $@.exp
798	LC_ALL=en_US.UTF-8 ${SNMPGET} -Ov -v2c -cpublic 127.0.0.1 1.3.6.1.2.1.1.4.0 > $@.res
799	diff -up $@.exp $@.res
800
801REGRESS_TARGETS+=	output_displayhint_255a_ascii
802CLEANFILES+=		output_displayhint_255a_ascii.res output_displayhint_255a_ascii.exp
803output_displayhint_255a_ascii:
804	printf "STRING: Reyk Fl??ter\n" > $@.exp
805	LC_ALL=C-8 ${SNMPGET} -Ov -v2c -cpublic 127.0.0.1 1.3.6.1.2.1.1.4.0 > $@.res
806	diff -up $@.exp $@.res
807
808REGRESS_TARGETS+=	output_displayhint_precedence
809CLEANFILES+=		output_displayhint_precedence.res output_displayhint_precedence.exp
810output_displayhint_precedence:
811	printf "sysDescr.0 = STRING: %s\n" "$$(uname -a)" > $@.exp
812	${SNMPGET} -Ox -v2c -cpublic 127.0.0.1 sysDescr.0 > $@.res
813	diff -up $@.exp $@.res
814
815### SNMP GET
816# We already tested most of get in the previous tests.
817# Just test the retrieval of multiple entries
818
819REGRESS_TARGETS+=	get_multiple
820CLEANFILES+=		get_multiple.res get_multiple.exp
821get_multiple:
822	printf "sysServices.0 = INTEGER: 74\nsysDescr.0 = STRING: %s\n" "$$(uname -a)" > $@.exp
823	${SNMPGET} -v2c -cpublic 127.0.0.1 sysServices.0 sysDescr.0 > $@.res
824	diff -up $@.exp $@.res
825
826### SNMP GETNEXT
827
828REGRESS_TARGETS+=	getnext_simple
829CLEANFILES+=		getnext_simple.res getnext_simple.exp
830getnext_simple:
831	printf "sysDescr.0 = STRING: %s\n" "$$(uname -a)" > $@.exp
832	${SNMPGETNEXT} -v2c -cpublic 127.0.0.1 system > $@.res
833	diff -up $@.exp $@.res
834
835REGRESS_TARGETS+=	getnext_multiple
836CLEANFILES+=		getnext_multiple.res getnext_multiple.exp
837getnext_multiple:
838	printf "sysServices.0 = INTEGER: 74\nsysDescr.0 = STRING: %s\n" "$$(uname -a)" > $@.exp
839	${SNMPGETNEXT} -v2c -cpublic 127.0.0.1 sysLocation.0 system > $@.res
840	diff -up $@.exp $@.res
841
842### SNMP BULKGET
843# Building output manually is large and error prone: Assume get/getnext works
844
845REGRESS_TARGETS+=	bulkget_simple
846CLEANFILES+=		bulkget_simple.res bulkget_simple.exp
847bulkget_simple:
848	IDX=1; while [ $$IDX -le 4 ]; do ${SNMPGET} -v2c -cpublic 127.0.0.1 sysORDescr.$$IDX; IDX=$$((IDX+1)); done > $@.exp
849	${SNMPBULKGET} -v2c -cpublic -Cr4 127.0.0.1 sysORDescr > $@.res
850	diff -up $@.exp $@.res
851
852REGRESS_TARGETS+=	bulkget_multi
853CLEANFILES+=		bulkget_multi.res bulkget_multi.exp
854bulkget_multi:
855	> $@.exp
856	IDX=1; while [ $$IDX -le 4 ]; do ${SNMPGET} -v2c -cpublic 127.0.0.1 sysORDescr.$$IDX sysORID.$$IDX; IDX=$$((IDX+1)); done >> $@.exp
857	${SNMPBULKGET} -v2c -cpublic -Cr4 127.0.0.1 sysORDescr sysORID > $@.res
858	diff -up $@.exp $@.res
859
860REGRESS_TARGETS+=	bulkget_nonrep
861CLEANFILES+=		bulkget_nonrep.res bulkget_nonrep.exp
862bulkget_nonrep:
863	${SNMPGET} -v2c -cpublic 127.0.0.1 sysDescr.0 > $@.exp
864	IDX=1; while [ $$IDX -le 4 ]; do ${SNMPGET} -v2c -cpublic 127.0.0.1 sysORDescr.$$IDX; IDX=$$((IDX+1)); done >> $@.exp
865	${SNMPBULKGET} -v2c -cpublic -Cn1 -Cr4 127.0.0.1 sysDescr sysORDescr > $@.res
866	diff -up $@.exp $@.res
867
868REGRESS_TARGETS+=	bulkget_maxrep
869CLEANFILES+=		bulkget_maxrep.res bulkget_maxrep.exp
870bulkget_maxrep:
871	IDX=1; while [ $$IDX -le 4 ]; do ${SNMPGET} -v2c -cpublic 127.0.0.1 sysORDescr.$$IDX; IDX=$$((IDX+1)); done > $@.exp
872	${SNMPBULKGET} -v2c -cpublic -Cr4 127.0.0.1 sysORDescr > $@.res
873	diff -up $@.exp $@.res
874
875### SNMP WALK
876# Building output manually is large and error prone: Assume getnext works
877# Skip sysUptime, since it's a timer
878
879REGRESS_TARGETS+=	walk_simple
880CLEANFILES+=		walk_simple.res walk_simple.exp
881walk_simple:
882	OID=system; while true; do OID="$$(${SNMPGETNEXT} -v2c -cpublic 127.0.0.1 "$$OID")"; [ -n "$${OID%sys*}" ] && break; printf "%s\n" "$${OID}"; OID="$${OID%% *}"; done | grep -v ^sysUpTime.0 > $@.exp
883	${SNMPWALK} -v2c -cpublic 127.0.0.1 system | grep -v ^sysUpTime.0 > $@.res
884	diff -up $@.exp $@.res
885
886REGRESS_TARGETS+=	walk_end
887CLEANFILES+=		walk_end.res walk_end.exp
888walk_end:
889	OID=system; while true; do OID="$$(${SNMPGETNEXT} -v2c -cpublic 127.0.0.1 "$$OID")"; [ "$${OID%% *}" == "sysORLastChange.0" ] && break; printf "%s\n" "$${OID}"; OID="$${OID%% *}"; done | grep -v ^sysUpTime.0 > $@.exp
890	${SNMPWALK} -v2c -cpublic -CE sysORLastChange 127.0.0.1 system | grep -v ^sysUpTime.0 > $@.res
891	diff -up $@.exp $@.res
892
893REGRESS_TARGETS+=	walk_includeoid
894CLEANFILES+=		walk_includeoid.res walk_includeoid.exp
895walk_includeoid:
896	printf "sysServices.0 = INTEGER: 74\n" > $@.exp
897	${SNMPWALK} -v2c -cpublic 127.0.0.1 sysServices.0 > $@.res
898	diff -up $@.exp $@.res
899
900REGRESS_TARGETS+=	walk_excludeoid
901CLEANFILES+=		walk_excludeoid.res walk_excludeoid.exp
902walk_excludeoid:
903	> $@.exp
904	${SNMPWALK} -v2c -cpublic -CI 127.0.0.1 sysServices.0 > $@.res
905	diff -up $@.exp $@.res
906
907REGRESS_TARGETS+=	walk_summary
908CLEANFILES+=		walk_summary.res walk_summary.exp
909walk_summary:
910	OID=system; while true; do OID="$$(${SNMPGETNEXT} -v2c -cpublic 127.0.0.1 "$$OID")"; [ -n "$${OID%sys*}" ] && break; printf "%s\n" "$${OID}"; OID="$${OID%% *}"; done | grep -v ^sysUpTime.0 > $@.exp
911	wc -l $@.exp | awk '{printf("Variables found: %d\n", $$1 + 1)}' >> $@.exp
912	${SNMPWALK} -v2c -cpublic -Cp 127.0.0.1 system | grep -v ^sysUpTime.0 > $@.res
913	diff -up $@.exp $@.res
914
915REGRESS_TARGETS+=	walk_skip
916CLEANFILES+=		walk_skip.exp walk_skip.res
917walk_skip:
918	OID=system; while true; do OID="$$(${SNMPGETNEXT} -v2c -cpublic 127.0.0.1 "$$OID")"; [ -n "$${OID%sys*}" ] && break; printf "%s\n" "$${OID}"; OID="$${OID%% *}"; done | grep -v ^sysUpTime.0 > $@.exp
919	${SNMPWALK} -v2c -cpublic -Cs sysUpTime 127.0.0.1 system > $@.res
920	diff -up $@.exp $@.res
921
922### SNMP BULKWALK
923
924REGRESS_TARGETS+=	bulkwalk_simple
925CLEANFILES+=		bulkwalk_simple.res bulkwalk_simple.exp
926bulkwalk_simple:
927	OID=system; while true; do OID="$$(${SNMPGETNEXT} -v2c -cpublic 127.0.0.1 "$$OID")"; [ -n "$${OID%sys*}" ] && break; printf "%s\n" "$${OID}"; OID="$${OID%% *}"; done | grep -v ^sysUpTime.0 > $@.exp
928	${SNMPBULKWALK} -v2c -cpublic 127.0.0.1 system | grep -v ^sysUpTime.0 > $@.res
929	diff -up $@.exp $@.res
930
931REGRESS_TARGETS+=	bulkwalk_includeoid
932CLEANFILES+=		bulkwalk_includeoid.res bulkwalk_includeoid.exp
933bulkwalk_includeoid:
934	printf "sysServices.0 = INTEGER: 74\n" > $@.exp
935	${SNMPBULKWALK} -v2c -cpublic 127.0.0.1 sysServices.0 > $@.res
936	diff -up $@.exp $@.res
937
938REGRESS_TARGETS+=	bulkwalk_summary
939CLEANFILES+=		bulkwalk_summary.res bulkwalk_summary.exp
940bulkwalk_summary:
941	OID=system; while true; do OID="$$(${SNMPGETNEXT} -v2c -cpublic 127.0.0.1 "$$OID")"; [ -n "$${OID%sys*}" ] && break; printf "%s\n" "$${OID}"; OID="$${OID%% *}"; done | grep -v ^sysUpTime.0 > $@.exp
942	wc -l $@.exp | awk '{printf("Variables found: %d\n", $$1 + 1)}' >> $@.exp
943	${SNMPBULKWALK} -v2c -cpublic -Cp 127.0.0.1 system | grep -v ^sysUpTime.0 > $@.res
944	diff -up $@.exp $@.res
945
946REGRESS_TARGETS+=	bulkwalk_skip
947CLEANFILES+=		bulkwalk_skip.exp bulkwalk_skip.res
948bulkwalk_skip:
949	OID=system; while true; do OID="$$(${SNMPGETNEXT} -v2c -cpublic 127.0.0.1 "$$OID")"; [ -n "$${OID%sys*}" ] && break; printf "%s\n" "$${OID}"; OID="$${OID%% *}"; done | grep -v ^sysUpTime.0 > $@.exp
950	${SNMPBULKWALK} -v2c -cpublic -Cs sysUpTime 127.0.0.1 system > $@.res
951	diff -up $@.exp $@.res
952
953### SNMP SET
954
955# XXX snmpd(8) doesn't support set
956REGRESS_TARGETS+=	set_string
957REGRESS_EXPECTED_FAILURES+= set_string
958CLEANFILES+=		set_string.res set_string.exp
959set_string:
960	${SNMPGET} -v2c -cpublic -Oqv 127.0.0.1 1.3.6.1.4.1.30155.42.3.3.0 | awk '{ printf("%sa\n", $$1) }' > $@.exp
961	${SNMPSET} -v2c -cprivate -Oqv 127.0.0.1 1.3.6.1.4.1.30155.42.3.3.0 s $$(cat $@.exp) > $@.res
962	diff -up $@.exp $@.res
963
964REGRESS_TARGETS+=	set_integer
965REGRESS_EXPECTED_FAILURES+= set_integer
966CLEANFILES+=		set_integer.res set_integer.exp
967set_integer:
968	${SNMPGET} -v2c -cpublic -Oqv 127.0.0.1 1.3.6.1.4.1.30155.42.3.4.0 | awk '{ print $$1 + 1 }' > $@.exp
969	${SNMPSET} -v2c -cprivate -Oqv 127.0.0.1 1.3.6.1.4.1.30155.42.3.4.0 i $$(cat $@.exp) > $@.res
970	diff -up $@.exp $@.res
971
972REGRESS_TARGETS+=	set_string_integer
973REGRESS_EXPECTED_FAILURES+= set_string_integer
974CLEANFILES+=		set_string_integer.res set_string_integer.exp
975set_string_integer:
976	${SNMPGET} -v2c -cpublic -Oqv 127.0.0.1 1.3.6.1.4.1.30155.42.3.3.0 1.3.6.1.4.1.30155.42.3.4.0 | \
977	    awk 'NR == 1 { printf("%sa\n", $$1) } NR == 2 { print $$1 + 1 }' > $@.exp
978	${SNMPSET} -v2c -cprivate -Oqv 127.0.0.1 1.3.6.1.4.1.30155.42.3.3.0 s $$(head -1 $@.exp) 1.3.6.1.4.1.30155.42.3.4.0 i $$(tail -1 $@.exp) > $@.res
979	diff -up $@.exp $@.res
980
981### SNMP TRAP
982
983TRAP_EXEC!=		${SUDO} su -s /bin/sh _snmpd -c '[ -r ${.OBJDIR}/traphandle.sh ]' > /dev/null 2>&1 && printf 'yes' || printf 'no'
984
985REGRESS_TARGETS+=	trap_simple
986CLEANFILES+=		trap_simple.res trap_simple.exp
987.if ${TRAP_EXEC} != yes
988REGRESS_SKIP_TARGETS+=	trap_simple
989.endif
990trap_simple:
991	printf 'localhost\n127.0.0.1\niso.org.dod.internet.mgmt.mib_2.system.sysUpTime.0 100\n' > $@.exp
992	printf 'iso.org.dod.internet.snmpV2.snmpModules.snmpMIB.snmpMIBObjects.snmpTrap.snmpTrapOID.0 iso.org.dod\n' >> $@.exp
993	> trap_output
994	${SNMPTRAP} -v2c -cpublic 127.0.0.1 100 1.3.6
995# Give snmpd some time to write out the data
996	sleep 0.1
997	cp trap_output $@.res
998	diff -up $@.exp $@.res
999
1000REGRESS_TARGETS+=	trap_ip
1001CLEANFILES+=		trap_ip.res trap_ip.exp
1002.if ${TRAP_EXEC} != yes
1003REGRESS_SKIP_TARGETS+=	trap_ip
1004.endif
1005trap_ip:
1006	printf 'localhost\n127.0.0.1\niso.org.dod.internet.mgmt.mib_2.system.sysUpTime.0 100\n' > $@.exp
1007	printf 'iso.org.dod.internet.snmpV2.snmpModules.snmpMIB.snmpMIBObjects.snmpTrap.snmpTrapOID.0 iso.org.dod\n' >> $@.exp
1008	printf 'iso.org.dod.8 192.168.1.1\n' >> $@.exp
1009	> trap_output
1010	${SNMPTRAP} -v2c -cpublic 127.0.0.1 100 1.3.6 1.3.6.8 a 192.168.1.1
1011# Give snmpd some time to write out the data
1012	sleep 0.1
1013	cp trap_output $@.res
1014	diff -up $@.exp $@.res
1015
1016REGRESS_TARGETS+=	trap_bitstring
1017CLEANFILES+=		trap_bitstring.res trap_bitstring.exp
1018.if ${TRAP_EXEC} != yes
1019REGRESS_SKIP_TARGETS+=	trap_bitstring
1020.endif
1021trap_bitstring:
1022	printf 'localhost\n127.0.0.1\niso.org.dod.internet.mgmt.mib_2.system.sysUpTime.0 100\n' > $@.exp
1023	printf 'iso.org.dod.internet.snmpV2.snmpModules.snmpMIB.snmpMIBObjects.snmpTrap.snmpTrapOID.0 iso.org.dod\n' >> $@.exp
1024	printf 'iso.org.dod.8 "a"\n' >> $@.exp
1025	> trap_output
1026	${SNMPTRAP} -v2c -cpublic 127.0.0.1 100 1.3.6 1.3.6.8 b '1,2,7'
1027# Give snmpd some time to write out the data
1028	sleep 0.1
1029	cp trap_output $@.res
1030	diff -up $@.exp $@.res
1031
1032REGRESS_TARGETS+=	trap_counter32
1033CLEANFILES+=		trap_counter32.res trap_counter32.exp
1034.if ${TRAP_EXEC} != yes
1035REGRESS_SKIP_TARGETS+=	trap_counter32
1036.endif
1037trap_counter32:
1038	printf 'localhost\n127.0.0.1\niso.org.dod.internet.mgmt.mib_2.system.sysUpTime.0 100\n' > $@.exp
1039	printf 'iso.org.dod.internet.snmpV2.snmpModules.snmpMIB.snmpMIBObjects.snmpTrap.snmpTrapOID.0 iso.org.dod\n' >> $@.exp
1040	printf 'iso.org.dod.8 20\n' >> $@.exp
1041	> trap_output
1042	${SNMPTRAP} -v2c -cpublic 127.0.0.1 100 1.3.6 1.3.6.8 c 20
1043# Give snmpd some time to write out the data
1044	sleep 0.1
1045	cp trap_output $@.res
1046	diff -up $@.exp $@.res
1047
1048REGRESS_TARGETS+=	trap_decimal
1049CLEANFILES+=		trap_decimal.res trap_decimal.exp
1050.if ${TRAP_EXEC} != yes
1051REGRESS_SKIP_TARGETS+=	trap_decimal
1052.endif
1053trap_decimal:
1054	printf 'localhost\n127.0.0.1\niso.org.dod.internet.mgmt.mib_2.system.sysUpTime.0 100\n' > $@.exp
1055	printf 'iso.org.dod.internet.snmpV2.snmpModules.snmpMIB.snmpMIBObjects.snmpTrap.snmpTrapOID.0 iso.org.dod\n' >> $@.exp
1056	printf 'iso.org.dod.8 "hello world"\n' >> $@.exp
1057	> trap_output
1058	${SNMPTRAP} -v2c -cpublic 127.0.0.1 100 1.3.6 1.3.6.8 d '104 101 108 108 111 32 119 111 114 108 100'
1059# Give snmpd some time to write out the data
1060	sleep 0.1
1061	cp trap_output $@.res
1062	diff -up $@.exp $@.res
1063
1064REGRESS_TARGETS+=	trap_integer
1065CLEANFILES+=		trap_integer.res trap_integer.exp
1066.if ${TRAP_EXEC} != yes
1067REGRESS_SKIP_TARGETS+=	trap_integer
1068.endif
1069trap_integer:
1070	printf 'localhost\n127.0.0.1\niso.org.dod.internet.mgmt.mib_2.system.sysUpTime.0 100\n' > $@.exp
1071	printf 'iso.org.dod.internet.snmpV2.snmpModules.snmpMIB.snmpMIBObjects.snmpTrap.snmpTrapOID.0 iso.org.dod\n' >> $@.exp
1072	printf 'iso.org.dod.8 42\n' >> $@.exp
1073	> trap_output
1074	${SNMPTRAP} -v2c -cpublic 127.0.0.1 100 1.3.6 1.3.6.8 i 42
1075# Give snmpd some time to write out the data
1076	sleep 0.1
1077	cp trap_output $@.res
1078	diff -up $@.exp $@.res
1079
1080REGRESS_TARGETS+=	trap_null
1081CLEANFILES+=		trap_null.res trap_null.exp
1082.if ${TRAP_EXEC} != yes
1083REGRESS_SKIP_TARGETS+=	trap_null
1084.endif
1085trap_null:
1086	printf 'localhost\n127.0.0.1\niso.org.dod.internet.mgmt.mib_2.system.sysUpTime.0 100\n' > $@.exp
1087	printf 'iso.org.dod.internet.snmpV2.snmpModules.snmpMIB.snmpMIBObjects.snmpTrap.snmpTrapOID.0 iso.org.dod\n' >> $@.exp
1088	printf 'iso.org.dod.8\n' >> $@.exp
1089	> trap_output
1090	${SNMPTRAP} -v2c -cpublic 127.0.0.1 100 1.3.6 1.3.6.8 n ignored
1091# Give snmpd some time to write out the data
1092	sleep 0.1
1093	cp trap_output $@.res
1094	diff -up $@.exp $@.res
1095
1096REGRESS_TARGETS+=	trap_oid
1097CLEANFILES+=		trap_oid.res trap_oid.exp
1098.if ${TRAP_EXEC} != yes
1099REGRESS_SKIP_TARGETS+=	trap_oid
1100.endif
1101trap_oid:
1102	printf 'localhost\n127.0.0.1\niso.org.dod.internet.mgmt.mib_2.system.sysUpTime.0 100\n' > $@.exp
1103	printf 'iso.org.dod.internet.snmpV2.snmpModules.snmpMIB.snmpMIBObjects.snmpTrap.snmpTrapOID.0 iso.org.dod\n' >> $@.exp
1104	printf 'iso.org.dod.8 iso.org.dod\n' >> $@.exp
1105	> trap_output
1106	${SNMPTRAP} -v2c -cpublic 127.0.0.1 100 1.3.6 1.3.6.8 o 1.3.6
1107# Give snmpd some time to write out the data
1108	sleep 0.1
1109	cp trap_output $@.res
1110	diff -up $@.exp $@.res
1111
1112REGRESS_TARGETS+=	trap_string
1113CLEANFILES+=		trap_string.res trap_string.exp
1114.if ${TRAP_EXEC} != yes
1115REGRESS_SKIP_TARGETS+=	trap_string
1116.endif
1117trap_string:
1118	printf 'localhost\n127.0.0.1\niso.org.dod.internet.mgmt.mib_2.system.sysUpTime.0 100\n' > $@.exp
1119	printf 'iso.org.dod.internet.snmpV2.snmpModules.snmpMIB.snmpMIBObjects.snmpTrap.snmpTrapOID.0 iso.org.dod\n' >> $@.exp
1120	printf 'iso.org.dod.8 "hello world"\n' >> $@.exp
1121	> trap_output
1122	${SNMPTRAP} -v2c -cpublic 127.0.0.1 100 1.3.6 1.3.6.8 s "hello world"
1123# Give snmpd some time to write out the data
1124	sleep 0.1
1125	cp trap_output $@.res
1126	diff -up $@.exp $@.res
1127
1128REGRESS_TARGETS+=	trap_timeticks
1129CLEANFILES+=		trap_timeticks.res trap_timeticks.exp
1130.if ${TRAP_EXEC} != yes
1131REGRESS_SKIP_TARGETS+=	trap_timeticks
1132.endif
1133trap_timeticks:
1134	printf 'localhost\n127.0.0.1\niso.org.dod.internet.mgmt.mib_2.system.sysUpTime.0 100\n' > $@.exp
1135	printf 'iso.org.dod.internet.snmpV2.snmpModules.snmpMIB.snmpMIBObjects.snmpTrap.snmpTrapOID.0 iso.org.dod\n' >> $@.exp
1136	printf 'iso.org.dod.8 420\n' >> $@.exp
1137	> trap_output
1138	${SNMPTRAP} -v2c -cpublic 127.0.0.1 100 1.3.6 1.3.6.8 t 420
1139# Give snmpd some time to write out the data
1140	sleep 0.1
1141	cp trap_output $@.res
1142	diff -up $@.exp $@.res
1143
1144REGRESS_TARGETS+=	trap_unsigned
1145CLEANFILES+=		trap_unsigned.res trap_unsigned.exp
1146.if ${TRAP_EXEC} != yes
1147REGRESS_SKIP_TARGETS+=	trap_unsigned
1148.endif
1149trap_unsigned:
1150	printf 'localhost\n127.0.0.1\niso.org.dod.internet.mgmt.mib_2.system.sysUpTime.0 100\n' > $@.exp
1151	printf 'iso.org.dod.internet.snmpV2.snmpModules.snmpMIB.snmpMIBObjects.snmpTrap.snmpTrapOID.0 iso.org.dod\n' >> $@.exp
1152	printf 'iso.org.dod.8 420\n' >> $@.exp
1153	> trap_output
1154	${SNMPTRAP} -v2c -cpublic 127.0.0.1 100 1.3.6 1.3.6.8 u 420
1155# Give snmpd some time to write out the data
1156	sleep 0.1
1157	cp trap_output $@.res
1158	diff -up $@.exp $@.res
1159
1160REGRESS_TARGETS+=	trap_hex
1161CLEANFILES+=		trap_hex.res trap_hex.exp
1162.if ${TRAP_EXEC} != yes
1163REGRESS_SKIP_TARGETS+=	trap_hex
1164.endif
1165trap_hex:
1166	printf 'localhost\n127.0.0.1\niso.org.dod.internet.mgmt.mib_2.system.sysUpTime.0 100\n' > $@.exp
1167	printf 'iso.org.dod.internet.snmpV2.snmpModules.snmpMIB.snmpMIBObjects.snmpTrap.snmpTrapOID.0 iso.org.dod\n' >> $@.exp
1168	printf 'iso.org.dod.8 "hello world"\n' >> $@.exp
1169	> trap_output
1170	${SNMPTRAP} -v2c -cpublic 127.0.0.1 100 1.3.6 1.3.6.8 x '68 65 6c 6c 6f 20 77 6f 72 6c 64'
1171# Give snmpd some time to write out the data
1172	sleep 0.1
1173	cp trap_output $@.res
1174	diff -up $@.exp $@.res
1175
1176REGRESS_TARGETS+=	trap_multi
1177CLEANFILES+=		trap_multi.res trap_multi.exp
1178.if ${TRAP_EXEC} != yes
1179REGRESS_SKIP_TARGETS+=	trap_multi
1180.endif
1181trap_multi:
1182	printf 'localhost\n127.0.0.1\niso.org.dod.internet.mgmt.mib_2.system.sysUpTime.0 100\n' > $@.exp
1183	printf 'iso.org.dod.internet.snmpV2.snmpModules.snmpMIB.snmpMIBObjects.snmpTrap.snmpTrapOID.0 iso.org.dod\n' >> $@.exp
1184	printf 'iso.org.dod.8 "hello world"\niso.org.dod.9 42\n' >> $@.exp
1185	> trap_output
1186	${SNMPTRAP} -v2c -cpublic 127.0.0.1 100 1.3.6 1.3.6.8 x '68 65 6c 6c 6f 20 77 6f 72 6c 64' 1.3.6.9 i 42
1187# Give snmpd some time to write out the data
1188	sleep 0.1
1189	cp trap_output $@.res
1190	diff -up $@.exp $@.res
1191
1192.include <bsd.regress.mk>
1193