]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-bootp.c
Patch sent to Debian by Roderick Schertler <[email protected]> to print
[tcpdump] / print-bootp.c
index ec1052b198066c59a62eb037ddd9cfb0c2d1731d..531ca84b8126075617cd09dd86a01cfd8fadb1ad 100644 (file)
@@ -22,7 +22,7 @@
  */
 #ifndef lint
 static const char rcsid[] =
-    "@(#) $Header: /tcpdump/master/tcpdump/print-bootp.c,v 1.49 2000-07-01 03:39:01 assar Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/tcpdump/print-bootp.c,v 1.53 2000-10-27 23:26:30 guy Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -35,10 +35,8 @@ static const char rcsid[] =
 
 struct mbuf;
 struct rtentry;
-#include <net/if.h>
 
 #include <netinet/in.h>
-#include <netinet/if_ether.h>
 
 #include <ctype.h>
 #include <stdio.h>
@@ -46,6 +44,7 @@ struct rtentry;
 
 #include "interface.h"
 #include "addrtoname.h"
+#include "ether.h"
 #include "bootp.h"
 
 static void rfc1048_print(const u_char *, u_int);
@@ -189,7 +188,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) */
@@ -264,7 +263,7 @@ static struct tok tag2str[] = {
        { TAG_RENEWAL_TIME,     "lRN" },
        { TAG_REBIND_TIME,      "lRB" },
        { TAG_VENDOR_CLASS,     "bVC" },
-       { TAG_CLIENT_ID,        "bCID" },
+       { TAG_CLIENT_ID,        "xCID" },
        { 0,                    NULL }
 };
 
@@ -360,6 +359,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)
@@ -367,6 +367,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);
@@ -427,12 +429,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;