X-Git-Url: https://git.tcpdump.org/tcpdump/blobdiff_plain/6389dc2f6f2916a880935d3eb3ccbaa6a2e71673..464c44fbd1394ac006d8d99f16e80ead423c1c47:/print-igmp.c diff --git a/print-igmp.c b/print-igmp.c index 59560df5..1e10d0b7 100644 --- a/print-igmp.c +++ b/print-igmp.c @@ -21,7 +21,7 @@ #ifndef lint static const char rcsid[] = - "@(#) $Header: /tcpdump/master/tcpdump/print-igmp.c,v 1.2 2000-11-02 18:02:52 fenner Exp $ (LBL)"; + "@(#) $Header: /tcpdump/master/tcpdump/print-igmp.c,v 1.7 2002-06-11 17:08:49 itojun Exp $ (LBL)"; #endif #ifdef HAVE_CONFIG_H @@ -32,8 +32,6 @@ static const char rcsid[] = #include #include -#include -#include #include #include @@ -111,10 +109,10 @@ static struct tok igmpv3report2str[] = { { 0, NULL } }; -static void +static void print_mtrace(register const u_char *bp, register u_int len) { - register struct tr_query *tr = (struct tr_query *)(bp + 8); + 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)), @@ -124,10 +122,10 @@ print_mtrace(register const u_char *bp, register u_int len) printf(" with-ttl %d", TR_GETTTL(ntohl(tr->tr_rttlqid))); } -static void +static void print_mresp(register const u_char *bp, register u_int len) { - register struct tr_query *tr = (struct tr_query *)(bp + 8); + register const struct tr_query *tr = (const struct tr_query *)(bp + 8); printf("mresp %lu: %s to %s reply-to %s", (u_long)TR_GETQID(ntohl(tr->tr_rttlqid)), @@ -137,24 +135,23 @@ print_mresp(register const u_char *bp, register u_int len) printf(" with-ttl %d", TR_GETTTL(ntohl(tr->tr_rttlqid))); } -static void -print_igmpv3_report(register const u_char *bp, register u_int len, - register const u_char *bp2) +static void +print_igmpv3_report(register const u_char *bp, register u_int len) { - int group, nsrcs, ngroups; - register int i, j; + u_int group, nsrcs, ngroups; + register u_int i, j; /* Minimum len is 16, and should be a multiple of 4 */ if (len < 16 || len & 0x03) { - (void)printf(" [invalid len %d]", len); - return; + (void)printf(" [invalid len %d]", len); + return; } TCHECK2(bp[6], 2); ngroups = EXTRACT_16BITS(&bp[6]); - (void)printf(", %d group record(s)", ngroups); + (void)printf(", %d group record(s)", ngroups); if (vflag > 0) { /* Print the group records */ - group = 8; + group = 8; for (i=0; i> 4) + 3); + } + if (mrc != 100) { + (void)printf(" [max resp time "); + relts_print(mrt); + (void)printf("]"); } TCHECK2(bp[4], 4); if (EXTRACT_32BITS(&bp[4]) == 0) @@ -232,16 +241,8 @@ trunc: } void -igmp_print(register const u_char *bp, register u_int len, - register const u_char *bp2) +igmp_print(register const u_char *bp, register u_int len) { - register const struct ip *ip; - - ip = (const struct ip *)bp2; - (void)printf("%s > %s: ", - ipaddr_string(&ip->ip_src), - ipaddr_string(&ip->ip_dst)); - if (qflag) { (void)printf("igmp"); return; @@ -252,7 +253,7 @@ igmp_print(register const u_char *bp, register u_int len, case 0x11: (void)printf("igmp query"); if (len >= 12) - print_igmpv3_query(bp, len, bp2); + print_igmpv3_query(bp, len); else { if (bp[1]) { (void)printf(" v2"); @@ -260,7 +261,7 @@ igmp_print(register const u_char *bp, register u_int len, (void)printf(" [max resp time %d]", bp[1]); } else (void)printf(" v1"); - if (EXTRACT_32BITS(&bp[4])) + if (EXTRACT_32BITS(&bp[4])) (void)printf(" [gaddr %s]", ipaddr_string(&bp[4])); if (len != 8) (void)printf(" [len %d]", len); @@ -276,7 +277,7 @@ igmp_print(register const u_char *bp, register u_int len, break; case 0x22: (void)printf("igmp v3 report"); - print_igmpv3_report(bp, len, bp2); + print_igmpv3_report(bp, len); break; case 0x17: (void)printf("igmp leave %s", ipaddr_string(&bp[4]));