]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-bootp.c
refine the previous change
[tcpdump] / print-bootp.c
index c9e7a11efff518dd8761d81de6fc7808d646bf66..1594a3984d81660fb0922e111e97e8c2c14fa429 100644 (file)
  *
  * Format and print bootp packets.
  */
-#ifndef lint
-static const char rcsid[] _U_ =
-    "@(#) $Header: /tcpdump/master/tcpdump/print-bootp.c,v 1.89 2008-04-22 09:45:08 hannes Exp $ (LBL)";
-#endif
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -40,12 +36,12 @@ static const char rcsid[] _U_ =
 #include "ether.h"
 #include "bootp.h"
 
+static const char tstr[] = " [|bootp]";
+
 static void rfc1048_print(const u_char *);
 static void cmu_print(const u_char *);
 static char *client_fqdn_flags(u_int flags);
 
-static char tstr[] = " [|bootp]";
-
 static const struct tok bootp_flag_values[] = {
     { 0x8000,                   "Broadcast" },
     { 0, NULL}
@@ -96,9 +92,9 @@ bootp_print(register const u_char *cp, u_int length)
        /* Only print interesting fields */
        if (bp->bp_hops)
                printf(", hops %d", bp->bp_hops);
-       if (bp->bp_xid)
+       if (EXTRACT_32BITS(&bp->bp_xid))
                printf(", xid 0x%x", EXTRACT_32BITS(&bp->bp_xid));
-       if (bp->bp_secs)
+       if (EXTRACT_16BITS(&bp->bp_secs))
                printf(", secs %d", EXTRACT_16BITS(&bp->bp_secs));
 
        printf(", Flags [%s]",
@@ -108,22 +104,22 @@ bootp_print(register const u_char *cp, u_int length)
 
        /* Client's ip address */
        TCHECK(bp->bp_ciaddr);
-       if (bp->bp_ciaddr.s_addr)
+       if (EXTRACT_32BITS(&bp->bp_ciaddr.s_addr))
                printf("\n\t  Client-IP %s", ipaddr_string(&bp->bp_ciaddr));
 
        /* 'your' ip address (bootp client) */
        TCHECK(bp->bp_yiaddr);
-       if (bp->bp_yiaddr.s_addr)
+       if (EXTRACT_32BITS(&bp->bp_yiaddr.s_addr))
                printf("\n\t  Your-IP %s", ipaddr_string(&bp->bp_yiaddr));
 
        /* Server's ip address */
        TCHECK(bp->bp_siaddr);
-       if (bp->bp_siaddr.s_addr)
+       if (EXTRACT_32BITS(&bp->bp_siaddr.s_addr))
                printf("\n\t  Server-IP %s", ipaddr_string(&bp->bp_siaddr));
 
        /* Gateway's ip address */
        TCHECK(bp->bp_giaddr);
-       if (bp->bp_giaddr.s_addr)
+       if (EXTRACT_32BITS(&bp->bp_giaddr.s_addr))
                printf("\n\t  Gateway-IP %s", ipaddr_string(&bp->bp_giaddr));
 
        /* Client's Ethernet address */
@@ -691,7 +687,7 @@ rfc1048_print(register const u_char *bp)
                                                 break;
 
                                        default:
-                                               print_unknown_data(bp, "\n\t\t", suboptlen);
+                                               print_unknown_data(gndo,bp, "\n\t\t", suboptlen);
                                        }
 
                                        len -= suboptlen;
@@ -701,7 +697,7 @@ rfc1048_print(register const u_char *bp)
 
                        case TAG_CLASSLESS_STATIC_RT:
                        case TAG_CLASSLESS_STA_RT_MS:
-                       {       
+                       {
                                u_int mask_width, significant_octets, i;
 
                                /* this option should be at least 5 bytes long */