]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-pim.c
Fix the pointer tests in the non-ndoified TTEST2() macro as well.
[tcpdump] / print-pim.c
index 82c19f2ab88704f2bedab75e24b4834c3829daa3..567d3d9954ca508ddd6fa0e54f44e9a93516a069 100644 (file)
  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  */
 
-#ifndef lint
-static const char rcsid[] _U_ =
-    "@(#) $Header: /tcpdump/master/tcpdump/print-pim.c,v 1.44 2004-09-29 16:49:31 hannes Exp $ (LBL)";
-#endif
-
+#define NETDISSECT_REWORKED
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 #endif
 
 #include <tcpdump-stdinc.h>
+
 #include "interface.h"
+#include "addrtoname.h"
+#include "extract.h"
+
+#include "ip.h"
+
+#define PIMV1_TYPE_QUERY           0
+#define PIMV1_TYPE_REGISTER        1
+#define PIMV1_TYPE_REGISTER_STOP   2
+#define PIMV1_TYPE_JOIN_PRUNE      3
+#define PIMV1_TYPE_RP_REACHABILITY 4
+#define PIMV1_TYPE_ASSERT          5
+#define PIMV1_TYPE_GRAFT           6
+#define PIMV1_TYPE_GRAFT_ACK       7
+
+static const struct tok pimv1_type_str[] = {
+       { PIMV1_TYPE_QUERY,           "Query"         },
+       { PIMV1_TYPE_REGISTER,        "Register"      },
+       { PIMV1_TYPE_REGISTER_STOP,   "Register-Stop" },
+       { PIMV1_TYPE_JOIN_PRUNE,      "Join/Prune"    },
+       { PIMV1_TYPE_RP_REACHABILITY, "RP-reachable"  },
+       { PIMV1_TYPE_ASSERT,          "Assert"        },
+       { PIMV1_TYPE_GRAFT,           "Graft"         },
+       { PIMV1_TYPE_GRAFT_ACK,       "Graft-ACK"     },
+       { 0, NULL }
+};
 
 #define PIMV2_TYPE_HELLO         0
 #define PIMV2_TYPE_REGISTER      1
@@ -41,8 +63,10 @@ static const char rcsid[] _U_ =
 #define PIMV2_TYPE_GRAFT_ACK     7
 #define PIMV2_TYPE_CANDIDATE_RP  8
 #define PIMV2_TYPE_PRUNE_REFRESH 9
+#define PIMV2_TYPE_DF_ELECTION   10
+#define PIMV2_TYPE_ECMP_REDIRECT 11
 
