xref: /freebsd/contrib/tcpdump/print-bootp.c (revision 6ae1554a5d9b318f8ad53ccc39fa5a961403da73)
1 /*
2  * Copyright (c) 1990, 1991, 1993, 1994, 1995, 1996, 1997
3  *	The Regents of the University of California.  All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that: (1) source code distributions
7  * retain the above copyright notice and this paragraph in its entirety, (2)
8  * distributions including binary code include the above copyright notice and
9  * this paragraph in its entirety in the documentation or other materials
10  * provided with the distribution, and (3) all advertising materials mentioning
11  * features or use of this software display the following acknowledgement:
12  * ``This product includes software developed by the University of California,
13  * Lawrence Berkeley Laboratory and its contributors.'' Neither the name of
14  * the University nor the names of its contributors may be used to endorse
15  * or promote products derived from this software without specific prior
16  * written permission.
17  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
18  * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
19  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
20  *
21  * Format and print bootp packets.
22  *
23  * $FreeBSD$
24  */
25 
26 #define NETDISSECT_REWORKED
27 #ifdef HAVE_CONFIG_H
28 #include "config.h"
29 #endif
30 
31 #include <tcpdump-stdinc.h>
32 
33 #include <string.h>
34 
35 #include "interface.h"
36 #include "addrtoname.h"
37 #include "extract.h"
38 
39 static const char tstr[] = " [|bootp]";
40 
41 /*
42  * Bootstrap Protocol (BOOTP).  RFC951 and RFC1048.
43  *
44  * This file specifies the "implementation-independent" BOOTP protocol
45  * information which is common to both client and server.
46  *
47  * Copyright 1988 by Carnegie Mellon.
48  *
49  * Permission to use, copy, modify, and distribute this program for any
50  * purpose and without fee is hereby granted, provided that this copyright
51  * and permission notice appear on all copies and supporting documentation,
52  * the name of Carnegie Mellon not be used in advertising or publicity
53  * pertaining to distribution of the program without specific prior
54  * permission, and notice be given in supporting documentation that copying
55  * and distribution is by permission of Carnegie Mellon and Stanford
56  * University.  Carnegie Mellon makes no representations about the
57  * suitability of this software for any purpose.  It is provided "as is"
58  * without express or implied warranty.
59  */
60 
61 struct bootp {
62 	uint8_t		bp_op;		/* packet opcode type */
63 	uint8_t		bp_htype;	/* hardware addr type */
64 	uint8_t		bp_hlen;	/* hardware addr length */
65 	uint8_t		bp_hops;	/* gateway hops */
66 	uint32_t	bp_xid;		/* transaction ID */
67 	uint16_t	bp_secs;	/* seconds since boot began */
68 	uint16_t	bp_flags;	/* flags - see bootp_flag_values[]
69 					   in print-bootp.c */
70 	struct in_addr	bp_ciaddr;	/* client IP address */
71 	struct in_addr	bp_yiaddr;	/* 'your' IP address */
72 	struct in_addr	bp_siaddr;	/* server IP address */
73 	struct in_addr	bp_giaddr;	/* gateway IP address */
74 	uint8_t		bp_chaddr[16];	/* client hardware address */
75 	uint8_t		bp_sname[64];	/* server host name */
76 	uint8_t		bp_file[128];	/* boot file name */
77 	uint8_t		bp_vend[64];	/* vendor-specific area */
78 } UNALIGNED;
79 
80 #define BOOTPREPLY	2
81 #define BOOTPREQUEST	1
82 
83 /*
84  * Vendor magic cookie (v_magic) for CMU
85  */
86 #define VM_CMU		"CMU"
87 
88 /*
89  * Vendor magic cookie (v_magic) for RFC1048
90  */
91 #define VM_RFC1048	{ 99, 130, 83, 99 }
92 
93 /*
94  * RFC1048 tag values used to specify what information is being supplied in
95  * the vendor field of the packet.
96  */
97 
98 #define TAG_PAD			((uint8_t)   0)
99 #define TAG_SUBNET_MASK		((uint8_t)   1)
100 #define TAG_TIME_OFFSET		((uint8_t)   2)
101 #define TAG_GATEWAY		((uint8_t)   3)
102 #define TAG_TIME_SERVER		((uint8_t)   4)
103 #define TAG_NAME_SERVER		((uint8_t)   5)
104 #define TAG_DOMAIN_SERVER	((uint8_t)   6)
105 #define TAG_LOG_SERVER		((uint8_t)   7)
106 #define TAG_COOKIE_SERVER	((uint8_t)   8)
107 #define TAG_LPR_SERVER		((uint8_t)   9)
108 #define TAG_IMPRESS_SERVER	((uint8_t)  10)
109 #define TAG_RLP_SERVER		((uint8_t)  11)
110 #define TAG_HOSTNAME		((uint8_t)  12)
111 #define TAG_BOOTSIZE		((uint8_t)  13)
112 #define TAG_END			((uint8_t) 255)
113 /* RFC1497 tags */
114 #define	TAG_DUMPPATH		((uint8_t)  14)
115 #define	TAG_DOMAINNAME		((uint8_t)  15)
116 #define	TAG_SWAP_SERVER		((uint8_t)  16)
117 #define	TAG_ROOTPATH		((uint8_t)  17)
118 #define	TAG_EXTPATH		((uint8_t)  18)
119 /* RFC2132 */
120 #define	TAG_IP_FORWARD		((uint8_t)  19)
121 #define	TAG_NL_SRCRT		((uint8_t)  20)
122 #define	TAG_PFILTERS		((uint8_t)  21)
123 #define	TAG_REASS_SIZE		((uint8_t)  22)
124 #define	TAG_DEF_TTL		((uint8_t)  23)
125 #define	TAG_MTU_TIMEOUT		((uint8_t)  24)
126 #define	TAG_MTU_TABLE		((uint8_t)  25)
127 #define	TAG_INT_MTU		((uint8_t)  26)
128 #define	TAG_LOCAL_SUBNETS	((uint8_t)  27)
129 #define	TAG_BROAD_ADDR		((uint8_t)  28)
130 #define	TAG_DO_MASK_DISC	((uint8_t)  29)
131 #define	TAG_SUPPLY_MASK		((uint8_t)  30)
132 #define	TAG_DO_RDISC		((uint8_t)  31)
133 #define	TAG_RTR_SOL_ADDR	((uint8_t)  32)
134 #define	TAG_STATIC_ROUTE	((uint8_t)  33)
135 #define	TAG_USE_TRAILERS	((uint8_t)  34)
136 #define	TAG_ARP_TIMEOUT		((uint8_t)  35)
137 #define	TAG_ETH_ENCAP		((uint8_t)  36)
138 #define	TAG_TCP_TTL		((uint8_t)  37)
139 #define	TAG_TCP_KEEPALIVE	((uint8_t)  38)
140 #define	TAG_KEEPALIVE_GO	((uint8_t)  39)
141 #define	TAG_NIS_DOMAIN		((uint8_t)  40)
142 #define	TAG_NIS_SERVERS		((uint8_t)  41)
143 #define	TAG_NTP_SERVERS		((uint8_t)  42)
144 #define	TAG_VENDOR_OPTS		((uint8_t)  43)
145 #define	TAG_NETBIOS_NS		((uint8_t)  44)
146 #define	TAG_NETBIOS_DDS		((uint8_t)  45)
147 #define	TAG_NETBIOS_NODE	((uint8_t)  46)
148 #define	TAG_NETBIOS_SCOPE	((uint8_t)  47)
149 #define	TAG_XWIN_FS		((uint8_t)  48)
150 #define	TAG_XWIN_DM		((uint8_t)  49)
151 #define	TAG_NIS_P_DOMAIN	((uint8_t)  64)
152 #define	TAG_NIS_P_SERVERS	((uint8_t)  65)
153 #define	TAG_MOBILE_HOME		((uint8_t)  68)
154 #define	TAG_SMPT_SERVER		((uint8_t)  69)
155 #define	TAG_POP3_SERVER		((uint8_t)  70)
156 #define	TAG_NNTP_SERVER		((uint8_t)  71)
157 #define	TAG_WWW_SERVER		((uint8_t)  72)
158 #define	TAG_FINGER_SERVER	((uint8_t)  73)
159 #define	TAG_IRC_SERVER		((uint8_t)  74)
160 #define	TAG_STREETTALK_SRVR	((uint8_t)  75)
161 #define	TAG_STREETTALK_STDA	((uint8_t)  76)
162 /* DHCP options */
163 #define	TAG_REQUESTED_IP	((uint8_t)  50)
164 #define	TAG_IP_LEASE		((uint8_t)  51)
165 #define	TAG_OPT_OVERLOAD	((uint8_t)  52)
166 #define	TAG_TFTP_SERVER		((uint8_t)  66)
167 #define	TAG_BOOTFILENAME	((uint8_t)  67)
168 #define	TAG_DHCP_MESSAGE	((uint8_t)  53)
169 #define	TAG_SERVER_ID		((uint8_t)  54)
170 #define	TAG_PARM_REQUEST	((uint8_t)  55)
171 #define	TAG_MESSAGE		((uint8_t)  56)
172 #define	TAG_MAX_MSG_SIZE	((uint8_t)  57)
173 #define	TAG_RENEWAL_TIME	((uint8_t)  58)
174 #define	TAG_REBIND_TIME		((uint8_t)  59)
175 #define	TAG_VENDOR_CLASS	((uint8_t)  60)
176 #define	TAG_CLIENT_ID		((uint8_t)  61)
177 /* RFC 2241 */
178 #define	TAG_NDS_SERVERS		((uint8_t)  85)
179 #define	TAG_NDS_TREE_NAME	((uint8_t)  86)
180 #define	TAG_NDS_CONTEXT		((uint8_t)  87)
181 /* RFC 2242 */
182 #define	TAG_NDS_IPDOMAIN	((uint8_t)  62)
183 #define	TAG_NDS_IPINFO		((uint8_t)  63)
184 /* RFC 2485 */
185 #define	TAG_OPEN_GROUP_UAP	((uint8_t)  98)
186 /* RFC 2563 */
187 #define	TAG_DISABLE_AUTOCONF	((uint8_t) 116)
188 /* RFC 2610 */
189 #define	TAG_SLP_DA		((uint8_t)  78)
190 #define	TAG_SLP_SCOPE		((uint8_t)  79)
191 /* RFC 2937 */
192 #define	TAG_NS_SEARCH		((uint8_t) 117)
193 /* RFC 3004 - The User Class Option for DHCP */
194 #define	TAG_USER_CLASS		((uint8_t)  77)
195 /* RFC 3011 */
196 #define	TAG_IP4_SUBNET_SELECT	((uint8_t) 118)
197 /* RFC 3442 */
198 #define TAG_CLASSLESS_STATIC_RT	((uint8_t) 121)
199 #define TAG_CLASSLESS_STA_RT_MS	((uint8_t) 249)
200 /* RFC 5859 - TFTP Server Address Option for DHCPv4 */
201 #define	TAG_TFTP_SERVER_ADDRESS	((uint8_t) 150)
202 /* ftp://ftp.isi.edu/.../assignments/bootp-dhcp-extensions */
203 #define	TAG_SLP_NAMING_AUTH	((uint8_t)  80)
204 #define	TAG_CLIENT_FQDN		((uint8_t)  81)
205 #define	TAG_AGENT_CIRCUIT	((uint8_t)  82)
206 #define	TAG_AGENT_REMOTE	((uint8_t)  83)
207 #define	TAG_AGENT_MASK		((uint8_t)  84)
208 #define	TAG_TZ_STRING		((uint8_t)  88)
209 #define	TAG_FQDN_OPTION		((uint8_t)  89)
210 #define	TAG_AUTH		((uint8_t)  90)
211 #define	TAG_VINES_SERVERS	((uint8_t)  91)
212 #define	TAG_SERVER_RANK		((uint8_t)  92)
213 #define	TAG_CLIENT_ARCH		((uint8_t)  93)
214 #define	TAG_CLIENT_NDI		((uint8_t)  94)
215 #define	TAG_CLIENT_GUID		((uint8_t)  97)
216 #define	TAG_LDAP_URL		((uint8_t)  95)
217 #define	TAG_6OVER4		((uint8_t)  96)
218 #define	TAG_PRINTER_NAME	((uint8_t) 100)
219 #define	TAG_MDHCP_SERVER	((uint8_t) 101)
220 #define	TAG_IPX_COMPAT		((uint8_t) 110)
221 #define	TAG_NETINFO_PARENT	((uint8_t) 112)
222 #define	TAG_NETINFO_PARENT_TAG	((uint8_t) 113)
223 #define	TAG_URL			((uint8_t) 114)
224 #define	TAG_FAILOVER		((uint8_t) 115)
225 #define	TAG_EXTENDED_REQUEST	((uint8_t) 126)
226 #define	TAG_EXTENDED_OPTION	((uint8_t) 127)
227 
228 /* DHCP Message types (values for TAG_DHCP_MESSAGE option) */
229 #define DHCPDISCOVER	1
230 #define DHCPOFFER	2
231 #define DHCPREQUEST	3
232 #define DHCPDECLINE	4
233 #define DHCPACK		5
234 #define DHCPNAK		6
235 #define DHCPRELEASE	7
236 #define DHCPINFORM	8
237 
238 /*
239  * "vendor" data permitted for CMU bootp clients.
240  */
241 
242 struct cmu_vend {
243 	uint8_t		v_magic[4];	/* magic number */
244 	uint32_t	v_flags;	/* flags/opcodes, etc. */
245 	struct in_addr	v_smask;	/* Subnet mask */
246 	struct in_addr	v_dgate;	/* Default gateway */
247 	struct in_addr	v_dns1, v_dns2; /* Domain name servers */
248 	struct in_addr	v_ins1, v_ins2; /* IEN-116 name servers */
249 	struct in_addr	v_ts1, v_ts2;	/* Time servers */
250 	uint8_t		v_unused[24];	/* currently unused */
251 } UNALIGNED;
252 
253 
254 /* v_flags values */
255 #define VF_SMASK	1	/* Subnet mask field contains valid data */
256 
257 /* RFC 4702 DHCP Client FQDN Option */
258 
259 #define CLIENT_FQDN_FLAGS_S	0x01
260 #define CLIENT_FQDN_FLAGS_O	0x02
261 #define CLIENT_FQDN_FLAGS_E	0x04
262 #define CLIENT_FQDN_FLAGS_N	0x08
263 /* end of original bootp.h */
264 
265 static void rfc1048_print(netdissect_options *, const u_char *);
266 static void cmu_print(netdissect_options *, const u_char *);
267 static char *client_fqdn_flags(u_int flags);
268 
269 static const struct tok bootp_flag_values[] = {
270 	{ 0x8000,	"Broadcast" },
271 	{ 0, NULL}
272 };
273 
274 static const struct tok bootp_op_values[] = {
275 	{ BOOTPREQUEST,	"Request" },
276 	{ BOOTPREPLY,	"Reply" },
277 	{ 0, NULL}
278 };
279 
280 /*
281  * Print bootp requests
282  */
283 void
284 bootp_print(netdissect_options *ndo,
285 	    register const u_char *cp, u_int length)
286 {
287 	register const struct bootp *bp;
288 	static const u_char vm_cmu[4] = VM_CMU;
289 	static const u_char vm_rfc1048[4] = VM_RFC1048;
290 
291 	bp = (const struct bootp *)cp;
292 	ND_TCHECK(bp->bp_op);
293 
294 	ND_PRINT((ndo, "BOOTP/DHCP, %s",
295 		  tok2str(bootp_op_values, "unknown (0x%02x)", bp->bp_op)));
296 
297 	if (bp->bp_htype == 1 && bp->bp_hlen == 6 && bp->bp_op == BOOTPREQUEST) {
298 		ND_TCHECK2(bp->bp_chaddr[0], 6);
299 		ND_PRINT((ndo, " from %s", etheraddr_string(ndo, bp->bp_chaddr)));
300 	}
301 
302 	ND_PRINT((ndo, ", length %u", length));
303 
304 	if (!ndo->ndo_vflag)
305 		return;
306 
307 	ND_TCHECK(bp->bp_secs);
308 
309 	/* The usual hardware address type is 1 (10Mb Ethernet) */
310 	if (bp->bp_htype != 1)
311 		ND_PRINT((ndo, ", htype %d", bp->bp_htype));
312 
313 	/* The usual length for 10Mb Ethernet address is 6 bytes */
314 	if (bp->bp_htype != 1 || bp->bp_hlen != 6)
315 		ND_PRINT((ndo, ", hlen %d", bp->bp_hlen));
316 
317 	/* Only print interesting fields */
318 	if (bp->bp_hops)
319 		ND_PRINT((ndo, ", hops %d", bp->bp_hops));
320 	if (EXTRACT_32BITS(&bp->bp_xid))
321 		ND_PRINT((ndo, ", xid 0x%x", EXTRACT_32BITS(&bp->bp_xid)));
322 	if (EXTRACT_16BITS(&bp->bp_secs))
323 		ND_PRINT((ndo, ", secs %d", EXTRACT_16BITS(&bp->bp_secs)));
324 
325 	ND_PRINT((ndo, ", Flags [%s]",
326 		  bittok2str(bootp_flag_values, "none", EXTRACT_16BITS(&bp->bp_flags))));
327 	if (ndo->ndo_vflag > 1)
328 		ND_PRINT((ndo, " (0x%04x)", EXTRACT_16BITS(&bp->bp_flags)));
329 
330 	/* Client's ip address */
331 	ND_TCHECK(bp->bp_ciaddr);
332 	if (EXTRACT_32BITS(&bp->bp_ciaddr.s_addr))
333 		ND_PRINT((ndo, "\n\t  Client-IP %s", ipaddr_string(ndo, &bp->bp_ciaddr)));
334 
335 	/* 'your' ip address (bootp client) */
336 	ND_TCHECK(bp->bp_yiaddr);
337 	if (EXTRACT_32BITS(&bp->bp_yiaddr.s_addr))
338 		ND_PRINT((ndo, "\n\t  Your-IP %s", ipaddr_string(ndo, &bp->bp_yiaddr)));
339 
340 	/* Server's ip address */
341 	ND_TCHECK(bp->bp_siaddr);
342 	if (EXTRACT_32BITS(&bp->bp_siaddr.s_addr))
343 		ND_PRINT((ndo, "\n\t  Server-IP %s", ipaddr_string(ndo, &bp->bp_siaddr)));
344 
345 	/* Gateway's ip address */
346 	ND_TCHECK(bp->bp_giaddr);
347 	if (EXTRACT_32BITS(&bp->bp_giaddr.s_addr))
348 		ND_PRINT((ndo, "\n\t  Gateway-IP %s", ipaddr_string(ndo, &bp->bp_giaddr)));
349 
350 	/* Client's Ethernet address */
351 	if (bp->bp_htype == 1 && bp->bp_hlen == 6) {
352 		ND_TCHECK2(bp->bp_chaddr[0], 6);
353 		ND_PRINT((ndo, "\n\t  Client-Ethernet-Address %s", etheraddr_string(ndo, bp->bp_chaddr)));
354 	}
355 
356 	ND_TCHECK2(bp->bp_sname[0], 1);		/* check first char only */
357 	if (*bp->bp_sname) {
358 		ND_PRINT((ndo, "\n\t  sname \""));
359 		if (fn_print(ndo, bp->bp_sname, ndo->ndo_snapend)) {
360 			ND_PRINT((ndo, "\""));
361 			ND_PRINT((ndo, "%s", tstr + 1));
362 			return;
363 		}
364 		ND_PRINT((ndo, "\""));
365 	}
366 	ND_TCHECK2(bp->bp_file[0], 1);		/* check first char only */
367 	if (*bp->bp_file) {
368 		ND_PRINT((ndo, "\n\t  file \""));
369 		if (fn_print(ndo, bp->bp_file, ndo->ndo_snapend)) {
370 			ND_PRINT((ndo, "\""));
371 			ND_PRINT((ndo, "%s", tstr + 1));
372 			return;
373 		}
374 		ND_PRINT((ndo, "\""));
375 	}
376 
377 	/* Decode the vendor buffer */
378 	ND_TCHECK(bp->bp_vend[0]);
379 	if (memcmp((const char *)bp->bp_vend, vm_rfc1048,
380 		    sizeof(uint32_t)) == 0)
381 		rfc1048_print(ndo, bp->bp_vend);
382 	else if (memcmp((const char *)bp->bp_vend, vm_cmu,
383 			sizeof(uint32_t)) == 0)
384 		cmu_print(ndo, bp->bp_vend);
385 	else {
386 		uint32_t ul;
387 
388 		ul = EXTRACT_32BITS(&bp->bp_vend);
389 		if (ul != 0)
390 			ND_PRINT((ndo, "\n\t  Vendor-#0x%x", ul));
391 	}
392 
393 	return;
394 trunc:
395 	ND_PRINT((ndo, "%s", tstr));
396 }
397 
398 /*
399  * The first character specifies the format to print:
400  *     i - ip address (32 bits)
401  *     p - ip address pairs (32 bits + 32 bits)
402  *     l - long (32 bits)
403  *     L - unsigned long (32 bits)
404  *     s - short (16 bits)
405  *     b - period-seperated decimal bytes (variable length)
406  *     x - colon-seperated hex bytes (variable length)
407  *     a - ascii string (variable length)
408  *     B - on/off (8 bits)
409  *     $ - special (explicit code to handle)
410  */
411 static const struct tok tag2str[] = {
412 /* RFC1048 tags */
413 	{ TAG_PAD,		" PAD" },
414 	{ TAG_SUBNET_MASK,	"iSubnet-Mask" },	/* subnet mask (RFC950) */
415 	{ TAG_TIME_OFFSET,	"LTime-Zone" },	/* seconds from UTC */
416 	{ TAG_GATEWAY,		"iDefault-Gateway" },	/* default gateway */
417 	{ TAG_TIME_SERVER,	"iTime-Server" },	/* time servers (RFC868) */
418 	{ TAG_NAME_SERVER,	"iIEN-Name-Server" },	/* IEN name servers (IEN116) */
419 	{ TAG_DOMAIN_SERVER,	"iDomain-Name-Server" },	/* domain name (RFC1035) */
420 	{ TAG_LOG_SERVER,	"iLOG" },	/* MIT log servers */
421 	{ TAG_COOKIE_SERVER,	"iCS" },	/* cookie servers (RFC865) */
422 	{ TAG_LPR_SERVER,	"iLPR-Server" },	/* lpr server (RFC1179) */
423 	{ TAG_IMPRESS_SERVER,	"iIM" },	/* impress servers (Imagen) */
424 	{ TAG_RLP_SERVER,	"iRL" },	/* resource location (RFC887) */
425 	{ TAG_HOSTNAME,		"aHostname" },	/* ascii hostname */
426 	{ TAG_BOOTSIZE,		"sBS" },	/* 512 byte blocks */
427 	{ TAG_END,		" END" },
428 /* RFC1497 tags */
429 	{ TAG_DUMPPATH,		"aDP" },
430 	{ TAG_DOMAINNAME,	"aDomain-Name" },
431 	{ TAG_SWAP_SERVER,	"iSS" },
432 	{ TAG_ROOTPATH,		"aRP" },
433 	{ TAG_EXTPATH,		"aEP" },
434 /* RFC2132 tags */
435 	{ TAG_IP_FORWARD,	"BIPF" },
436 	{ TAG_NL_SRCRT,		"BSRT" },
437 	{ TAG_PFILTERS,		"pPF" },
438 	{ TAG_REASS_SIZE,	"sRSZ" },
439 	{ TAG_DEF_TTL,		"bTTL" },
440 	{ TAG_MTU_TIMEOUT,	"lMTU-Timeout" },
441 	{ TAG_MTU_TABLE,	"sMTU-Table" },
442 	{ TAG_INT_MTU,		"sMTU" },
443 	{ TAG_LOCAL_SUBNETS,	"BLSN" },
444 	{ TAG_BROAD_ADDR,	"iBR" },
445 	{ TAG_DO_MASK_DISC,	"BMD" },
446 	{ TAG_SUPPLY_MASK,	"BMS" },
447 	{ TAG_DO_RDISC,		"BRouter-Discovery" },
448 	{ TAG_RTR_SOL_ADDR,	"iRSA" },
449 	{ TAG_STATIC_ROUTE,	"pStatic-Route" },
450 	{ TAG_USE_TRAILERS,	"BUT" },
451 	{ TAG_ARP_TIMEOUT,	"lAT" },
452 	{ TAG_ETH_ENCAP,	"BIE" },
453 	{ TAG_TCP_TTL,		"bTT" },
454 	{ TAG_TCP_KEEPALIVE,	"lKI" },
455 	{ TAG_KEEPALIVE_GO,	"BKG" },
456 	{ TAG_NIS_DOMAIN,	"aYD" },
457 	{ TAG_NIS_SERVERS,	"iYS" },
458 	{ TAG_NTP_SERVERS,	"iNTP" },
459 	{ TAG_VENDOR_OPTS,	"bVendor-Option" },
460 	{ TAG_NETBIOS_NS,	"iNetbios-Name-Server" },
461 	{ TAG_NETBIOS_DDS,	"iWDD" },
462 	{ TAG_NETBIOS_NODE,	"$Netbios-Node" },
463 	{ TAG_NETBIOS_SCOPE,	"aNetbios-Scope" },
464 	{ TAG_XWIN_FS,		"iXFS" },
465 	{ TAG_XWIN_DM,		"iXDM" },
466 	{ TAG_NIS_P_DOMAIN,	"sN+D" },
467 	{ TAG_NIS_P_SERVERS,	"iN+S" },
468 	{ TAG_MOBILE_HOME,	"iMH" },
469 	{ TAG_SMPT_SERVER,	"iSMTP" },
470 	{ TAG_POP3_SERVER,	"iPOP3" },
471 	{ TAG_NNTP_SERVER,	"iNNTP" },
472 	{ TAG_WWW_SERVER,	"iWWW" },
473 	{ TAG_FINGER_SERVER,	"iFG" },
474 	{ TAG_IRC_SERVER,	"iIRC" },
475 	{ TAG_STREETTALK_SRVR,	"iSTS" },
476 	{ TAG_STREETTALK_STDA,	"iSTDA" },
477 	{ TAG_REQUESTED_IP,	"iRequested-IP" },
478 	{ TAG_IP_LEASE,		"lLease-Time" },
479 	{ TAG_OPT_OVERLOAD,	"$OO" },
480 	{ TAG_TFTP_SERVER,	"aTFTP" },
481 	{ TAG_BOOTFILENAME,	"aBF" },
482 	{ TAG_DHCP_MESSAGE,	" DHCP-Message" },
483 	{ TAG_SERVER_ID,	"iServer-ID" },
484 	{ TAG_PARM_REQUEST,	"bParameter-Request" },
485 	{ TAG_MESSAGE,		"aMSG" },
486 	{ TAG_MAX_MSG_SIZE,	"sMSZ" },
487 	{ TAG_RENEWAL_TIME,	"lRN" },
488 	{ TAG_REBIND_TIME,	"lRB" },
489 	{ TAG_VENDOR_CLASS,	"aVendor-Class" },
490 	{ TAG_CLIENT_ID,	"$Client-ID" },
491 /* RFC 2485 */
492 	{ TAG_OPEN_GROUP_UAP,	"aUAP" },
493 /* RFC 2563 */
494 	{ TAG_DISABLE_AUTOCONF,	"BNOAUTO" },
495 /* RFC 2610 */
496 	{ TAG_SLP_DA,		"bSLP-DA" },	/*"b" is a little wrong */
497 	{ TAG_SLP_SCOPE,	"bSLP-SCOPE" },	/*"b" is a little wrong */
498 /* RFC 2937 */
499 	{ TAG_NS_SEARCH,	"sNSSEARCH" },	/* XXX 's' */
500 /* RFC 3004 - The User Class Option for DHCP */
501 	{ TAG_USER_CLASS,	"$User-Class" },
502 /* RFC 3011 */
503 	{ TAG_IP4_SUBNET_SELECT, "iSUBNET" },
504 /* RFC 3442 */
505 	{ TAG_CLASSLESS_STATIC_RT, "$Classless-Static-Route" },
506 	{ TAG_CLASSLESS_STA_RT_MS, "$Classless-Static-Route-Microsoft" },
507 /* RFC 5859 - TFTP Server Address Option for DHCPv4 */
508 	{ TAG_TFTP_SERVER_ADDRESS, "iTFTP-Server-Address" },
509 /* http://www.iana.org/assignments/bootp-dhcp-extensions/index.htm */
510 	{ TAG_SLP_NAMING_AUTH,	"aSLP-NA" },
511 	{ TAG_CLIENT_FQDN,	"$FQDN" },
512 	{ TAG_AGENT_CIRCUIT,	"$Agent-Information" },
513 	{ TAG_AGENT_REMOTE,	"bARMT" },
514 	{ TAG_AGENT_MASK,	"bAMSK" },
515 	{ TAG_TZ_STRING,	"aTZSTR" },
516 	{ TAG_FQDN_OPTION,	"bFQDNS" },	/* XXX 'b' */
517 	{ TAG_AUTH,		"bAUTH" },	/* XXX 'b' */
518 	{ TAG_VINES_SERVERS,	"iVINES" },
519 	{ TAG_SERVER_RANK,	"sRANK" },
520 	{ TAG_CLIENT_ARCH,	"sARCH" },
521 	{ TAG_CLIENT_NDI,	"bNDI" },	/* XXX 'b' */
522 	{ TAG_CLIENT_GUID,	"bGUID" },	/* XXX 'b' */
523 	{ TAG_LDAP_URL,		"aLDAP" },
524 	{ TAG_6OVER4,		"i6o4" },
525 	{ TAG_PRINTER_NAME,	"aPRTR" },
526 	{ TAG_MDHCP_SERVER,	"bMDHCP" },	/* XXX 'b' */
527 	{ TAG_IPX_COMPAT,	"bIPX" },	/* XXX 'b' */
528 	{ TAG_NETINFO_PARENT,	"iNI" },
529 	{ TAG_NETINFO_PARENT_TAG, "aNITAG" },
530 	{ TAG_URL,		"aURL" },
531 	{ TAG_FAILOVER,		"bFAIL" },	/* XXX 'b' */
532 	{ 0, NULL }
533 };
534 /* 2-byte extended tags */
535 static const struct tok xtag2str[] = {
536 	{ 0, NULL }
537 };
538 
539 /* DHCP "options overload" types */
540 static const struct tok oo2str[] = {
541 	{ 1,	"file" },
542 	{ 2,	"sname" },
543 	{ 3,	"file+sname" },
544 	{ 0, NULL }
545 };
546 
547 /* NETBIOS over TCP/IP node type options */
548 static const struct tok nbo2str[] = {
549 	{ 0x1,	"b-node" },
550 	{ 0x2,	"p-node" },
551 	{ 0x4,	"m-node" },
552 	{ 0x8,	"h-node" },
553 	{ 0, NULL }
554 };
555 
556 /* ARP Hardware types, for Client-ID option */
557 static const struct tok arp2str[] = {
558 	{ 0x1,	"ether" },
559 	{ 0x6,	"ieee802" },
560 	{ 0x7,	"arcnet" },
561 	{ 0xf,	"frelay" },
562 	{ 0x17,	"strip" },
563 	{ 0x18,	"ieee1394" },
564 	{ 0, NULL }
565 };
566 
567 static const struct tok dhcp_msg_values[] = {
568 	{ DHCPDISCOVER,	"Discover" },
569 	{ DHCPOFFER,	"Offer" },
570 	{ DHCPREQUEST,	"Request" },
571 	{ DHCPDECLINE,	"Decline" },
572 	{ DHCPACK,	"ACK" },
573 	{ DHCPNAK,	"NACK" },
574 	{ DHCPRELEASE,	"Release" },
575 	{ DHCPINFORM,	"Inform" },
576 	{ 0, NULL }
577 };
578 
579 #define AGENT_SUBOPTION_CIRCUIT_ID	1	/* RFC 3046 */
580 #define AGENT_SUBOPTION_REMOTE_ID	2	/* RFC 3046 */
581 #define AGENT_SUBOPTION_SUBSCRIBER_ID	6	/* RFC 3993 */
582 static const struct tok agent_suboption_values[] = {
583 	{ AGENT_SUBOPTION_CIRCUIT_ID,    "Circuit-ID" },
584 	{ AGENT_SUBOPTION_REMOTE_ID,     "Remote-ID" },
585 	{ AGENT_SUBOPTION_SUBSCRIBER_ID, "Subscriber-ID" },
586 	{ 0, NULL }
587 };
588 
589 
590 static void
591 rfc1048_print(netdissect_options *ndo,
592 	      register const u_char *bp)
593 {
594 	register uint16_t tag;
595 	register u_int len;
596 	register const char *cp;
597 	register char c;
598 	int first, idx;
599 	uint32_t ul;
600 	uint16_t us;
601 	uint8_t uc, subopt, suboptlen;
602 
603 	ND_PRINT((ndo, "\n\t  Vendor-rfc1048 Extensions"));
604 
605 	/* Step over magic cookie */
606 	ND_PRINT((ndo, "\n\t    Magic Cookie 0x%08x", EXTRACT_32BITS(bp)));
607 	bp += sizeof(int32_t);
608 
609 	/* Loop while we there is a tag left in the buffer */
610 	while (ND_TTEST2(*bp, 1)) {
611 		tag = *bp++;
612 		if (tag == TAG_PAD && ndo->ndo_vflag < 3)
613 			continue;
614 		if (tag == TAG_END && ndo->ndo_vflag < 3)
615 			return;
616 		if (tag == TAG_EXTENDED_OPTION) {
617 			ND_TCHECK2(*(bp + 1), 2);
618 			tag = EXTRACT_16BITS(bp + 1);
619 			/* XXX we don't know yet if the IANA will
620 			 * preclude overlap of 1-byte and 2-byte spaces.
621 			 * If not, we need to offset tag after this step.
622 			 */
623 			cp = tok2str(xtag2str, "?xT%u", tag);
624 		} else
625 			cp = tok2str(tag2str, "?T%u", tag);
626 		c = *cp++;
627 
628 		if (tag == TAG_PAD || tag == TAG_END)
629 			len = 0;
630 		else {
631 			/* Get the length; check for truncation */
632 			ND_TCHECK2(*bp, 1);
633 			len = *bp++;
634 		}
635 
636 		ND_PRINT((ndo, "\n\t    %s Option %u, length %u%s", cp, tag, len,
637 			  len > 0 ? ": " : ""));
638 
639 		if (tag == TAG_PAD && ndo->ndo_vflag > 2) {
640 			u_int ntag = 1;
641 			while (ND_TTEST2(*bp, 1) && *bp == TAG_PAD) {
642 				bp++;
643 				ntag++;
644 			}
645 			if (ntag > 1)
646 				ND_PRINT((ndo, ", occurs %u", ntag));
647 		}
648 
649 		if (!ND_TTEST2(*bp, len)) {
650 			ND_PRINT((ndo, "[|rfc1048 %u]", len));
651 			return;
652 		}
653 
654 		if (tag == TAG_DHCP_MESSAGE && len == 1) {
655 			uc = *bp++;
656 			ND_PRINT((ndo, "%s", tok2str(dhcp_msg_values, "Unknown (%u)", uc)));
657 			continue;
658 		}
659 
660 		if (tag == TAG_PARM_REQUEST) {
661 			idx = 0;
662 			while (len-- > 0) {
663 				uc = *bp++;
664 				cp = tok2str(tag2str, "?Option %u", uc);
665 				if (idx % 4 == 0)
666 					ND_PRINT((ndo, "\n\t      "));
667 				else
668 					ND_PRINT((ndo, ", "));
669 				ND_PRINT((ndo, "%s", cp + 1));
670 				idx++;
671 			}
672 			continue;
673 		}
674 
675 		if (tag == TAG_EXTENDED_REQUEST) {
676 			first = 1;
677 			while (len > 1) {
678 				len -= 2;
679 				us = EXTRACT_16BITS(bp);
680 				bp += 2;
681 				cp = tok2str(xtag2str, "?xT%u", us);
682 				if (!first)
683 					ND_PRINT((ndo, "+"));
684 				ND_PRINT((ndo, "%s", cp + 1));
685 				first = 0;
686 			}
687 			continue;
688 		}
689 
690 		/* Print data */
691 		if (c == '?') {
692 			/* Base default formats for unknown tags on data size */
693 			if (len & 1)
694 				c = 'b';
695 			else if (len & 2)
696 				c = 's';
697 			else
698 				c = 'l';
699 		}
700 		first = 1;
701 		switch (c) {
702 
703 		case 'a':
704 			/* ascii strings */
705 			ND_PRINT((ndo, "\""));
706 			if (fn_printn(ndo, bp, len, ndo->ndo_snapend)) {
707 				ND_PRINT((ndo, "\""));
708 				goto trunc;
709 			}
710 			ND_PRINT((ndo, "\""));
711 			bp += len;
712 			len = 0;
713 			break;
714 
715 		case 'i':
716 		case 'l':
717 		case 'L':
718 			/* ip addresses/32-bit words */
719 			while (len >= sizeof(ul)) {
720 				if (!first)
721 					ND_PRINT((ndo, ","));
722 				ul = EXTRACT_32BITS(bp);
723 				if (c == 'i') {
724 					ul = htonl(ul);
725 					ND_PRINT((ndo, "%s", ipaddr_string(ndo, &ul)));
726 				} else if (c == 'L')
727 					ND_PRINT((ndo, "%d", ul));
728 				else
729 					ND_PRINT((ndo, "%u", ul));
730 				bp += sizeof(ul);
731 				len -= sizeof(ul);
732 				first = 0;
733 			}
734 			break;
735 
736 		case 'p':
737 			/* IP address pairs */
738 			while (len >= 2*sizeof(ul)) {
739 				if (!first)
740 					ND_PRINT((ndo, ","));
741 				memcpy((char *)&ul, (const char *)bp, sizeof(ul));
742 				ND_PRINT((ndo, "(%s:", ipaddr_string(ndo, &ul)));
743 				bp += sizeof(ul);
744 				memcpy((char *)&ul, (const char *)bp, sizeof(ul));
745 				ND_PRINT((ndo, "%s)", ipaddr_string(ndo, &ul)));
746 				bp += sizeof(ul);
747 				len -= 2*sizeof(ul);
748 				first = 0;
749 			}
750 			break;
751 
752 		case 's':
753 			/* shorts */
754 			while (len >= sizeof(us)) {
755 				if (!first)
756 					ND_PRINT((ndo, ","));
757 				us = EXTRACT_16BITS(bp);
758 				ND_PRINT((ndo, "%u", us));
759 				bp += sizeof(us);
760 				len -= sizeof(us);
761 				first = 0;
762 			}
763 			break;
764 
765 		case 'B':
766 			/* boolean */
767 			while (len > 0) {
768 				if (!first)
769 					ND_PRINT((ndo, ","));
770 				switch (*bp) {
771 				case 0:
772 					ND_PRINT((ndo, "N"));
773 					break;
774 				case 1:
775 					ND_PRINT((ndo, "Y"));
776 					break;
777 				default:
778 					ND_PRINT((ndo, "%u?", *bp));
779 					break;
780 				}
781 				++bp;
782 				--len;
783 				first = 0;
784 			}
785 			break;
786 
787 		case 'b':
788 		case 'x':
789 		default:
790 			/* Bytes */
791 			while (len > 0) {
792 				if (!first)
793 					ND_PRINT((ndo, c == 'x' ? ":" : "."));
794 				if (c == 'x')
795 					ND_PRINT((ndo, "%02x", *bp));
796 				else
797 					ND_PRINT((ndo, "%u", *bp));
798 				++bp;
799 				--len;
800 				first = 0;
801 			}
802 			break;
803 
804 		case '$':
805 			/* Guys we can't handle with one of the usual cases */
806 			switch (tag) {
807 
808 			case TAG_NETBIOS_NODE:
809 				/* this option should be at least 1 byte long */
810 				if (len < 1) {
811 					ND_PRINT((ndo, "ERROR: length < 1 bytes"));
812 					break;
813 				}
814 				tag = *bp++;
815 				--len;
816 				ND_PRINT((ndo, "%s", tok2str(nbo2str, NULL, tag)));
817 				break;
818 
819 			case TAG_OPT_OVERLOAD:
820 				/* this option should be at least 1 byte long */
821 				if (len < 1) {
822 					ND_PRINT((ndo, "ERROR: length < 1 bytes"));
823 					break;
824 				}
825 				tag = *bp++;
826 				--len;
827 				ND_PRINT((ndo, "%s", tok2str(oo2str, NULL, tag)));
828 				break;
829 
830 			case TAG_CLIENT_FQDN:
831 				/* this option should be at least 3 bytes long */
832 				if (len < 3) {
833 					ND_PRINT((ndo, "ERROR: length < 3 bytes"));
834 					bp += len;
835 					len = 0;
836 					break;
837 				}
838 				if (*bp)
839 					ND_PRINT((ndo, "[%s] ", client_fqdn_flags(*bp)));
840 				bp++;
841 				if (*bp || *(bp+1))
842 					ND_PRINT((ndo, "%u/%u ", *bp, *(bp+1)));
843 				bp += 2;
844 				ND_PRINT((ndo, "\""));
845 				if (fn_printn(ndo, bp, len - 3, ndo->ndo_snapend)) {
846 					ND_PRINT((ndo, "\""));
847 					goto trunc;
848 				}
849 				ND_PRINT((ndo, "\""));
850 				bp += len - 3;
851 				len = 0;
852 				break;
853 
854 			case TAG_CLIENT_ID:
855 			    {
856 				int type;
857 
858 				/* this option should be at least 1 byte long */
859 				if (len < 1) {
860 					ND_PRINT((ndo, "ERROR: length < 1 bytes"));
861 					break;
862 				}
863 				type = *bp++;
864 				len--;
865 				if (type == 0) {
866 					ND_PRINT((ndo, "\""));
867 					if (fn_printn(ndo, bp, len, ndo->ndo_snapend)) {
868 						ND_PRINT((ndo, "\""));
869 						goto trunc;
870 					}
871 					ND_PRINT((ndo, "\""));
872 					bp += len;
873 					len = 0;
874 					break;
875 				} else {
876 					ND_PRINT((ndo, "%s ", tok2str(arp2str, "hardware-type %u,", type)));
877 					while (len > 0) {
878 						if (!first)
879 							ND_PRINT((ndo, ":"));
880 						ND_PRINT((ndo, "%02x", *bp));
881 						++bp;
882 						--len;
883 						first = 0;
884 					}
885 				}
886 				break;
887 			    }
888 
889 			case TAG_AGENT_CIRCUIT:
890 				while (len >= 2) {
891 					subopt = *bp++;
892 					suboptlen = *bp++;
893 					len -= 2;
894 					if (suboptlen > len) {
895 						ND_PRINT((ndo, "\n\t      %s SubOption %u, length %u: length goes past end of option",
896 							  tok2str(agent_suboption_values, "Unknown", subopt),
897 							  subopt,
898 							  suboptlen));
899 						bp += len;
900 						len = 0;
901 						break;
902 					}
903 					ND_PRINT((ndo, "\n\t      %s SubOption %u, length %u: ",
904 						  tok2str(agent_suboption_values, "Unknown", subopt),
905 						  subopt,
906 						  suboptlen));
907 					switch (subopt) {
908 
909 					case AGENT_SUBOPTION_CIRCUIT_ID: /* fall through */
910 					case AGENT_SUBOPTION_REMOTE_ID:
911 					case AGENT_SUBOPTION_SUBSCRIBER_ID:
912 						if (fn_printn(ndo, bp, suboptlen, ndo->ndo_snapend))
913 							goto trunc;
914 						break;
915 
916 					default:
917 						print_unknown_data(ndo, bp, "\n\t\t", suboptlen);
918 					}
919 
920 					len -= suboptlen;
921 					bp += suboptlen;
922 				}
923 				break;
924 
925 			case TAG_CLASSLESS_STATIC_RT:
926 			case TAG_CLASSLESS_STA_RT_MS:
927 			    {
928 				u_int mask_width, significant_octets, i;
929 
930 				/* this option should be at least 5 bytes long */
931 				if (len < 5) {
932 					ND_PRINT((ndo, "ERROR: length < 5 bytes"));
933 					bp += len;
934 					len = 0;
935 					break;
936 				}
937 				while (len > 0) {
938 					if (!first)
939 						ND_PRINT((ndo, ","));
940 					mask_width = *bp++;
941 					len--;
942 					/* mask_width <= 32 */
943 					if (mask_width > 32) {
944 						ND_PRINT((ndo, "[ERROR: Mask width (%d) > 32]", mask_width));
945 						bp += len;
946 						len = 0;
947 						break;
948 					}
949 					significant_octets = (mask_width + 7) / 8;
950 					/* significant octets + router(4) */
951 					if (len < significant_octets + 4) {
952 						ND_PRINT((ndo, "[ERROR: Remaining length (%u) < %u bytes]", len, significant_octets + 4));
953 						bp += len;
954 						len = 0;
955 						break;
956 					}
957 					ND_PRINT((ndo, "("));
958 					if (mask_width == 0)
959 						ND_PRINT((ndo, "default"));
960 					else {
961 						for (i = 0; i < significant_octets ; i++) {
962 							if (i > 0)
963 								ND_PRINT((ndo, "."));
964 							ND_PRINT((ndo, "%d", *bp++));
965 						}
966 						for (i = significant_octets ; i < 4 ; i++)
967 							ND_PRINT((ndo, ".0"));
968 						ND_PRINT((ndo, "/%d", mask_width));
969 					}
970 					memcpy((char *)&ul, (const char *)bp, sizeof(ul));
971 					ND_PRINT((ndo, ":%s)", ipaddr_string(ndo, &ul)));
972 					bp += sizeof(ul);
973 					len -= (significant_octets + 4);
974 					first = 0;
975 				}
976 				break;
977 			    }
978 
979 			case TAG_USER_CLASS:
980 			    {
981 				u_int suboptnumber = 1;
982 
983 				first = 1;
984 				if (len < 2) {
985 					ND_PRINT((ndo, "ERROR: length < 2 bytes"));
986 					bp += len;
987 					len = 0;
988 					break;
989 				}
990 				while (len > 0) {
991 					suboptlen = *bp++;
992 					len--;
993 					ND_PRINT((ndo, "\n\t      "));
994 					ND_PRINT((ndo, "instance#%u: ", suboptnumber));
995 					if (suboptlen == 0) {
996 						ND_PRINT((ndo, "ERROR: suboption length must be non-zero"));
997 						bp += len;
998 						len = 0;
999 						break;
1000 					}
1001 					if (len < suboptlen) {
1002 						ND_PRINT((ndo, "ERROR: malformed option"));
1003 						bp += len;
1004 						len = 0;
1005 						break;
1006 					}
1007 					ND_PRINT((ndo, "\""));
1008 					if (fn_printn(ndo, bp, suboptlen, ndo->ndo_snapend)) {
1009 						ND_PRINT((ndo, "\""));
1010 						goto trunc;
1011 					}
1012 					ND_PRINT((ndo, "\""));
1013 					ND_PRINT((ndo, ", length %d", suboptlen));
1014 					suboptnumber++;
1015 					len -= suboptlen;
1016 					bp += suboptlen;
1017 				}
1018 				break;
1019 			    }
1020 
1021 			default:
1022 				ND_PRINT((ndo, "[unknown special tag %u, size %u]",
1023 					  tag, len));
1024 				bp += len;
1025 				len = 0;
1026 				break;
1027 			}
1028 			break;
1029 		}
1030 		/* Data left over? */
1031 		if (len) {
1032 			ND_PRINT((ndo, "\n\t  trailing data length %u", len));
1033 			bp += len;
1034 		}
1035 	}
1036 	return;
1037 trunc:
1038 	ND_PRINT((ndo, "|[rfc1048]"));
1039 }
1040 
1041 static void
1042 cmu_print(netdissect_options *ndo,
1043 	  register const u_char *bp)
1044 {
1045 	register const struct cmu_vend *cmu;
1046 
1047 #define PRINTCMUADDR(m, s) { ND_TCHECK(cmu->m); \
1048     if (cmu->m.s_addr != 0) \
1049 	ND_PRINT((ndo, " %s:%s", s, ipaddr_string(ndo, &cmu->m.s_addr))); }
1050 
1051 	ND_PRINT((ndo, " vend-cmu"));
1052 	cmu = (const struct cmu_vend *)bp;
1053 
1054 	/* Only print if there are unknown bits */
1055 	ND_TCHECK(cmu->v_flags);
1056 	if ((cmu->v_flags & ~(VF_SMASK)) != 0)
1057 		ND_PRINT((ndo, " F:0x%x", cmu->v_flags));
1058 	PRINTCMUADDR(v_dgate, "DG");
1059 	PRINTCMUADDR(v_smask, cmu->v_flags & VF_SMASK ? "SM" : "SM*");
1060 	PRINTCMUADDR(v_dns1, "NS1");
1061 	PRINTCMUADDR(v_dns2, "NS2");
1062 	PRINTCMUADDR(v_ins1, "IEN1");
1063 	PRINTCMUADDR(v_ins2, "IEN2");
1064 	PRINTCMUADDR(v_ts1, "TS1");
1065 	PRINTCMUADDR(v_ts2, "TS2");
1066 	return;
1067 
1068 trunc:
1069 	ND_PRINT((ndo, "%s", tstr));
1070 #undef PRINTCMUADDR
1071 }
1072 
1073 static char *
1074 client_fqdn_flags(u_int flags)
1075 {
1076 	static char buf[8+1];
1077 	int i = 0;
1078 
1079 	if (flags & CLIENT_FQDN_FLAGS_S)
1080 		buf[i++] = 'S';
1081 	if (flags & CLIENT_FQDN_FLAGS_O)
1082 		buf[i++] = 'O';
1083 	if (flags & CLIENT_FQDN_FLAGS_E)
1084 		buf[i++] = 'E';
1085 	if (flags & CLIENT_FQDN_FLAGS_N)
1086 		buf[i++] = 'N';
1087 	buf[i] = '\0';
1088 
1089 	return buf;
1090 }
1091