]> The Tcpdump Group git mirrors - tcpdump/commitdiff
- move IP option processing from the trail up to the header
authorhannes <hannes>
Sat, 28 Dec 2002 17:59:09 +0000 (17:59 +0000)
committerhannes <hannes>
Sat, 28 Dec 2002 17:59:09 +0000 (17:59 +0000)
- suppress IP id == 0

print-ip.c

index 795b4b0a3bc5782e4abd8f4c00524b1495a5e3ac..0b94427a58764b648898af8b66c672c344e51e9c 100644 (file)
@@ -21,7 +21,7 @@
 
 #ifndef lint
 static const char rcsid[] =
-    "@(#) $Header: /tcpdump/master/tcpdump/print-ip.c,v 1.117 2002-12-11 07:14:02 guy Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/tcpdump/print-ip.c,v 1.118 2002-12-28 17:59:09 hannes Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -397,9 +397,17 @@ ip_print(register const u_char *bp, register u_int length)
             if (ip->ip_ttl >= 1)
                 (void)printf(", ttl %u", ip->ip_ttl);    
 
-            if ((off & 0x3fff) == 0)
+            if ((off & 0x3fff) != 0)
                 (void)printf(", id %u", EXTRACT_16BITS(&ip->ip_id));
-            (void)printf(", len %u) ", EXTRACT_16BITS(&ip->ip_len));
+
+            (void)printf(", length: %u", EXTRACT_16BITS(&ip->ip_len));
+
+            if ((hlen - sizeof(struct ip)) > 0) {
+                (void)printf(", optlength: %u (", hlen - sizeof(struct ip));
+                ip_optprint((u_char *)(ip + 1), hlen - sizeof(struct ip));
+                printf(" )");
+            }
+            printf(") ");
        }
 
        /*
@@ -623,12 +631,7 @@ again:
                                sep = ", ";
                        }
                }
-               if ((hlen -= sizeof(struct ip)) > 0) {
-                       (void)printf("%soptlen=%d", sep, hlen);
-                       ip_optprint((u_char *)(ip + 1), hlen);
-               }
        }
-
 }
 
 void