-static struct tok pimv2_type_values[] = {
+static const struct tok pimv2_type_values[] = {
     { PIMV2_TYPE_HELLO,         "Hello" },
     { PIMV2_TYPE_REGISTER,      "Register" },
     { PIMV2_TYPE_REGISTER_STOP, "Register Stop" },
@@ -53,6 +77,8 @@ static struct tok pimv2_type_values[] = {
     { PIMV2_TYPE_GRAFT_ACK,     "Graft Acknowledgement" },
     { PIMV2_TYPE_CANDIDATE_RP,  "Candidate RP Advertisement" },
     { PIMV2_TYPE_PRUNE_REFRESH, "Prune Refresh" },
+    { PIMV2_TYPE_DF_ELECTION,   "DF Election" },
+    { PIMV2_TYPE_ECMP_REDIRECT, "ECMP Redirect" },
     { 0, NULL}
 };
 
@@ -66,7 +92,7 @@ static struct tok pimv2_type_values[] = {
 #define PIMV2_HELLO_OPTION_ADDRESS_LIST        24
 #define PIMV2_HELLO_OPTION_ADDRESS_LIST_OLD 65001
 
-static struct tok pimv2_hello_option_values[] = {
+static const struct tok pimv2_hello_option_values[] = {
     { PIMV2_HELLO_OPTION_HOLDTIME,         "Hold Time" },
     { PIMV2_HELLO_OPTION_LANPRUNEDELAY,    "LAN Prune Delay" },
     { PIMV2_HELLO_OPTION_DR_PRIORITY_OLD,  "DR Priority (Old)" },
@@ -79,6 +105,15 @@ static struct tok pimv2_hello_option_values[] = {
     { 0, NULL}
 };
 
+#define PIMV2_REGISTER_FLAG_LEN      4
+#define PIMV2_REGISTER_FLAG_BORDER 0x80000000
+#define PIMV2_REGISTER_FLAG_NULL   0x40000000
+
+static const struct tok pimv2_register_flag_values[] = {
+    { PIMV2_REGISTER_FLAG_BORDER, "Border" },
+    { PIMV2_REGISTER_FLAG_NULL, "Null" },
+    { 0, NULL}
+};
 
 /*
  * XXX: We consider a case where IPv6 is not ready yet for portability,
@@ -86,7 +121,7 @@ static struct tok pimv2_hello_option_values[] = {
  */
 
 struct pim {
-       u_int8_t pim_typever;
+       uint8_t pim_typever;
                        /* upper 4bit: PIM version number; 2 for PIMv2 */
                        /* lower 4bit: the PIM message type, currently they are:
                         * Hello, Register, Register-Stop, Join/Prune,
@@ -99,77 +134,70 @@ struct pim {
        u_short pim_cksum;      /* IP style check sum */
 };
 
-
-#include <stdio.h>
-#include <stdlib.h>
-
-#include "interface.h"
-#include "addrtoname.h"
-#include "extract.h"
-
-#include "ip.h"
-
-static void pimv2_print(register const u_char *bp, register u_int len);
+static void pimv2_print(netdissect_options *, register const u_char *bp, register u_int len, u_int cksum);
 
 static void
-pimv1_join_prune_print(register const u_char *bp, register u_int len)
+pimv1_join_prune_print(netdissect_options *ndo,
+                       register const u_char *bp, register u_int len)
 {
-       int maddrlen, addrlen, ngroups, njoin, nprune;
+       int ngroups, njoin, nprune;
        int njp;
 
        /* If it's a single group and a single source, use 1-line output. */
-       if (TTEST2(bp[0], 30) && bp[11] == 1 &&
+       if (ND_TTEST2(bp[0], 30) && bp[11] == 1 &&
            ((njoin = EXTRACT_16BITS(&bp[20])) + EXTRACT_16BITS(&bp[22])) == 1) {
                int hold;
 
-               (void)printf(" RPF %s ", ipaddr_string(bp));
+               ND_PRINT((ndo, " RPF %s ", ipaddr_string(ndo, bp)));
                hold = EXTRACT_16BITS(&bp[6]);
                if (hold != 180) {
-                       (void)printf("Hold ");
-                       relts_print(hold);
+                       ND_PRINT((ndo, "Hold "));
+                       relts_print(ndo, hold);
                }
-               (void)printf("%s (%s/%d, %s", njoin ? "Join" : "Prune",
-               ipaddr_string(&bp[26]), bp[25] & 0x3f,
-               ipaddr_string(&bp[12]));
+               ND_PRINT((ndo, "%s (%s/%d, %s", njoin ? "Join" : "Prune",
+               ipaddr_string(ndo, &bp[26]), bp[25] & 0x3f,
+               ipaddr_string(ndo, &bp[12])));
                if (EXTRACT_32BITS(&bp[16]) != 0xffffffff)
-                       (void)printf("/%s", ipaddr_string(&bp[16]));
-               (void)printf(") %s%s %s",
+                       ND_PRINT((ndo, "/%s", ipaddr_string(ndo, &bp[16])));
+               ND_PRINT((ndo, ") %s%s %s",
                    (bp[24] & 0x01) ? "Sparse" : "Dense",
                    (bp[25] & 0x80) ? " WC" : "",
-                   (bp[25] & 0x40) ? "RP" : "SPT");
+                   (bp[25] & 0x40) ? "RP" : "SPT"));
                return;
        }
 
-       TCHECK2(bp[0], 4);
-       if (vflag > 1)
-               (void)printf("\n");
-       (void)printf(" Upstream Nbr: %s", ipaddr_string(bp));
-       TCHECK2(bp[6], 2);
-       if (vflag > 1)
-               (void)printf("\n");
-       (void)printf(" Hold time: ");
-       relts_print(EXTRACT_16BITS(&bp[6]));
-       if (vflag < 2)
+       ND_TCHECK2(bp[0], sizeof(struct in_addr));
+       if (ndo->ndo_vflag > 1)
+               ND_PRINT((ndo, "\n"));
+       ND_PRINT((ndo, " Upstream Nbr: %s", ipaddr_string(ndo, bp)));
+       ND_TCHECK2(bp[6], 2);
+       if (ndo->ndo_vflag > 1)
+               ND_PRINT((ndo, "\n"));
+       ND_PRINT((ndo, " Hold time: "));
+       relts_print(ndo, EXTRACT_16BITS(&bp[6]));
+       if (ndo->ndo_vflag < 2)
                return;
        bp += 8;
        len -= 8;
 
-       TCHECK2(bp[0], 4);
-       maddrlen = bp[1];
-       addrlen = bp[2];
+       ND_TCHECK2(bp[0], 4);
        ngroups = bp[3];
        bp += 4;
        len -= 4;
        while (ngroups--) {
-               TCHECK2(bp[0], 4);
-               (void)printf("\n\tGroup: %s", ipaddr_string(bp));
-               TCHECK2(bp[4], 4);
+               /*
+                * XXX - does the address have length "addrlen" and the
+                * mask length "maddrlen"?
+                */
+               ND_TCHECK2(bp[0], sizeof(struct in_addr));
+               ND_PRINT((ndo, "\n\tGroup: %s", ipaddr_string(ndo, bp)));
+               ND_TCHECK2(bp[4], sizeof(struct in_addr));
                if (EXTRACT_32BITS(&bp[4]) != 0xffffffff)
-                       (void)printf("/%s", ipaddr_string(&bp[4]));
-               TCHECK2(bp[8], 4);
+                       ND_PRINT((ndo, "/%s", ipaddr_string(ndo, &bp[4])));
+               ND_TCHECK2(bp[8], 4);
                njoin = EXTRACT_16BITS(&bp[8]);
                nprune = EXTRACT_16BITS(&bp[10]);
-               (void)printf(" joined: %d pruned: %d", njoin, nprune);
+               ND_PRINT((ndo, " joined: %d pruned: %d", njoin, nprune));
                bp += 12;
                len -= 12;
                for (njp = 0; njp < (njoin + nprune); njp++) {
@@ -179,127 +207,108 @@ pimv1_join_prune_print(register const u_char *bp, register u_int len)
                                type = "Join ";
                        else
                                type = "Prune";
-                       TCHECK2(bp[0], 6);
-                       (void)printf("\n\t%s %s%s%s%s/%d", type,
+                       ND_TCHECK2(bp[0], 6);
+                       ND_PRINT((ndo, "\n\t%s %s%s%s%s/%d", type,
                            (bp[0] & 0x01) ? "Sparse " : "Dense ",
                            (bp[1] & 0x80) ? "WC " : "",
                            (bp[1] & 0x40) ? "RP " : "SPT ",
-                       ipaddr_string(&bp[2]), bp[1] & 0x3f);
+                       ipaddr_string(ndo, &bp[2]), bp[1] & 0x3f));
                        bp += 6;
                        len -= 6;
                }
        }
        return;
 trunc:
-       (void)printf("[|pim]");
+       ND_PRINT((ndo, "[|pim]"));
        return;
 }
 
 void
-pimv1_print(register const u_char *bp, register u_int len)
+pimv1_print(netdissect_options *ndo,
+            register const u_char *bp, register u_int len)
 {
        register const u_char *ep;
        register u_char type;
 
-       ep = (const u_char *)snapend;
+       ep = (const u_char *)ndo->ndo_snapend;
        if (bp >= ep)
                return;
 
-       TCHECK(bp[1]);
+       ND_TCHECK(bp[1]);
        type = bp[1];
 
+       ND_PRINT((ndo, " %s", tok2str(pimv1_type_str, "[type %u]", type)));
        switch (type) {
-       case 0:
-               (void)printf(" Query");
-               if (TTEST(bp[8])) {
+       case PIMV1_TYPE_QUERY:
+               if (ND_TTEST(bp[8])) {
                        switch (bp[8] >> 4) {
                        case 0:
-                               (void)printf(" Dense-mode");
+                               ND_PRINT((ndo, " Dense-mode"));
                                break;
                        case 1:
-                               (void)printf(" Sparse-mode");
+                               ND_PRINT((ndo, " Sparse-mode"));
                                break;
                        case 2:
-                               (void)printf(" Sparse-Dense-mode");
+                               ND_PRINT((ndo, " Sparse-Dense-mode"));
                                break;
                        default:
-                               (void)printf(" mode-%d", bp[8] >> 4);
+                               ND_PRINT((ndo, " mode-%d", bp[8] >> 4));
                                break;
                        }
                }
-               if (vflag) {
-                       TCHECK2(bp[10],2);
-                       (void)printf(" (Hold-time ");
-                       relts_print(EXTRACT_16BITS(&bp[10]));
-                       (void)printf(")");
+               if (ndo->ndo_vflag) {
+                       ND_TCHECK2(bp[10],2);
+                       ND_PRINT((ndo, " (Hold-time "));
+                       relts_print(ndo, EXTRACT_16BITS(&bp[10]));
+                       ND_PRINT((ndo, ")"));
                }
                break;
 
-       case 1:
-               (void)printf(" Register");
-               TCHECK2(bp[8], 20);                     /* ip header */
-               (void)printf(" for %s > %s", ipaddr_string(&bp[20]),
-                   ipaddr_string(&bp[24]));
-               break;
-       case 2:
-               (void)printf(" Register-Stop");
-               TCHECK2(bp[12], 4);
-               (void)printf(" for %s > %s", ipaddr_string(&bp[8]),
-                   ipaddr_string(&bp[12]));
+       case PIMV1_TYPE_REGISTER:
+               ND_TCHECK2(bp[8], 20);                  /* ip header */
+               ND_PRINT((ndo, " for %s > %s", ipaddr_string(ndo, &bp[20]),
+                   ipaddr_string(ndo, &bp[24])));
                break;
-       case 3:
-               (void)printf(" Join/Prune");
-               if (vflag)
-                       pimv1_join_prune_print(&bp[8], len - 8);
+       case PIMV1_TYPE_REGISTER_STOP:
+               ND_TCHECK2(bp[12], sizeof(struct in_addr));
+               ND_PRINT((ndo, " for %s > %s", ipaddr_string(ndo, &bp[8]),
+                   ipaddr_string(ndo, &bp[12])));
                break;
-       case 4:
-               (void)printf(" RP-reachable");
-               if (vflag) {
-                       TCHECK2(bp[22], 2);
-                       (void)printf(" group %s",
-                       ipaddr_string(&bp[8]));
+       case PIMV1_TYPE_RP_REACHABILITY:
+               if (ndo->ndo_vflag) {
+                       ND_TCHECK2(bp[22], 2);
+                       ND_PRINT((ndo, " group %s", ipaddr_string(ndo, &bp[8])));
                        if (EXTRACT_32BITS(&bp[12]) != 0xffffffff)
-                               (void)printf("/%s", ipaddr_string(&bp[12]));
-                       (void)printf(" RP %s hold ", ipaddr_string(&bp[16]));
-                       relts_print(EXTRACT_16BITS(&bp[22]));
+                               ND_PRINT((ndo, "/%s", ipaddr_string(ndo, &bp[12])));
+                       ND_PRINT((ndo, " RP %s hold ", ipaddr_string(ndo, &bp[16])));
+                       relts_print(ndo, EXTRACT_16BITS(&bp[22]));
                }
                break;
-       case 5:
-               (void)printf(" Assert");
-               TCHECK2(bp[16], 4);
-               (void)printf(" for %s > %s", ipaddr_string(&bp[16]),
-                   ipaddr_string(&bp[8]));
+       case PIMV1_TYPE_ASSERT:
+               ND_TCHECK2(bp[16], sizeof(struct in_addr));
+               ND_PRINT((ndo, " for %s > %s", ipaddr_string(ndo, &bp[16]),
+                   ipaddr_string(ndo, &bp[8])));
                if (EXTRACT_32BITS(&bp[12]) != 0xffffffff)
-                       (void)printf("/%s", ipaddr_string(&bp[12]));
-               TCHECK2(bp[24], 4);
-               (void)printf(" %s pref %d metric %d",
+                       ND_PRINT((ndo, "/%s", ipaddr_string(ndo, &bp[12])));
+               ND_TCHECK2(bp[24], 4);
+               ND_PRINT((ndo, " %s pref %d metric %d",
                    (bp[20] & 0x80) ? "RP-tree" : "SPT",
                EXTRACT_32BITS(&bp[20]) & 0x7fffffff,
-               EXTRACT_32BITS(&bp[24]));
+               EXTRACT_32BITS(&bp[24])));
                break;
-       case 6:
-               (void)printf(" Graft");
-               if (vflag)
-                       pimv1_join_prune_print(&bp[8], len - 8);
-               break;
-       case 7:
-               (void)printf(" Graft-ACK");
-               if (vflag)
-                       pimv1_join_prune_print(&bp[8], len - 8);
-               break;
-       case 8:
-               (void)printf(" Mode");
-               break;
-       default:
-               (void)printf(" [type %d]", type);
+       case PIMV1_TYPE_JOIN_PRUNE:
+       case PIMV1_TYPE_GRAFT:
+       case PIMV1_TYPE_GRAFT_ACK:
+               if (ndo->ndo_vflag)
+                       pimv1_join_prune_print(ndo, &bp[8], len - 8);
                break;
        }
        if ((bp[4] >> 4) != 1)
-               (void)printf(" [v%d]", bp[4] >> 4);
+               ND_PRINT((ndo, " [v%d]", bp[4] >> 4));
        return;
 
 trunc:
-       (void)printf("[|pim]");
+       ND_PRINT((ndo, "[|pim]"));
        return;
 }
 
@@ -310,37 +319,38 @@ trunc:
  * This implements version 1+, dated Sept 9, 1998.
  */
 void
-cisco_autorp_print(register const u_char *bp, register u_int len)
+cisco_autorp_print(netdissect_options *ndo,
+                   register const u_char *bp, register u_int len)
 {
        int type;
        int numrps;
        int hold;
 
-       TCHECK(bp[0]);
-       (void)printf(" auto-rp ");
+       ND_TCHECK(bp[0]);
+       ND_PRINT((ndo, " auto-rp "));
        type = bp[0];
        switch (type) {
        case 0x11:
-               (void)printf("candidate-advert");
+               ND_PRINT((ndo, "candidate-advert"));
                break;
        case 0x12:
-               (void)printf("mapping");
+               ND_PRINT((ndo, "mapping"));
                break;
        default:
-               (void)printf("type-0x%02x", type);
+               ND_PRINT((ndo, "type-0x%02x", type));
                break;
        }
 
-       TCHECK(bp[1]);
+       ND_TCHECK(bp[1]);
        numrps = bp[1];
 
-       TCHECK2(bp[2], 2);
-       (void)printf(" Hold ");
+       ND_TCHECK2(bp[2], 2);
+       ND_PRINT((ndo, " Hold "));
        hold = EXTRACT_16BITS(&bp[2]);
        if (hold)
-               relts_print(EXTRACT_16BITS(&bp[2]));
+               relts_print(ndo, EXTRACT_16BITS(&bp[2]));
        else
-               printf("FOREVER");
+               ND_PRINT((ndo, "FOREVER"));
 
        /* Next 4 bytes are reserved. */
 
@@ -363,31 +373,35 @@ cisco_autorp_print(register const u_char *bp, register u_int len)
                int nentries;
                char s;
 
-               TCHECK2(bp[0], 4);
-               (void)printf(" RP %s", ipaddr_string(bp));
-               TCHECK(bp[4]);
+               ND_TCHECK2(bp[0], 4);
+               ND_PRINT((ndo, " RP %s", ipaddr_string(ndo, bp)));
+               ND_TCHECK(bp[4]);
                switch (bp[4] & 0x3) {
-               case 0: printf(" PIMv?");
+               case 0: ND_PRINT((ndo, " PIMv?"));
                        break;
-               case 1: printf(" PIMv1");
+               case 1: ND_PRINT((ndo, " PIMv1"));
                        break;
-               case 2: printf(" PIMv2");
+               case 2: ND_PRINT((ndo, " PIMv2"));
                        break;
-               case 3: printf(" PIMv1+2");
+               case 3: ND_PRINT((ndo, " PIMv1+2"));
                        break;
                }
                if (bp[4] & 0xfc)
-                       (void)printf(" [rsvd=0x%02x]", bp[4] & 0xfc);
-               TCHECK(bp[5]);
+                       ND_PRINT((ndo, " [rsvd=0x%02x]", bp[4] & 0xfc));
+               ND_TCHECK(bp[5]);
                nentries = bp[5];
                bp += 6; len -= 6;
                s = ' ';
                for (; nentries; nentries--) {
-                       TCHECK2(bp[0], 6);
-                       (void)printf("%c%s%s/%d", s, bp[0] & 1 ? "!" : "",
-                           ipaddr_string(&bp[2]), bp[1]);
-                       if (bp[0] & 0xfe)
-                               (void)printf("[rsvd=0x%02x]", bp[0] & 0xfe);
+                       ND_TCHECK2(bp[0], 6);
+                       ND_PRINT((ndo, "%c%s%s/%d", s, bp[0] & 1 ? "!" : "",
+                                 ipaddr_string(ndo, &bp[2]), bp[1]));
+                       if (bp[0] & 0x02) {
+                               ND_PRINT((ndo, " bidir"));
+                       }
+                       if (bp[0] & 0xfc) {
+                               ND_PRINT((ndo, "[rsvd=0x%02x]", bp[0] & 0xfc));
+                       }
                        s = ',';
                        bp += 6; len -= 6;
                }
@@ -395,43 +409,44 @@ cisco_autorp_print(register const u_char *bp, register u_int len)
        return;
 
 trunc:
-       (void)printf("[|autorp]");
+       ND_PRINT((ndo, "[|autorp]"));
        return;
 }
 
 void
-pim_print(register const u_char *bp, register u_int len)
+pim_print(netdissect_options *ndo,
+          register const u_char *bp, register u_int len, u_int cksum)
 {
        register const u_char *ep;
        register struct pim *pim = (struct pim *)bp;
 
-       ep = (const u_char *)snapend;
+       ep = (const u_char *)ndo->ndo_snapend;
        if (bp >= ep)
                return;
 #ifdef notyet                  /* currently we see only version and type */
-       TCHECK(pim->pim_rsv);
+       ND_TCHECK(pim->pim_rsv);
 #endif
 
        switch (PIM_VER(pim->pim_typever)) {
        case 2:
-            if (!vflag) {
-                printf("PIMv%u, %s, length: %u",
-                       PIM_VER(pim->pim_typever),
-                       tok2str(pimv2_type_values,"Unknown Type",PIM_TYPE(pim->pim_typever)),
-                       len);
-                return;
-            } else {
-                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)));
-                pimv2_print(bp, len);
-            }
-            break;
+               if (!ndo->ndo_vflag) {
+                       ND_PRINT((ndo, "PIMv%u, %s, length %u",
+                                 PIM_VER(pim->pim_typever),
+                                 tok2str(pimv2_type_values,"Unknown Type",PIM_TYPE(pim->pim_typever)),
+                                 len));
+                       return;
+               } else {
+                       ND_PRINT((ndo, "PIMv%u, length %u\n\t%s",
+                                 PIM_VER(pim->pim_typever),
+                                 len,
+                                 tok2str(pimv2_type_values,"Unknown Type",PIM_TYPE(pim->pim_typever))));
+                       pimv2_print(ndo, bp, len, cksum);
+               }
+               break;
        default:
-               printf("PIMv%u, length: %u",
-                       PIM_VER(pim->pim_typever),
-                       len);
+               ND_PRINT((ndo, "PIMv%u, length %u",
+                         PIM_VER(pim->pim_typever),
+                         len));
                break;
        }
        return;
@@ -504,27 +519,25 @@ enum pimv2_addrtype {
  * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  */
 static int
-pimv2_addr_print(const u_char *bp, enum pimv2_addrtype at, int silent)
+pimv2_addr_print(netdissect_options *ndo,
+                 const u_char *bp, enum pimv2_addrtype at, int silent)
 {
        int af;
-       const char *afstr;
        int len, hdrlen;
 
-       TCHECK(bp[0]);
+       ND_TCHECK(bp[0]);
 
        if (pimv2_addr_len == 0) {
-               TCHECK(bp[1]);
+               ND_TCHECK(bp[1]);
                switch (bp[0]) {
                case 1:
                        af = AF_INET;
-                       afstr = "IPv4";
-                       len = 4;
+                       len = sizeof(struct in_addr);
                        break;
 #ifdef INET6
                case 2:
                        af = AF_INET6;
-                       afstr = "IPv6";
-                       len = 16;
+                       len = sizeof(struct in6_addr);
                        break;
 #endif
                default:
@@ -535,14 +548,12 @@ pimv2_addr_print(const u_char *bp, enum pimv2_addrtype at, int silent)
                hdrlen = 2;
        } else {
                switch (pimv2_addr_len) {
-               case 4:
+               case sizeof(struct in_addr):
                        af = AF_INET;
-                       afstr = "IPv4";
                        break;
 #ifdef INET6
-               case 16:
+               case sizeof(struct in6_addr):
                        af = AF_INET6;
-                       afstr = "IPv6";
                        break;
 #endif
                default:
@@ -556,49 +567,49 @@ pimv2_addr_print(const u_char *bp, enum pimv2_addrtype at, int silent)
        bp += hdrlen;
        switch (at) {
        case pimv2_unicast:
-               TCHECK2(bp[0], len);
+               ND_TCHECK2(bp[0], len);
                if (af == AF_INET) {
                        if (!silent)
-                               (void)printf("%s", ipaddr_string(bp));
+                               ND_PRINT((ndo, "%s", ipaddr_string(ndo, bp)));
                }
 #ifdef INET6
                else if (af == AF_INET6) {
                        if (!silent)
-                               (void)printf("%s", ip6addr_string(bp));
+                               ND_PRINT((ndo, "%s", ip6addr_string(ndo, bp)));
                }
 #endif
                return hdrlen + len;
        case pimv2_group:
        case pimv2_source:
-               TCHECK2(bp[0], len + 2);
+               ND_TCHECK2(bp[0], len + 2);
                if (af == AF_INET) {
                        if (!silent) {
-                               (void)printf("%s", ipaddr_string(bp + 2));
+                               ND_PRINT((ndo, "%s", ipaddr_string(ndo, bp + 2)));
                                if (bp[1] != 32)
-                                       (void)printf("/%u", bp[1]);
+                                       ND_PRINT((ndo, "/%u", bp[1]));
                        }
                }
 #ifdef INET6
                else if (af == AF_INET6) {
                        if (!silent) {
-                               (void)printf("%s", ip6addr_string(bp + 2));
+                               ND_PRINT((ndo, "%s", ip6addr_string(ndo, bp + 2)));
                                if (bp[1] != 128)
-                                       (void)printf("/%u", bp[1]);
+                                       ND_PRINT((ndo, "/%u", bp[1]));
                        }
                }
 #endif
                if (bp[0] && !silent) {
                        if (at == pimv2_group) {
-                               (void)printf("(0x%02x)", bp[0]);
+                               ND_PRINT((ndo, "(0x%02x)", bp[0]));
                        } else {
-                               (void)printf("(%s%s%s",
+                               ND_PRINT((ndo, "(%s%s%s",
                                        bp[0] & 0x04 ? "S" : "",
                                        bp[0] & 0x02 ? "W" : "",
-                                       bp[0] & 0x01 ? "R" : "");
+                                       bp[0] & 0x01 ? "R" : ""));
                                if (bp[0] & 0xf8) {
-                                       (void) printf("+0x%02x", bp[0] & 0xf8);
+                                       ND_PRINT((ndo, "+0x%02x", bp[0] & 0xf8));
                                }
-                               (void)printf(")");
+                               ND_PRINT((ndo, ")"));
                        }
                }
                return hdrlen + 2 + len;
@@ -610,103 +621,110 @@ trunc:
 }
 
 static void
-pimv2_print(register const u_char *bp, register u_int len)
+pimv2_print(netdissect_options *ndo,
+            register const u_char *bp, register u_int len, u_int cksum)
 {
        register const u_char *ep;
        register struct pim *pim = (struct pim *)bp;
        int advance;
 
-       ep = (const u_char *)snapend;
+       ep = (const u_char *)ndo->ndo_snapend;
        if (bp >= ep)
                return;
        if (ep > bp + len)
                ep = bp + len;
-       TCHECK(pim->pim_rsv);
+       ND_TCHECK(pim->pim_rsv);
        pimv2_addr_len = pim->pim_rsv;
        if (pimv2_addr_len != 0)
-               (void)printf(", RFC2117-encoding");
+               ND_PRINT((ndo, ", RFC2117-encoding"));
+
+       ND_PRINT((ndo, ", cksum 0x%04x ", EXTRACT_16BITS(&pim->pim_cksum)));
+       if (EXTRACT_16BITS(&pim->pim_cksum) == 0) {
+               ND_PRINT((ndo, "(unverified)"));
+       } else {
+               ND_PRINT((ndo, "(%scorrect)", ND_TTEST2(bp[0], len) && cksum ? "in" : "" ));
+       }
 
        switch (PIM_TYPE(pim->pim_typever)) {
        case PIMV2_TYPE_HELLO:
            {
-               u_int16_t otype, olen;
+               uint16_t otype, olen;
                bp += 4;
                while (bp < ep) {
-                       TCHECK2(bp[0], 4);
+                       ND_TCHECK2(bp[0], 4);
                        otype = EXTRACT_16BITS(&bp[0]);
                        olen = EXTRACT_16BITS(&bp[2]);
-                       TCHECK2(bp[0], 4 + olen);
-
-                        printf("\n\t  %s Option (%u), length: %u, Value: ",
-                               tok2str( pimv2_hello_option_values,"Unknown",otype),
-                               otype,
-                               olen);
+                       ND_TCHECK2(bp[0], 4 + olen);
+                       ND_PRINT((ndo, "\n\t  %s Option (%u), length %u, Value: ",
+                                 tok2str(pimv2_hello_option_values, "Unknown", otype),
+                                 otype,
+                                 olen));
                        bp += 4;
 
                        switch (otype) {
                        case PIMV2_HELLO_OPTION_HOLDTIME:
-                                relts_print(EXTRACT_16BITS(bp));
-                                break;
+                               relts_print(ndo, EXTRACT_16BITS(bp));
+                               break;
 
                        case PIMV2_HELLO_OPTION_LANPRUNEDELAY:
                                if (olen != 4) {
-                                       (void)printf("ERROR: Option Lenght != 4 Bytes (%u)", olen);
+                                       ND_PRINT((ndo, "ERROR: Option Length != 4 Bytes (%u)", olen));
                                } else {
                                        char t_bit;
-                                       u_int16_t lan_delay, override_interval;
+                                       uint16_t lan_delay, override_interval;
                                        lan_delay = EXTRACT_16BITS(bp);
                                        override_interval = EXTRACT_16BITS(bp+2);
                                        t_bit = (lan_delay & 0x8000)? 1 : 0;
                                        lan_delay &= ~0x8000;
-                                       (void)printf("\n\t    T-bit=%d, LAN delay %dms, Override interval %dms",
-                                       t_bit, lan_delay, override_interval);
+                                       ND_PRINT((ndo, "\n\t    T-bit=%d, LAN delay %dms, Override interval %dms",
+                                       t_bit, lan_delay, override_interval));
                                }
                                break;
 
                        case PIMV2_HELLO_OPTION_DR_PRIORITY_OLD:
                        case PIMV2_HELLO_OPTION_DR_PRIORITY:
-                                switch (olen) {
-                                case 0:
-                                    printf("Bi-Directional Capability (Old)");
-                                    break;
-                                case 4:
-                                    printf("%u", EXTRACT_32BITS(bp));
-                                    break;
-                                default:
-                                    printf("ERROR: Option Lenght != 4 Bytes (%u)", olen);
-                                    break;
-                                }
-                                break;
+                               switch (olen) {
+                               case 0:
+                                       ND_PRINT((ndo, "Bi-Directional Capability (Old)"));
+                                       break;
+                               case 4:
+                                       ND_PRINT((ndo, "%u", EXTRACT_32BITS(bp)));
+                                       break;
+                               default:
+                                       ND_PRINT((ndo, "ERROR: Option Length != 4 Bytes (%u)", olen));
+                                       break;
+                               }
+                               break;
 
                        case PIMV2_HELLO_OPTION_GENID:
-                                (void)printf("0x%08x", EXTRACT_32BITS(bp));
+                               ND_PRINT((ndo, "0x%08x", EXTRACT_32BITS(bp)));
                                break;
 
                        case PIMV2_HELLO_OPTION_REFRESH_CAP:
-                                (void)printf("v%d", *bp);
+                               ND_PRINT((ndo, "v%d", *bp));
                                if (*(bp+1) != 0) {
-                                    (void)printf(", interval ");
-                                    relts_print(*(bp+1));
+                                       ND_PRINT((ndo, ", interval "));
+                                       relts_print(ndo, *(bp+1));
                                }
                                if (EXTRACT_16BITS(bp+2) != 0) {
-                                    (void)printf(" ?0x%04x?", EXTRACT_16BITS(bp+2));
+                                       ND_PRINT((ndo, " ?0x%04x?", EXTRACT_16BITS(bp+2)));
                                }
                                break;
 
                        case  PIMV2_HELLO_OPTION_BIDIR_CAP:
                                break;
 
-                        case PIMV2_HELLO_OPTION_ADDRESS_LIST_OLD:
-                        case PIMV2_HELLO_OPTION_ADDRESS_LIST:
-                               if (vflag > 1) {
+                       case PIMV2_HELLO_OPTION_ADDRESS_LIST_OLD:
+                       case PIMV2_HELLO_OPTION_ADDRESS_LIST:
+                               if (ndo->ndo_vflag > 1) {
                                        const u_char *ptr = bp;
                                        while (ptr < (bp+olen)) {
                                                int advance;
 
-                                               printf("\n\t    ");
-                                               advance = pimv2_addr_print(ptr, pimv2_unicast, 0);
+                                               ND_PRINT((ndo, "\n\t    "));
+                                               advance = pimv2_addr_print(ndo, ptr, pimv2_unicast, 0);
                                                if (advance < 0) {
-                                                       printf("...");
+                                                       ND_PRINT((ndo, "..."));
                                                        break;
                                                }
                                                ptr += advance;
@@ -714,13 +732,13 @@ pimv2_print(register const u_char *bp, register u_int len)
                                }
                                break;
                        default:
-                                if (vflag <= 1)
-                                    print_unknown_data(bp,"\n\t    ",olen);
-                                break;
+                               if (ndo->ndo_vflag <= 1)
+                                       print_unknown_data(ndo, bp, "\n\t    ", olen);
+                               break;
                        }
-                        /* do we want to see an additionally hexdump ? */
-                        if (vflag> 1)
-                            print_unknown_data(bp,"\n\t    ",olen);
+                       /* do we want to see an additionally hexdump ? */
+                       if (ndo->ndo_vflag> 1)
+                               print_unknown_data(ndo, bp, "\n\t    ", olen);
                        bp += olen;
                }
                break;
@@ -730,29 +748,33 @@ pimv2_print(register const u_char *bp, register u_int len)
        {
                struct ip *ip;
 
-               if (vflag && bp + 8 <= ep) {
-                       (void)printf(" %s%s", bp[4] & 0x80 ? "B" : "",
-                               bp[4] & 0x40 ? "N" : "");
-               }
-               bp += 8; len -= 8;
+               ND_TCHECK2(*(bp + 4), PIMV2_REGISTER_FLAG_LEN);
 
+               ND_PRINT((ndo, ", Flags [ %s ]\n\t",
+                         tok2str(pimv2_register_flag_values,
+                         "none",
+                         EXTRACT_32BITS(bp+4))));
+
+               bp += 8; len -= 8;
                /* encapsulated multicast packet */
-               if (bp >= ep)
-                       break;
                ip = (struct ip *)bp;
                switch (IP_V(ip)) {
+                case 0: /* Null header */
+                       ND_PRINT((ndo, "IP-Null-header %s > %s",
+                                 ipaddr_string(ndo, &ip->ip_src),
+                                 ipaddr_string(ndo, &ip->ip_dst)));
+                       break;
+
                case 4: /* IPv4 */
-                       printf(" ");
-                       ip_print(bp, len);
+                       ip_print(ndo, bp, len);
                        break;
 #ifdef INET6
                case 6: /* IPv6 */
-                       printf(" ");
-                       ip6_print(bp, len);
+                       ip6_print(ndo, bp, len);
                        break;
 #endif
                default:
-                       (void)printf(" IP ver %d", IP_V(ip));
+                       ND_PRINT((ndo, "IP ver %d", IP_V(ip)));
                        break;
                }
                break;
@@ -762,17 +784,17 @@ pimv2_print(register const u_char *bp, register u_int len)
                bp += 4; len -= 4;
                if (bp >= ep)
                        break;
-               (void)printf(" group=");
-               if ((advance = pimv2_addr_print(bp, pimv2_group, 0)) < 0) {
-                       (void)printf("...");
+               ND_PRINT((ndo, " group="));
+               if ((advance = pimv2_addr_print(ndo, bp, pimv2_group, 0)) < 0) {
+                       ND_PRINT((ndo, "..."));
                        break;
                }
                bp += advance; len -= advance;
                if (bp >= ep)
                        break;
-               (void)printf(" source=");
-               if ((advance = pimv2_addr_print(bp, pimv2_unicast, 0)) < 0) {
-                       (void)printf("...");
+               ND_PRINT((ndo, " source="));
+               if ((advance = pimv2_addr_print(ndo, bp, pimv2_unicast, 0)) < 0) {
+                       ND_PRINT((ndo, "..."));
                        break;
                }
                bp += advance; len -= advance;
@@ -819,19 +841,19 @@ pimv2_print(register const u_char *bp, register u_int len)
          */
 
            {
-               u_int8_t ngroup;
-               u_int16_t holdtime;
-               u_int16_t njoin;
-               u_int16_t nprune;
+               uint8_t ngroup;
+               uint16_t holdtime;
+               uint16_t njoin;
+               uint16_t nprune;
                int i, j;
 
                bp += 4; len -= 4;
                if (PIM_TYPE(pim->pim_typever) != 7) {  /*not for Graft-ACK*/
                        if (bp >= ep)
                                break;
-                       (void)printf(", upstream-neighbor: ");
-                       if ((advance = pimv2_addr_print(bp, pimv2_unicast, 0)) < 0) {
-                               (void)printf("...");
+                       ND_PRINT((ndo, ", upstream-neighbor: "));
+                       if ((advance = pimv2_addr_print(ndo, bp, pimv2_unicast, 0)) < 0) {
+                               ND_PRINT((ndo, "..."));
                                break;
                        }
                        bp += advance; len -= advance;
@@ -840,44 +862,44 @@ pimv2_print(register const u_char *bp, register u_int len)
                        break;
                ngroup = bp[1];
                holdtime = EXTRACT_16BITS(&bp[2]);
-               (void)printf("\n\t  %u group(s)", ngroup);
+               ND_PRINT((ndo, "\n\t  %u group(s)", ngroup));
                if (PIM_TYPE(pim->pim_typever) != 7) {  /*not for Graft-ACK*/
-                       (void)printf(", holdtime: ");
+                       ND_PRINT((ndo, ", holdtime: "));
                        if (holdtime == 0xffff)
-                               (void)printf("infinite");
+                               ND_PRINT((ndo, "infinite"));
                        else
-                               relts_print(holdtime);
+                               relts_print(ndo, holdtime);
                }
                bp += 4; len -= 4;
                for (i = 0; i < ngroup; i++) {
                        if (bp >= ep)
                                goto jp_done;
-                       (void)printf("\n\t    group #%u: ", i+1);
-                       if ((advance = pimv2_addr_print(bp, pimv2_group, 0)) < 0) {
-                               (void)printf("...)");
+                       ND_PRINT((ndo, "\n\t    group #%u: ", i+1));
+                       if ((advance = pimv2_addr_print(ndo, bp, pimv2_group, 0)) < 0) {
+                               ND_PRINT((ndo, "...)"));
                                goto jp_done;
                        }
                        bp += advance; len -= advance;
                        if (bp + 4 > ep) {
-                               (void)printf("...)");
+                               ND_PRINT((ndo, "...)"));
                                goto jp_done;
                        }
                        njoin = EXTRACT_16BITS(&bp[0]);
                        nprune = EXTRACT_16BITS(&bp[2]);
-                       (void)printf(", joined sources: %u, pruned sources: %u", njoin,nprune);
+                       ND_PRINT((ndo, ", joined sources: %u, pruned sources: %u", njoin, nprune));
                        bp += 4; len -= 4;
                        for (j = 0; j < njoin; j++) {
-                               (void)printf("\n\t      joined source #%u: ",j+1);
-                               if ((advance = pimv2_addr_print(bp, pimv2_source, 0)) < 0) {
-                                       (void)printf("...)");
+                               ND_PRINT((ndo, "\n\t      joined source #%u: ", j+1));
+                               if ((advance = pimv2_addr_print(ndo, bp, pimv2_source, 0)) < 0) {
+                                       ND_PRINT((ndo, "...)"));
                                        goto jp_done;
                                }
                                bp += advance; len -= advance;
                        }
                        for (j = 0; j < nprune; j++) {
-                               (void)printf("\n\t      pruned source #%u: ",j+1);
-                               if ((advance = pimv2_addr_print(bp, pimv2_source, 0)) < 0) {
-                                       (void)printf("...)");
+                               ND_PRINT((ndo, "\n\t      pruned source #%u: ", j+1));
+                               if ((advance = pimv2_addr_print(ndo, bp, pimv2_source, 0)) < 0) {
+                                       ND_PRINT((ndo, "...)"));
                                        goto jp_done;
                                }
                                bp += advance; len -= advance;
@@ -893,72 +915,72 @@ pimv2_print(register const u_char *bp, register u_int len)
                bp += 4;
 
                /* Fragment Tag, Hash Mask len, and BSR-priority */
-               if (bp + sizeof(u_int16_t) >= ep) break;
-               (void)printf(" tag=%x", EXTRACT_16BITS(bp));
-               bp += sizeof(u_int16_t);
+               if (bp + sizeof(uint16_t) >= ep) break;
+               ND_PRINT((ndo, " tag=%x", EXTRACT_16BITS(bp)));
+               bp += sizeof(uint16_t);
                if (bp >= ep) break;
-               (void)printf(" hashmlen=%d", bp[0]);
+               ND_PRINT((ndo, " hashmlen=%d", bp[0]));
                if (bp + 1 >= ep) break;
-               (void)printf(" BSRprio=%d", bp[1]);
+               ND_PRINT((ndo, " BSRprio=%d", bp[1]));
                bp += 2;
 
                /* Encoded-Unicast-BSR-Address */
                if (bp >= ep) break;
-               (void)printf(" BSR=");
-               if ((advance = pimv2_addr_print(bp, pimv2_unicast, 0)) < 0) {
-                       (void)printf("...");
+               ND_PRINT((ndo, " BSR="));
+               if ((advance = pimv2_addr_print(ndo, bp, pimv2_unicast, 0)) < 0) {
+                       ND_PRINT((ndo, "..."));
                        break;
                }
                bp += advance;
 
                for (i = 0; bp < ep; i++) {
                        /* Encoded-Group Address */
-                       (void)printf(" (group%d: ", i);
-                       if ((advance = pimv2_addr_print(bp, pimv2_group, 0))
+                       ND_PRINT((ndo, " (group%d: ", i));
+                       if ((advance = pimv2_addr_print(ndo, bp, pimv2_group, 0))
                            < 0) {
-                               (void)printf("...)");
+                               ND_PRINT((ndo, "...)"));
                                goto bs_done;
                        }
                        bp += advance;
 
                        /* RP-Count, Frag RP-Cnt, and rsvd */
                        if (bp >= ep) {
-                               (void)printf("...)");
+                               ND_PRINT((ndo, "...)"));
                                goto bs_done;
                        }
-                       (void)printf(" RPcnt=%d", bp[0]);
+                       ND_PRINT((ndo, " RPcnt=%d", bp[0]));
                        if (bp + 1 >= ep) {
-                               (void)printf("...)");
+                               ND_PRINT((ndo, "...)"));
                                goto bs_done;
                        }
-                       (void)printf(" FRPcnt=%d", frpcnt = bp[1]);
+                       ND_PRINT((ndo, " FRPcnt=%d", frpcnt = bp[1]));
                        bp += 4;
 
                        for (j = 0; j < frpcnt && bp < ep; j++) {
                                /* each RP info */
-                               (void)printf(" RP%d=", j);
-                               if ((advance = pimv2_addr_print(bp,
+                               ND_PRINT((ndo, " RP%d=", j));
+                               if ((advance = pimv2_addr_print(ndo, bp,
                                                                pimv2_unicast,
                                                                0)) < 0) {
-                                       (void)printf("...)");
+                                       ND_PRINT((ndo, "...)"));
                                        goto bs_done;
                                }
                                bp += advance;
 
                                if (bp + 1 >= ep) {
-                                       (void)printf("...)");
+                                       ND_PRINT((ndo, "...)"));
                                        goto bs_done;
                                }
-                               (void)printf(",holdtime=");
-                               relts_print(EXTRACT_16BITS(bp));
+                               ND_PRINT((ndo, ",holdtime="));
+                               relts_print(ndo, EXTRACT_16BITS(bp));
                                if (bp + 2 >= ep) {
-                                       (void)printf("...)");
+                                       ND_PRINT((ndo, "...)"));
                                        goto bs_done;
                                }
-                               (void)printf(",prio=%d", bp[2]);
+                               ND_PRINT((ndo, ",prio=%d", bp[2]));
                                bp += 4;
                        }
-                       (void)printf(")");
+                       ND_PRINT((ndo, ")"));
                }
           bs_done:
                break;
@@ -967,26 +989,26 @@ pimv2_print(register const u_char *bp, register u_int len)
                bp += 4; len -= 4;
                if (bp >= ep)
                        break;
-               (void)printf(" group=");
-               if ((advance = pimv2_addr_print(bp, pimv2_group, 0)) < 0) {
-                       (void)printf("...");
+               ND_PRINT((ndo, " group="));
+               if ((advance = pimv2_addr_print(ndo, bp, pimv2_group, 0)) < 0) {
+                       ND_PRINT((ndo, "..."));
                        break;
                }
                bp += advance; len -= advance;
                if (bp >= ep)
                        break;
-               (void)printf(" src=");
-               if ((advance = pimv2_addr_print(bp, pimv2_unicast, 0)) < 0) {
-                       (void)printf("...");
+               ND_PRINT((ndo, " src="));
+               if ((advance = pimv2_addr_print(ndo, bp, pimv2_unicast, 0)) < 0) {
+                       ND_PRINT((ndo, "..."));
                        break;
                }
                bp += advance; len -= advance;
                if (bp + 8 > ep)
                        break;
                if (bp[0] & 0x80)
-                       (void)printf(" RPT");
-               (void)printf(" pref=%u", EXTRACT_32BITS(&bp[0]) & 0x7fffffff);
-               (void)printf(" metric=%u", EXTRACT_32BITS(&bp[4]));
+                       ND_PRINT((ndo, " RPT"));
+               ND_PRINT((ndo, " pref=%u", EXTRACT_32BITS(&bp[0]) & 0x7fffffff));
+               ND_PRINT((ndo, " metric=%u", EXTRACT_32BITS(&bp[4])));
                break;
 
        case PIMV2_TYPE_CANDIDATE_RP:
@@ -996,30 +1018,30 @@ pimv2_print(register const u_char *bp, register u_int len)
 
                /* Prefix-Cnt, Priority, and Holdtime */
                if (bp >= ep) break;
-               (void)printf(" prefix-cnt=%d", bp[0]);
+               ND_PRINT((ndo, " prefix-cnt=%d", bp[0]));
                pfxcnt = bp[0];
                if (bp + 1 >= ep) break;
-               (void)printf(" prio=%d", bp[1]);
+               ND_PRINT((ndo, " prio=%d", bp[1]));
                if (bp + 3 >= ep) break;
-               (void)printf(" holdtime=");
-               relts_print(EXTRACT_16BITS(&bp[2]));
+               ND_PRINT((ndo, " holdtime="));
+               relts_print(ndo, EXTRACT_16BITS(&bp[2]));
                bp += 4;
 
                /* Encoded-Unicast-RP-Address */
                if (bp >= ep) break;
-               (void)printf(" RP=");
-               if ((advance = pimv2_addr_print(bp, pimv2_unicast, 0)) < 0) {
-                       (void)printf("...");
+               ND_PRINT((ndo, " RP="));
+               if ((advance = pimv2_addr_print(ndo, bp, pimv2_unicast, 0)) < 0) {
+                       ND_PRINT((ndo, "..."));
                        break;
                }
                bp += advance;
 
                /* Encoded-Group Addresses */
                for (i = 0; i < pfxcnt && bp < ep; i++) {
-                       (void)printf(" Group%d=", i);
-                       if ((advance = pimv2_addr_print(bp, pimv2_group, 0))
+                       ND_PRINT((ndo, " Group%d=", i));
+                       if ((advance = pimv2_addr_print(ndo, bp, pimv2_group, 0))
                            < 0) {
-                               (void)printf("...");
+                               ND_PRINT((ndo, "..."));
                                break;
                        }
                        bp += advance;
@@ -1028,37 +1050,44 @@ pimv2_print(register const u_char *bp, register u_int len)
        }
 
        case PIMV2_TYPE_PRUNE_REFRESH:
-               (void)printf(" src=");
-               if ((advance = pimv2_addr_print(bp, pimv2_unicast, 0)) < 0) {
-                       (void)printf("...");
+               ND_PRINT((ndo, " src="));
+               if ((advance = pimv2_addr_print(ndo, bp, pimv2_unicast, 0)) < 0) {
+                       ND_PRINT((ndo, "..."));
                        break;
                }
                bp += advance;
-               (void)printf(" grp=");
-               if ((advance = pimv2_addr_print(bp, pimv2_group, 0)) < 0) {
-                       (void)printf("...");
+               ND_PRINT((ndo, " grp="));
+               if ((advance = pimv2_addr_print(ndo, bp, pimv2_group, 0)) < 0) {
+                       ND_PRINT((ndo, "..."));
                        break;
                }
                bp += advance;
-               (void)printf(" forwarder=");
-               if ((advance = pimv2_addr_print(bp, pimv2_unicast, 0)) < 0) {
-                       (void)printf("...");
+               ND_PRINT((ndo, " forwarder="));
+               if ((advance = pimv2_addr_print(ndo, bp, pimv2_unicast, 0)) < 0) {
+                       ND_PRINT((ndo, "..."));
                        break;
                }
                bp += advance;
-               TCHECK2(bp[0], 2);
-               (void)printf(" TUNR ");
-               relts_print(EXTRACT_16BITS(bp));
+               ND_TCHECK2(bp[0], 2);
+               ND_PRINT((ndo, " TUNR "));
+               relts_print(ndo, EXTRACT_16BITS(bp));
                break;
 
 
         default:
-               (void)printf(" [type %d]", PIM_TYPE(pim->pim_typever));
+               ND_PRINT((ndo, " [type %d]", PIM_TYPE(pim->pim_typever)));
                break;
        }
 
        return;
 
 trunc:
-       (void)printf("[|pim]");
+       ND_PRINT((ndo, "[|pim]"));
 }
+
+/*
+ * Local Variables:
+ * c-style: whitesmith
+ * c-basic-offset: 8
+ * End:
+ */