#ifndef lint
static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/tcpdump/print-pim.c,v 1.41 2003-12-15 13:15:25 hannes 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
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);
if (EXTRACT_32BITS(&bp[4]) != 0xffffffff)
(void)printf("/%s", ipaddr_string(&bp[4]));
TCHECK2(bp[8], 4);
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;
pimv2_addr_print(const u_char *bp, enum pimv2_addrtype at, int silent)
{
int af;
- const char *afstr;
int len, hdrlen;
TCHECK(bp[0]);
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
switch (pimv2_addr_len) {
case 4:
af = AF_INET;
- afstr = "IPv4";
break;
#ifdef INET6
case 16:
af = AF_INET6;
- afstr = "IPv6";
break;
#endif
default:
olen = EXTRACT_16BITS(&bp[2]);
TCHECK2(bp[0], 4 + olen);
- printf("\n\t %s Option (%u), Value: ",
+ printf("\n\t %s Option (%u), length: %u, Value: ",
tok2str( pimv2_hello_option_values,"Unknown",otype),
- otype);
+ otype,
+ olen);
bp += 4;
switch (otype) {
switch (IP_V(ip)) {
case 4: /* IPv4 */
printf(" ");
- ip_print(bp, len);
+ ip_print(gndo, bp, len);
break;
#ifdef INET6
case 6: /* IPv6 */
case PIMV2_TYPE_JOIN_PRUNE:
case PIMV2_TYPE_GRAFT:
case PIMV2_TYPE_GRAFT_ACK:
+
+
+ /*
+ * 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
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * |PIM Ver| Type | Addr length | Checksum |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | Unicast-Upstream Neighbor Address |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | Reserved | Num groups | Holdtime |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | Encoded-Multicast Group Address-1 |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | Number of Joined Sources | Number of Pruned Sources |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | Encoded-Joined Source Address-1 |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | . |
+ * | . |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | Encoded-Joined Source Address-n |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | Encoded-Pruned Source Address-1 |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | . |
+ * | . |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | Encoded-Pruned Source Address-n |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | . |
+ * | . |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | Encoded-Multicast Group Address-n |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ */
+
{
u_int8_t ngroup;
u_int16_t holdtime;
if (PIM_TYPE(pim->pim_typever) != 7) { /*not for Graft-ACK*/
if (bp >= ep)
break;
- (void)printf(" upstream-neighbor=");
+ (void)printf(", upstream-neighbor: ");
if ((advance = pimv2_addr_print(bp, pimv2_unicast, 0)) < 0) {
(void)printf("...");
break;
break;
ngroup = bp[1];
holdtime = EXTRACT_16BITS(&bp[2]);
- (void)printf(" groups=%u", ngroup);
+ (void)printf("\n\t %u group(s)", ngroup);
if (PIM_TYPE(pim->pim_typever) != 7) { /*not for Graft-ACK*/
- (void)printf(" holdtime=");
+ (void)printf(", holdtime: ");
if (holdtime == 0xffff)
- (void)printf("infty");
+ (void)printf("infinite");
else
relts_print(holdtime);
}
for (i = 0; i < ngroup; i++) {
if (bp >= ep)
goto jp_done;
- (void)printf(" (group%d: ", i);
+ (void)printf("\n\t group #%u: ", i+1);
if ((advance = pimv2_addr_print(bp, pimv2_group, 0)) < 0) {
(void)printf("...)");
goto jp_done;
}
njoin = EXTRACT_16BITS(&bp[0]);
nprune = EXTRACT_16BITS(&bp[2]);
- (void)printf(" join=%u", njoin);
+ (void)printf(", joined sources: %u, pruned sources: %u", njoin,nprune);
bp += 4; len -= 4;
for (j = 0; j < njoin; j++) {
- (void)printf(" ");
+ (void)printf("\n\t joined source #%u: ",j+1);
if ((advance = pimv2_addr_print(bp, pimv2_source, 0)) < 0) {
(void)printf("...)");
goto jp_done;
}
bp += advance; len -= advance;
}
- (void)printf(" prune=%u", nprune);
for (j = 0; j < nprune; j++) {
- (void)printf(" ");
+ (void)printf("\n\t pruned source #%u: ",j+1);
if ((advance = pimv2_addr_print(bp, pimv2_source, 0)) < 0) {
(void)printf("...)");
goto jp_done;
}
bp += advance; len -= advance;
}
- (void)printf(")");
}
jp_done:
break;
trunc:
(void)printf("[|pim]");
}
+
+/*
+ * Local Variables:
+ * c-style: whitesmith
+ * c-basic-offset: 8
+ * End:
+ */