summaryrefslogtreecommitdiff
path: root/print-bootp.c
diff options
context:
space:
mode:
authormcr <mcr>1999-10-17 23:35:46 +0000
committermcr <mcr>1999-10-17 23:35:46 +0000
commitce751501abbddbe91d683d13b5cd845a5d551d8f (patch)
tree0b851d1a91216a9a8c3daf00e5fc4d63cd248a0a /print-bootp.c
parent19069efd610a1ee69deefeca85c20e08f4a85aea (diff)
downloadtcpdump-ce751501abbddbe91d683d13b5cd845a5d551d8f.tar.gz
now prints DHCP optionsdhcp
Diffstat (limited to 'print-bootp.c')
-rw-r--r--print-bootp.c128
1 files changed, 127 insertions, 1 deletions
diff --git a/print-bootp.c b/print-bootp.c
index a5fb2552..fb1329e2 100644
--- a/print-bootp.c
+++ b/print-bootp.c
@@ -22,7 +22,7 @@
*/
#ifndef lint
static const char rcsid[] =
- "@(#) $Header: /tcpdump/master/tcpdump/print-bootp.c,v 1.46 1999-10-07 23:47:11 mcr Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-bootp.c,v 1.47 1999-10-17 23:35:47 mcr Exp $ (LBL)";
#endif
#include <sys/param.h>
@@ -102,6 +102,8 @@ bootp_print(register const u_char *cp, u_int length,
printf(" xid:0x%x", (u_int32_t)ntohl(bp->bp_xid));
if (bp->bp_secs)
printf(" secs:%d", ntohs(bp->bp_secs));
+ if (bp->bp_flags)
+ printf(" flags:0x%x", ntohs(bp->bp_flags));
/* Client's ip address */
TCHECK(bp->bp_ciaddr);
@@ -207,6 +209,63 @@ static struct tok tag2str[] = {
{ TAG_SWAP_SERVER, "iSS" },
{ TAG_ROOTPATH, "aRP" },
{ TAG_EXTPATH, "aEP" },
+/* RFC2132 tags */
+ { TAG_IP_FORWARD, "BIPF" },
+ { TAG_NL_SRCRT, "BSRT" },
+ { TAG_PFILTERS, "pPF" },
+ { TAG_REASS_SIZE, "sRSZ" },
+ { TAG_DEF_TTL, "bTTL" },
+ { TAG_MTU_TIMEOUT, "lMA" },
+ { TAG_MTU_TABLE, "sMT" },
+ { TAG_INT_MTU, "sMTU" },
+ { TAG_LOCAL_SUBNETS, "BLSN" },
+ { TAG_BROAD_ADDR, "iBR" },
+ { TAG_DO_MASK_DISC, "BMD" },
+ { TAG_SUPPLY_MASK, "BMS" },
+ { TAG_DO_RDISC, "BRD" },
+ { TAG_RTR_SOL_ADDR, "iRSA" },
+ { TAG_STATIC_ROUTE, "pSR" },
+ { TAG_USE_TRAILERS, "BUT" },
+ { TAG_ARP_TIMEOUT, "lAT" },
+ { TAG_ETH_ENCAP, "BIE" },
+ { TAG_TCP_TTL, "bTT" },
+ { TAG_TCP_KEEPALIVE, "lKI" },
+ { TAG_KEEPALIVE_GO, "BKG" },
+ { TAG_NIS_DOMAIN, "aYD" },
+ { TAG_NIS_SERVERS, "iYS" },
+ { TAG_NTP_SERVERS, "iNTP" },
+ { TAG_VENDOR_OPTS, "bVO" },
+ { TAG_NETBIOS_NS, "iWNS" },
+ { TAG_NETBIOS_DDS, "iWDD" },
+ { TAG_NETBIOS_NODE, "bWNT" },
+ { TAG_NETBIOS_SCOPE, "aWSC" },
+ { TAG_XWIN_FS, "iXFS" },
+ { TAG_XWIN_DM, "iXDM" },
+ { TAG_NIS_P_DOMAIN, "sN+D" },
+ { TAG_NIS_P_SERVERS, "iN+S" },
+ { TAG_MOBILE_HOME, "iMH" },
+ { TAG_SMPT_SERVER, "iSMTP" },
+ { TAG_POP3_SERVER, "iPOP3" },
+ { TAG_NNTP_SERVER, "iNNTP" },
+ { TAG_WWW_SERVER, "iWWW" },
+ { TAG_FINGER_SERVER, "iFG" },
+ { TAG_IRC_SERVER, "iIRC" },
+ { TAG_STREETTALK_SRVR, "iSTS" },
+ { TAG_STREETTALK_STDA, "iSTDA" },
+ { TAG_REQUESTED_IP, "iRQ" },
+ { TAG_IP_LEASE, "lLT" },
+ { TAG_OPT_OVERLOAD, "bOO" },
+ { TAG_TFTP_SERVER, "aTFTP" },
+ { TAG_BOOTFILENAME, "aBF" },
+ { TAG_DHCP_MESSAGE, " DHCP" },
+ { TAG_SERVER_ID, "iSID" },
+ { TAG_PARM_REQUEST, "bPR" },
+ { TAG_MESSAGE, "aMSG" },
+ { TAG_MAX_MSG_SIZE, "sMSZ" },
+ { TAG_RENEWAL_TIME, "lRN" },
+ { TAG_REBIND_TIME, "lRB" },
+ { TAG_VENDOR_CLASS, "bVC" },
+ { TAG_CLIENT_ID, "bCID" },
{ 0, NULL }
};
@@ -248,6 +307,35 @@ rfc1048_print(register const u_char *bp, register u_int length)
return;
}
+ if (tag == TAG_DHCP_MESSAGE && len == 1) {
+ c = *bp++;
+ switch (c) {
+ case DHCPDISCOVER: printf("DISCOVER"); break;
+ case DHCPOFFER: printf("OFFER"); break;
+ case DHCPREQUEST: printf("REQUEST"); break;
+ case DHCPDECLINE: printf("DECLINE"); break;
+ case DHCPACK: printf("ACK"); break;
+ case DHCPNAK: printf("NACK"); break;
+ case DHCPRELEASE: printf("RELEASE"); break;
+ case DHCPINFORM: printf("INFORM"); break;
+ default: printf("%u", c); break;
+ }
+ continue;
+ }
+
+ if (tag == TAG_PARM_REQUEST) {
+ first = 1;
+ while (len-- > 0) {
+ c = *bp++;
+ cp = tok2str(tag2str, "?%d", c);
+ if (!first)
+ putchar('+');
+ printf("%s", cp + 1);
+ first = 0;
+ }
+ continue;
+ }
+
/* Print data */
size = len;
if (c == '?') {
@@ -288,6 +376,22 @@ rfc1048_print(register const u_char *bp, register u_int length)
}
break;
+ case 'p':
+ /* IP address pairs */
+ while (size >= 2*sizeof(ul)) {
+ if (!first)
+ putchar(',');
+ memcpy((char *)&ul, (char *)bp, sizeof(ul));
+ printf("(%s:", ipaddr_string(&ul));
+ bp += sizeof(ul);
+ memcpy((char *)&ul, (char *)bp, sizeof(ul));
+ printf("%s)", ipaddr_string(&ul));
+ bp += sizeof(ul);
+ size -= 2*sizeof(ul);
+ first = 0;
+ }
+ break;
+
case 's':
/* shorts */
while (size >= sizeof(us)) {
@@ -301,6 +405,28 @@ rfc1048_print(register const u_char *bp, register u_int length)
}
break;
+ case 'B':
+ /* boolean */
+ while (size > 0) {
+ if (!first)
+ putchar(',');
+ switch (*bp) {
+ case 0:
+ putchar('N');
+ break;
+ case 1:
+ putchar('Y');
+ break;
+ default:
+ printf("%d?", *bp);
+ break;
+ }
+ ++bp;
+ --size;
+ first = 0;
+ }
+ break;
+
case 'b':
default:
/* Bytes */