]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-pim.c
add boundary, infinite loop checks
[tcpdump] / print-pim.c
index af5bf53b134b91073966c5ea91a0617dec371ccd..cc338f119d4f79506cd523aeaf105f75dc9d1a1b 100644 (file)
@@ -21,7 +21,7 @@
 
 #ifndef lint
 static const char rcsid[] _U_ =
-    "@(#) $Header: /tcpdump/master/tcpdump/print-pim.c,v 1.43 2004-03-24 02:51:10 guy Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/tcpdump/print-pim.c,v 1.47 2005-04-20 22:08:27 guy Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -161,6 +161,10 @@ pimv1_join_prune_print(register const u_char *bp, register u_int len)
        bp += 4;
        len -= 4;
        while (ngroups--) {
+               /*
+                * XXX - does the address have length "addrlen" and the
+                * mask length "maddrlen"?
+                */
                TCHECK2(bp[0], 4);
                (void)printf("\n\tGroup: %s", ipaddr_string(bp));
                TCHECK2(bp[4], 4);
@@ -415,18 +419,16 @@ pim_print(register const u_char *bp, register u_int len)
        switch (PIM_VER(pim->pim_typever)) {
        case 2:
             if (!vflag) {
-                printf("PIMv%u, %s (%u), length: %u",
+                printf("PIMv%u, %s, length: %u",
                        PIM_VER(pim->pim_typever),
                        tok2str(pimv2_type_values,"Unknown Type",PIM_TYPE(pim->pim_typever)),
-                       PIM_TYPE(pim->pim_typever),
                        len);
                 return;
             } else {
-                printf("PIMv%u, length: %u\n\t%s (%u)",
+                printf("PIMv%u, length: %u\n\t%s",
                        PIM_VER(pim->pim_typever),
                        len,
-                       tok2str(pimv2_type_values,"Unknown Type",PIM_TYPE(pim->pim_typever)),
-                       PIM_TYPE(pim->pim_typever));
+                       tok2str(pimv2_type_values,"Unknown Type",PIM_TYPE(pim->pim_typever)));
                 pimv2_print(bp, len);
             }
             break;
@@ -509,7 +511,6 @@ static int
 pimv2_addr_print(const u_char *bp, enum pimv2_addrtype at, int silent)
 {
        int af;
-       const char *afstr;
        int len, hdrlen;
 
        TCHECK(bp[0]);
@@ -519,13 +520,11 @@ pimv2_addr_print(const u_char *bp, enum pimv2_addrtype at, int silent)
                switch (bp[0]) {
                case 1:
                        af = AF_INET;
-                       afstr = "IPv4";
                        len = 4;
                        break;
 #ifdef INET6
                case 2:
                        af = AF_INET6;
-                       afstr = "IPv6";
                        len = 16;
                        break;
 #endif
@@ -539,12 +538,10 @@ pimv2_addr_print(const u_char *bp, enum pimv2_addrtype at, int silent)
                switch (pimv2_addr_len) {
                case 4:
                        af = AF_INET;
-                       afstr = "IPv4";
                        break;
 #ifdef INET6
                case 16:
                        af = AF_INET6;
-                       afstr = "IPv6";
                        break;
 #endif
                default:
@@ -745,7 +742,7 @@ pimv2_print(register const u_char *bp, register u_int len)
                switch (IP_V(ip)) {
                case 4: /* IPv4 */
                        printf(" ");
-                       ip_print(bp, len);
+                       ip_print(gndo, bp, len);
                        break;
 #ifdef INET6
                case 6: /* IPv6 */
@@ -1064,3 +1061,10 @@ pimv2_print(register const u_char *bp, register u_int len)
 trunc:
        (void)printf("[|pim]");
 }
+
+/*
+ * Local Variables:
+ * c-style: whitesmith
+ * c-basic-offset: 8
+ * End:
+ */