X-Git-Url: https://git.tcpdump.org/tcpdump/blobdiff_plain/ec799d60f6cd3f41041b57efe3963c28dda94d4a..ad7a38341c19e71e3595c17368ac18f08b71482d:/print-pim.c diff --git a/print-pim.c b/print-pim.c index f9fd0c69..157df46f 100644 --- a/print-pim.c +++ b/print-pim.c @@ -29,7 +29,15 @@ static const char rcsid[] _U_ = #endif #include + +#include +#include + #include "interface.h" +#include "addrtoname.h" +#include "extract.h" + +#include "ip.h" #define PIMV2_TYPE_HELLO 0 #define PIMV2_TYPE_REGISTER 1 @@ -42,7 +50,7 @@ static const char rcsid[] _U_ = #define PIMV2_TYPE_CANDIDATE_RP 8 #define PIMV2_TYPE_PRUNE_REFRESH 9 -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" }, @@ -66,7 +74,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)" }, @@ -83,11 +91,11 @@ static struct tok pimv2_hello_option_values[] = { #define PIMV2_REGISTER_FLAG_BORDER 0x80000000 #define PIMV2_REGISTER_FLAG_NULL 0x40000000 -static struct tok pimv2_register_flag_values[] = { +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, @@ -108,22 +116,12 @@ struct pim { u_short pim_cksum; /* IP style check sum */ }; - -#include -#include - -#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, u_int cksum); static void pimv1_join_prune_print(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. */ @@ -164,8 +162,6 @@ pimv1_join_prune_print(register const u_char *bp, register u_int len) len -= 8; TCHECK2(bp[0], 4); - maddrlen = bp[1]; - addrlen = bp[2]; ngroups = bp[3]; bp += 4; len -= 4; @@ -399,8 +395,12 @@ cisco_autorp_print(register const u_char *bp, register u_int len) 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); + if (bp[0] & 0x02) { + (void)printf(" bidir"); + } + if (bp[0] & 0xfc) { + (void)printf("[rsvd=0x%02x]", bp[0] & 0xfc); + } s = ','; bp += 6; len -= 6; } @@ -665,7 +665,7 @@ pimv2_print(register const u_char *bp, register u_int len, u_int cksum) case PIMV2_HELLO_OPTION_LANPRUNEDELAY: if (olen != 4) { - (void)printf("ERROR: Option Lenght != 4 Bytes (%u)", olen); + (void)printf("ERROR: Option Length != 4 Bytes (%u)", olen); } else { char t_bit; u_int16_t lan_delay, override_interval; @@ -688,7 +688,7 @@ pimv2_print(register const u_char *bp, register u_int len, u_int cksum) printf("%u", EXTRACT_32BITS(bp)); break; default: - printf("ERROR: Option Lenght != 4 Bytes (%u)", olen); + printf("ERROR: Option Length != 4 Bytes (%u)", olen); break; } break; @@ -730,12 +730,12 @@ pimv2_print(register const u_char *bp, register u_int len, u_int cksum) break; default: if (vflag <= 1) - print_unknown_data(bp,"\n\t ",olen); + print_unknown_data(gndo,bp,"\n\t ",olen); break; } /* do we want to see an additionally hexdump ? */ if (vflag> 1) - print_unknown_data(bp,"\n\t ",olen); + print_unknown_data(gndo,bp,"\n\t ",olen); bp += olen; } break; @@ -768,7 +768,7 @@ pimv2_print(register const u_char *bp, register u_int len, u_int cksum) break; #ifdef INET6 case 6: /* IPv6 */ - ip6_print(bp, len); + ip6_print(gndo, bp, len); break; #endif default: