#ifndef lint
static const char rcsid[] =
- "@(#) $Header: /tcpdump/master/tcpdump/print-pim.c,v 1.16 2000-01-19 04:57:12 itojun Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-pim.c,v 1.18 2000-02-16 21:49:23 fenner Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
#include <netinet/in.h>
#include <netinet/in_systm.h>
#include <netinet/ip.h>
-/*
-#include <netinet/ip_var.h>
-#include <netinet/udp.h>
-#include <netinet/udp_var.h>
-#include <netinet/tcp.h>
-*/
/*
* XXX: We consider a case where IPv6 is not ready yet for portability,
struct pim {
u_int8_t pim_typever;
- /* upper 4bit: the PIM message type, currently they are:
+ /* upper 4bit: PIM version number; 2 for PIMv2 */
+ /* lower 4bit: the PIM message type, currently they are:
* Hello, Register, Register-Stop, Join/Prune,
* Bootstrap, Assert, Graft (PIM-DM only),
* Graft-Ack (PIM-DM only), C-RP-Adv
*/
- /* lower 4bit: PIM version number; 2 for PIMv2 */
-#define PIM_TYPE(x) (((x) & 0xf0) >> 4)
-#define PIM_VER(x) ((x) & 0x0f)
+#define PIM_VER(x) (((x) & 0xf0) >> 4)
+#define PIM_TYPE(x) ((x) & 0x0f)
u_char pim_rsv; /* Reserved */
u_short pim_cksum; /* IP style check sum */
};
switch(PIM_VER(pim->pim_typever)) {
case 2: /* avoid hardcoding? */
- (void)printf("v2");
+ (void)printf("pim v2");
pimv2_print(bp, len);
break;
default:
- (void)printf("v%d", PIM_VER(pim->pim_typever));
+ (void)printf("pim v%d", PIM_VER(pim->pim_typever));
break;
}
return;
ep = (const u_char *)snapend;
if (bp >= ep)
return;
+ if (ep > bp + len)
+ ep = bp + len;
TCHECK(pim->pim_rsv);
pimv2_addr_len = pim->pim_rsv;
if (pimv2_addr_len != 0)