X-Git-Url: https://git.tcpdump.org/tcpdump/blobdiff_plain/ce751501abbddbe91d683d13b5cd845a5d551d8f..0eeb5dba9d0c97d3d403dec681fd06ae1e396c83:/print-bootp.c diff --git a/print-bootp.c b/print-bootp.c index fb1329e2..e753805c 100644 --- a/print-bootp.c +++ b/print-bootp.c @@ -22,31 +22,30 @@ */ #ifndef lint static const char rcsid[] = - "@(#) $Header: /tcpdump/master/tcpdump/print-bootp.c,v 1.47 1999-10-17 23:35:47 mcr Exp $ (LBL)"; + "@(#) $Header: /tcpdump/master/tcpdump/print-bootp.c,v 1.55 2000-12-03 23:45:37 fenner Exp $ (LBL)"; +#endif + +#ifdef HAVE_CONFIG_H +#include "config.h" #endif #include #include #include -#if __STDC__ struct mbuf; struct rtentry; -#endif -#include #include -#include #include -#ifdef HAVE_MEMORY_H -#include -#endif #include #include #include "interface.h" #include "addrtoname.h" +#include "extract.h" +#include "ether.h" #include "bootp.h" static void rfc1048_print(const u_char *, u_int); @@ -190,7 +189,7 @@ static struct tok tag2str[] = { /* RFC1048 tags */ { TAG_PAD, " PAD" }, { TAG_SUBNET_MASK, "iSM" }, /* subnet mask (RFC950) */ - { TAG_TIME_OFFSET, "lTZ" }, /* seconds from UTC */ + { TAG_TIME_OFFSET, "LTZ" }, /* seconds from UTC */ { TAG_GATEWAY, "iDG" }, /* default gateway */ { TAG_TIME_SERVER, "iTS" }, /* time servers (RFC868) */ { TAG_NAME_SERVER, "iIEN" }, /* IEN name servers (IEN116) */ @@ -265,7 +264,46 @@ static struct tok tag2str[] = { { TAG_RENEWAL_TIME, "lRN" }, { TAG_REBIND_TIME, "lRB" }, { TAG_VENDOR_CLASS, "bVC" }, - { TAG_CLIENT_ID, "bCID" }, + { TAG_CLIENT_ID, "xCID" }, +/* RFC 2485 */ + { TAG_OPEN_GROUP_UAP, "aUAP" }, +/* RFC 2563 */ + { TAG_DISABLE_AUTOCONF, "BNOAUTO" }, +/* RFC 2610 */ + { TAG_SLP_DA, "bSLP-DA" }, /*"b" is a little wrong */ + { TAG_SLP_SCOPE, "bSLP-SCOPE" }, /*"b" is a little wrong */ +/* RFC 2937 */ + { TAG_NS_SEARCH, "sNSSEARCH" }, /* XXX 's' */ +/* RFC 3011 */ + { TAG_IP4_SUBNET_SELECT, "iSUBNET" }, +/* ftp://ftp.isi.edu/.../assignments/bootp-dhcp-extensions */ + { TAG_USER_CLASS, "aCLASS" }, + { TAG_SLP_NAMING_AUTH, "aSLP-NA" }, + { TAG_CLIENT_FQDN, "bFQDN" }, /* XXX 'b' */ + { TAG_AGENT_CIRCUIT, "bACKT" }, + { TAG_AGENT_REMOTE, "bARMT" }, + { TAG_AGENT_MASK, "bAMSK" }, + { TAG_TZ_STRING, "aTZSTR" }, + { TAG_FQDN_OPTION, "bFQDNS" }, /* XXX 'b' */ + { TAG_AUTH, "bAUTH" }, /* XXX 'b' */ + { TAG_VINES_SERVERS, "iVINES" }, + { TAG_SERVER_RANK, "sRANK" }, + { TAG_CLIENT_ARCH, "sARCH" }, + { TAG_CLIENT_NDI, "bNDI" }, /* XXX 'b' */ + { TAG_CLIENT_GUID, "bGUID" }, /* XXX 'b' */ + { TAG_LDAP_URL, "aLDAP" }, + { TAG_6OVER4, "i6o4" }, + { TAG_PRINTER_NAME, "aPRTR" }, + { TAG_MDHCP_SERVER, "bMDHCP" }, /* XXX 'b' */ + { TAG_IPX_COMPAT, "bIPX" }, /* XXX 'b' */ + { TAG_NETINFO_PARENT, "iNI" }, + { TAG_NETINFO_PARENT_TAG, "aNITAG" }, + { TAG_URL, "aURL" }, + { TAG_FAILOVER, "bFAIL" }, /* XXX 'b' */ + { 0, NULL } +}; +/* 2-byte extended tags */ +static struct tok xtag2str[] = { { 0, NULL } }; @@ -292,7 +330,16 @@ rfc1048_print(register const u_char *bp, register u_int length) continue; if (tag == TAG_END) return; - cp = tok2str(tag2str, "?T%d", tag); + if (tag == TAG_EXTENDED_OPTION) { + TCHECK(bp + 1, 2); + tag = EXTRACT_16BITS(bp + 1); + /* XXX we don't know yet if the IANA will + * preclude overlap of 1-byte and 2-byte spaces. + * If not, we need to offset tag after this step. + */ + cp = tok2str(xtag2str, "?xT%d", tag); + } else + cp = tok2str(tag2str, "?T%d", tag); c = *cp++; printf(" %s:", cp); @@ -327,7 +374,21 @@ rfc1048_print(register const u_char *bp, register u_int length) first = 1; while (len-- > 0) { c = *bp++; - cp = tok2str(tag2str, "?%d", c); + cp = tok2str(tag2str, "?T%d", c); + if (!first) + putchar('+'); + printf("%s", cp + 1); + first = 0; + } + continue; + } + if (tag == TAG_EXTENDED_REQUEST) { + first = 1; + while (len > 1) { + len -= 2; + c = EXTRACT_16BITS(bp); + bp += 2; + cp = tok2str(xtag2str, "?xT%d", c); if (!first) putchar('+'); printf("%s", cp + 1); @@ -361,6 +422,7 @@ rfc1048_print(register const u_char *bp, register u_int length) case 'i': case 'l': + case 'L': /* ip addresses/32-bit words */ while (size >= sizeof(ul)) { if (!first) @@ -368,6 +430,8 @@ rfc1048_print(register const u_char *bp, register u_int length) memcpy((char *)&ul, (char *)bp, sizeof(ul)); if (c == 'i') printf("%s", ipaddr_string(&ul)); + else if (c == 'L') + printf("%d", ul); else printf("%u", ul); bp += sizeof(ul); @@ -428,12 +492,13 @@ rfc1048_print(register const u_char *bp, register u_int length) break; case 'b': + case 'x': default: /* Bytes */ while (size > 0) { if (!first) - putchar('.'); - printf("%d", *bp); + putchar (c == 'x' ? ':' : '.'); + printf (c == 'x' ? "%02x" : "%d", *bp); ++bp; --size; first = 0;