]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-egp.c
Fix the pointer tests in the non-ndoified TTEST2() macro as well.
[tcpdump] / print-egp.c
index 2f449a074c4c68a5287ed6e60495a1a68f192a18..4a1d046531be37a9bcc8ac2b0426e98ce426963c 100644 (file)
@@ -19,8 +19,8 @@
  */
 
 #ifndef lint
-static const char rcsid[] =
-    "@(#) $Header: /tcpdump/master/tcpdump/print-egp.c,v 1.34 2002-12-11 07:13:59 guy Exp $ (LBL)";
+static const char rcsid[] _U_ =
+    "@(#) $Header: /tcpdump/master/tcpdump/print-egp.c,v 1.38 2006-02-11 22:13:24 hannes Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -214,7 +214,7 @@ trunc:
 }
 
 void
-egp_print(register const u_int8_t *bp)
+egp_print(register const u_int8_t *bp, register u_int length)
 {
        register const struct egp_packet *egp;
        register int status;
@@ -222,17 +222,27 @@ egp_print(register const u_int8_t *bp)
        register int type;
 
        egp = (struct egp_packet *)bp;
-       if (!TTEST(*egp)) {
+        if (!TTEST2(*egp, length)) {
                printf("[|egp]");
                return;
        }
-       (void)printf("egp: ");
+
+        if (!vflag) {
+            printf("EGPv%u, AS %u, seq %u, length %u",
+                   egp->egp_version,
+                   EXTRACT_16BITS(&egp->egp_as),
+                   EXTRACT_16BITS(&egp->egp_sequence),
+                   length);
+            return;
+        } else
+            printf("EGPv%u, length %u",
+                   egp->egp_version,
+                   length);            
 
        if (egp->egp_version != EGP_VERSION) {
                printf("[version %d]", egp->egp_version);
                return;
        }
-       printf("as:%d seq:%d", EXTRACT_16BITS(&egp->egp_as), EXTRACT_16BITS(&egp->egp_sequence));
 
        type = egp->egp_type;
        code = egp->egp_code;