]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-pim.c
Default to first interface from pcap_findalldevs()
[tcpdump] / print-pim.c
index a0bf905a4e4f7ce187c8356580f709506fbd6ea0..ce4b2afd5228df258266550cf881b6baf8782712 100644 (file)
 #include "config.h"
 #endif
 
-#include <tcpdump-stdinc.h>
+#include <netdissect-stdinc.h>
 
-#include "interface.h"
+#include "netdissect.h"
 #include "addrtoname.h"
 #include "extract.h"
 
 #include "ip.h"
 #include "ip6.h"
+#include "ipproto.h"
 
 #define PIMV1_TYPE_QUERY           0
 #define PIMV1_TYPE_REGISTER        1
@@ -534,12 +535,10 @@ pimv2_addr_print(netdissect_options *ndo,
                        af = AF_INET;
                        len = sizeof(struct in_addr);
                        break;
-#ifdef INET6
                case 2:
                        af = AF_INET6;
                        len = sizeof(struct in6_addr);
                        break;
-#endif
                default:
                        return -1;
                }
@@ -551,11 +550,9 @@ pimv2_addr_print(netdissect_options *ndo,
                case sizeof(struct in_addr):
                        af = AF_INET;
                        break;
-#ifdef INET6
                case sizeof(struct in6_addr):
                        af = AF_INET6;
                        break;
-#endif
                default:
                        return -1;
                        break;
@@ -572,12 +569,10 @@ pimv2_addr_print(netdissect_options *ndo,
                        if (!silent)
                                ND_PRINT((ndo, "%s", ipaddr_string(ndo, bp)));
                }
-#ifdef INET6
                else if (af == AF_INET6) {
                        if (!silent)
                                ND_PRINT((ndo, "%s", ip6addr_string(ndo, bp)));
                }
-#endif
                return hdrlen + len;
        case pimv2_group:
        case pimv2_source:
@@ -589,7 +584,6 @@ pimv2_addr_print(netdissect_options *ndo,
                                        ND_PRINT((ndo, "/%u", bp[1]));
                        }
                }
-#ifdef INET6
                else if (af == AF_INET6) {
                        if (!silent) {
                                ND_PRINT((ndo, "%s", ip6addr_string(ndo, bp + 2)));
@@ -597,7 +591,6 @@ pimv2_addr_print(netdissect_options *ndo,
                                        ND_PRINT((ndo, "/%u", bp[1]));
                        }
                }
-#endif
                if (bp[0] && !silent) {
                        if (at == pimv2_group) {
                                ND_PRINT((ndo, "(0x%02x)", bp[0]));
@@ -640,14 +633,12 @@ pimv2_check_checksum(const u_char *bp, const u_char *bp2, u_int len)
                vec[0].len = len;
                cksum = in_cksum(vec, 1);
                return (cksum ? INCORRECT : CORRECT);
-#ifdef INET6
        } else if (IP_V(ip) == 6) {
                const struct ip6_hdr *ip6;
 
                ip6 = (const struct ip6_hdr *)bp2;
                cksum = nextproto6_cksum(ip6, bp, len, len, IPPROTO_PIM);
                return (cksum ? INCORRECT : CORRECT);
-#endif
        } else {
                return (UNVERIFIED);
        }
@@ -787,8 +778,6 @@ pimv2_print(netdissect_options *ndo,
                                if (ndo->ndo_vflag > 1) {
                                        const u_char *ptr = bp;
                                        while (ptr < (bp+olen)) {
-                                               int advance;
-
                                                ND_PRINT((ndo, "\n\t    "));
                                                advance = pimv2_addr_print(ndo, ptr, pimv2_unicast, 0);
                                                if (advance < 0) {