X-Git-Url: https://git.tcpdump.org/tcpdump/blobdiff_plain/b3794ce8b7fa7d19fe5fcec5acbe85a800417a91..ad06a893cfd3acca3fba38d8b39b6b15dd3053ea:/print-pim.c diff --git a/print-pim.c b/print-pim.c index b38fba48..87a611be 100644 --- a/print-pim.c +++ b/print-pim.c @@ -21,18 +21,14 @@ #ifndef lint static const char rcsid[] = - "@(#) $Header: /tcpdump/master/tcpdump/print-pim.c,v 1.27 2001-05-11 02:12:32 fenner Exp $ (LBL)"; + "@(#) $Header: /tcpdump/master/tcpdump/print-pim.c,v 1.36 2002-12-11 07:14:06 guy Exp $ (LBL)"; #endif #ifdef HAVE_CONFIG_H #include "config.h" #endif -#include -#include -#include - -#include +#include /* * XXX: We consider a case where IPv6 is not ready yet for portability, @@ -56,7 +52,6 @@ struct pim { #include #include -#include #include "interface.h" #include "addrtoname.h" @@ -127,7 +122,7 @@ pimv1_join_prune_print(register const u_char *bp, register u_int len) bp += 12; len -= 12; for (njp = 0; njp < (njoin + nprune); njp++) { - char *type; + const char *type; if (njp < njoin) type = "Join "; @@ -258,7 +253,9 @@ trunc: /* * auto-RP is a cisco protocol, documented at - * ftp://ftpeng.cisco.com/ipmulticast/pim-autorp-spec01.txt + * ftp://ftpeng.cisco.com/ipmulticast/specs/pim-autorp-spec01.txt + * + * This implements version 1+, dated Sept 9, 1998. */ void cisco_autorp_print(register const u_char *bp, register u_int len) @@ -327,6 +324,8 @@ cisco_autorp_print(register const u_char *bp, register u_int len) case 3: printf(" PIMv1+2"); break; } + if (bp[4] & 0xfc) + (void)printf(" [rsvd=0x%02x]", bp[4] & 0xfc); TCHECK(bp[5]); nentries = bp[5]; bp += 6; len -= 6; @@ -335,6 +334,8 @@ 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); s = ','; bp += 6; len -= 6; } @@ -416,11 +417,6 @@ static int pimv2_addr_len; enum pimv2_addrtype { pimv2_unicast, pimv2_group, pimv2_source }; -#if 0 -static char *addrtypestr[] = { - "unicast", "group", "source" -}; -#endif /* 0 1 2 3 * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 @@ -446,7 +442,7 @@ static int pimv2_addr_print(const u_char *bp, enum pimv2_addrtype at, int silent) { int af; - char *afstr; + const char *afstr; int len, hdrlen; TCHECK(bp[0]); @@ -583,7 +579,36 @@ pimv2_print(register const u_char *bp, register u_int len) (void)printf(")"); break; + case 2: /* LAN Prune Delay */ + (void)printf(" (LAN-Prune-Delay: "); + if (olen != 4) { + (void)printf("!olen=%d!)", olen); + } else { + char t_bit; + u_int16_t lan_delay, override_interval; + lan_delay = EXTRACT_16BITS(&bp[4]); + override_interval = EXTRACT_16BITS(&bp[6]); + t_bit = (lan_delay & 0x8000)? 1 : 0; + lan_delay &= ~0x8000; + (void)printf("T-bit=%d lan-delay=%dms override-interval=%dms)", + t_bit, lan_delay, override_interval); + } + break; + + case 18: /* Old DR-Priority */ + if (olen == 4) + (void)printf(" (OLD-DR-Priority: %d)", + EXTRACT_32BITS(&bp[4])); + else + goto unknown; + break; + + case 19: /* DR-Priority */ + if (olen == 0) { + (void)printf(" (OLD-bidir-capable)"); + break; + } (void)printf(" (DR-Priority: "); if (olen != 4) { (void)printf("!olen=%d!)", olen); @@ -613,6 +638,7 @@ pimv2_print(register const u_char *bp, register u_int len) break; default: + unknown: if (vflag) (void)printf(" [Hello option %d]", otype); }