#ifndef lint
static const char rcsid[] =
- "@(#) $Header: /tcpdump/master/tcpdump/print-igmp.c,v 1.8 2002-08-01 08:53:09 risso Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-igmp.c,v 1.11 2002-12-11 07:14:02 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
* The packet format for a traceroute request.
*/
struct tr_query {
- u_int tr_src; /* traceroute source */
- u_int tr_dst; /* traceroute destination */
- u_int tr_raddr; /* traceroute response address */
- u_int tr_rttlqid; /* response ttl and qid */
+ u_int32_t tr_src; /* traceroute source */
+ u_int32_t tr_dst; /* traceroute destination */
+ u_int32_t tr_raddr; /* traceroute response address */
+ u_int32_t tr_rttlqid; /* response ttl and qid */
};
#define TR_GETTTL(x) (int)(((x) >> 24) & 0xff)
* beginning, followed by one tr_resp for each hop taken.
*/
struct tr_resp {
- u_int tr_qarr; /* query arrival time */
- u_int tr_inaddr; /* incoming interface address */
- u_int tr_outaddr; /* outgoing interface address */
- u_int tr_rmtaddr; /* parent address in source tree */
- u_int tr_vifin; /* input packet count on interface */
- u_int tr_vifout; /* output packet count on interface */
- u_int tr_pktcnt; /* total incoming packets for src-grp */
- u_char tr_rproto; /* routing proto deployed on router */
- u_char tr_fttl; /* ttl required to forward on outvif */
- u_char tr_smask; /* subnet mask for src addr */
- u_char tr_rflags; /* forwarding error codes */
+ u_int32_t tr_qarr; /* query arrival time */
+ u_int32_t tr_inaddr; /* incoming interface address */
+ u_int32_t tr_outaddr; /* outgoing interface address */
+ u_int32_t tr_rmtaddr; /* parent address in source tree */
+ u_int32_t tr_vifin; /* input packet count on interface */
+ u_int32_t tr_vifout; /* output packet count on interface */
+ u_int32_t tr_pktcnt; /* total incoming packets for src-grp */
+ u_int8_t tr_rproto; /* routing proto deployed on router */
+ u_int8_t tr_fttl; /* ttl required to forward on outvif */
+ u_int8_t tr_smask; /* subnet mask for src addr */
+ u_int8_t tr_rflags; /* forwarding error codes */
};
/* defs within mtrace */
{
register const struct tr_query *tr = (const struct tr_query *)(bp + 8);
- printf("mtrace %lu: %s to %s reply-to %s",
- (u_long)TR_GETQID(ntohl(tr->tr_rttlqid)),
+ TCHECK(*tr);
+ if (len < 8 + sizeof (struct tr_query)) {
+ (void)printf(" [invalid len %d]", len);
+ return;
+ }
+ printf("mtrace %u: %s to %s reply-to %s",
+ TR_GETQID(EXTRACT_32BITS(&tr->tr_rttlqid)),
ipaddr_string(&tr->tr_src), ipaddr_string(&tr->tr_dst),
ipaddr_string(&tr->tr_raddr));
- if (IN_CLASSD(ntohl(tr->tr_raddr)))
- printf(" with-ttl %d", TR_GETTTL(ntohl(tr->tr_rttlqid)));
+ if (IN_CLASSD(EXTRACT_32BITS(&tr->tr_raddr)))
+ printf(" with-ttl %d", TR_GETTTL(EXTRACT_32BITS(&tr->tr_rttlqid)));
+ return;
+trunc:
+ (void)printf("[|igmp]");
+ return;
}
static void
{
register const struct tr_query *tr = (const struct tr_query *)(bp + 8);
+ TCHECK(*tr);
+ if (len < 8 + sizeof (struct tr_query)) {
+ (void)printf(" [invalid len %d]", len);
+ return;
+ }
printf("mresp %lu: %s to %s reply-to %s",
- (u_long)TR_GETQID(ntohl(tr->tr_rttlqid)),
+ (u_long)TR_GETQID(EXTRACT_32BITS(&tr->tr_rttlqid)),
ipaddr_string(&tr->tr_src), ipaddr_string(&tr->tr_dst),
ipaddr_string(&tr->tr_raddr));
- if (IN_CLASSD(ntohl(tr->tr_raddr)))
- printf(" with-ttl %d", TR_GETTTL(ntohl(tr->tr_rttlqid)));
+ if (IN_CLASSD(EXTRACT_32BITS(&tr->tr_raddr)))
+ printf(" with-ttl %d", TR_GETTTL(EXTRACT_32BITS(&tr->tr_rttlqid)));
+ return;
+trunc:
+ (void)printf("[|igmp]");
+ return;
}
static void