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