just reflects the payload length, the snapshot length has been trimmed
to correspond to it, so it doesn't need to check it merely to avoid
running past the end of the IPv6 payload); get rid of it.
Pass "icmp6_print()" the IPv6 payload length (i.e., the length of the
ICMPv6 packet), rather than having it compre the length itself.
Make the length argument to "icmp6_cksum()" unsigned, to match the value
passed to it.
Fix the lengths passed to "sctp_print()", "tcp_print()", and
"udp_print()" (we update "len" in the header-processing loop to
correspond to the remaining payload, so we just pass it to those
routines).
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
- * @(#) $Header: /tcpdump/master/tcpdump/interface.h,v 1.217.2.2 2003-11-18 23:26:14 guy Exp $ (LBL)
+ * @(#) $Header: /tcpdump/master/tcpdump/interface.h,v 1.217.2.3 2003-11-19 01:28:18 guy Exp $ (LBL)
*/
#ifndef tcpdump_interface_h
*/
#ifndef tcpdump_interface_h
extern int dstopt_print(const u_char *);
extern int frag6_print(const u_char *, const u_char *);
extern int mobility_print(const u_char *, const u_char *);
extern int dstopt_print(const u_char *);
extern int frag6_print(const u_char *, const u_char *);
extern int mobility_print(const u_char *, const u_char *);
-extern void icmp6_print(const u_char *, const u_char *, int);
+extern void icmp6_print(const u_char *, u_int, const u_char *, int);
extern void ripng_print(const u_char *, unsigned int);
extern int rt6_print(const u_char *, const u_char *);
extern void ospf6_print(const u_char *, u_int);
extern void ripng_print(const u_char *, unsigned int);
extern int rt6_print(const u_char *, const u_char *);
extern void ospf6_print(const u_char *, u_int);
#ifndef lint
static const char rcsid[] _U_ =
#ifndef lint
static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/tcpdump/print-icmp6.c,v 1.72.2.2 2003-11-16 08:51:25 guy Exp $";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-icmp6.c,v 1.72.2.3 2003-11-19 01:28:19 guy Exp $";
#endif
#ifdef HAVE_CONFIG_H
#endif
#ifdef HAVE_CONFIG_H
static struct udphdr *get_upperlayer(u_char *, u_int *);
static void dnsname_print(const u_char *, const u_char *);
static void icmp6_nodeinfo_print(u_int, const u_char *, const u_char *);
static struct udphdr *get_upperlayer(u_char *, u_int *);
static void dnsname_print(const u_char *, const u_char *);
static void icmp6_nodeinfo_print(u_int, const u_char *, const u_char *);
-static void icmp6_rrenum_print(u_int, const u_char *, const u_char *);
+static void icmp6_rrenum_print(const u_char *, const u_char *);
#ifndef abs
#define abs(a) ((0 < (a)) ? (a) : -(a))
#ifndef abs
#define abs(a) ((0 < (a)) ? (a) : -(a))
}
static int icmp6_cksum(const struct ip6_hdr *ip6, const struct icmp6_hdr *icp,
}
static int icmp6_cksum(const struct ip6_hdr *ip6, const struct icmp6_hdr *icp,
{
size_t i;
register const u_int16_t *sp;
{
size_t i;
register const u_int16_t *sp;
-icmp6_print(const u_char *bp, const u_char *bp2, int fragmented)
+icmp6_print(const u_char *bp, u_int length, const u_char *bp2, int fragmented)
{
const struct icmp6_hdr *dp;
const struct ip6_hdr *ip;
{
const struct icmp6_hdr *dp;
const struct ip6_hdr *ip;
int dport;
const u_char *ep;
char buf[256];
int dport;
const u_char *ep;
char buf[256];
dp = (struct icmp6_hdr *)bp;
ip = (struct ip6_hdr *)bp2;
dp = (struct icmp6_hdr *)bp;
ip = (struct ip6_hdr *)bp2;
str = buf;
/* 'ep' points to the end of available data. */
ep = snapend;
str = buf;
/* 'ep' points to the end of available data. */
ep = snapend;
- if (ip->ip6_plen)
- icmp6len = (EXTRACT_16BITS(&ip->ip6_plen) + sizeof(struct ip6_hdr) -
- (bp - bp2));
- else /* XXX: jumbo payload case... */
- icmp6len = snapend - bp;
TCHECK(dp->icmp6_cksum);
if (vflag && !fragmented) {
int sum = dp->icmp6_cksum;
TCHECK(dp->icmp6_cksum);
if (vflag && !fragmented) {
int sum = dp->icmp6_cksum;
- if (TTEST2(bp[0], icmp6len)) {
- sum = icmp6_cksum(ip, dp, icmp6len);
+ if (TTEST2(bp[0], length)) {
+ sum = icmp6_cksum(ip, dp, length);
if (sum != 0)
(void)printf("[bad icmp6 cksum %x!] ", sum);
else
if (sum != 0)
(void)printf("[bad icmp6 cksum %x!] ", sum);
else
if (vflag) {
#define RTSOLLEN 8
icmp6_opt_print((const u_char *)dp + RTSOLLEN,
if (vflag) {
#define RTSOLLEN 8
icmp6_opt_print((const u_char *)dp + RTSOLLEN,
}
break;
case ND_ROUTER_ADVERT:
}
break;
case ND_ROUTER_ADVERT:
EXTRACT_32BITS(&p->nd_ra_retransmit));
#define RTADVLEN 16
icmp6_opt_print((const u_char *)dp + RTADVLEN,
EXTRACT_32BITS(&p->nd_ra_retransmit));
#define RTADVLEN 16
icmp6_opt_print((const u_char *)dp + RTADVLEN,
}
break;
case ND_NEIGHBOR_SOLICIT:
}
break;
case ND_NEIGHBOR_SOLICIT:
if (vflag) {
#define NDSOLLEN 24
icmp6_opt_print((const u_char *)dp + NDSOLLEN,
if (vflag) {
#define NDSOLLEN 24
icmp6_opt_print((const u_char *)dp + NDSOLLEN,
}
#define NDADVLEN 24
icmp6_opt_print((const u_char *)dp + NDADVLEN,
}
#define NDADVLEN 24
icmp6_opt_print((const u_char *)dp + NDADVLEN,
#define REDIRECTLEN 40
if (vflag) {
icmp6_opt_print((const u_char *)dp + REDIRECTLEN,
#define REDIRECTLEN 40
if (vflag) {
icmp6_opt_print((const u_char *)dp + REDIRECTLEN,
- icmp6len - REDIRECTLEN);
}
break;
#undef REDIRECTLEN
#undef RDR
case ICMP6_ROUTER_RENUMBERING:
}
break;
#undef REDIRECTLEN
#undef RDR
case ICMP6_ROUTER_RENUMBERING:
- icmp6_rrenum_print(icmp6len, bp, ep);
+ icmp6_rrenum_print(bp, ep);
break;
case ICMP6_NI_QUERY:
case ICMP6_NI_REPLY:
break;
case ICMP6_NI_QUERY:
case ICMP6_NI_REPLY:
- icmp6_nodeinfo_print(icmp6len, bp, ep);
+ icmp6_nodeinfo_print(length, bp, ep);
break;
case ICMP6_HADISCOV_REQUEST:
printf("icmp6: ha discovery request");
break;
case ICMP6_HADISCOV_REQUEST:
printf("icmp6: ha discovery request");
TCHECK(dp->icmp6_data16[0]);
printf("(id=%d", EXTRACT_16BITS(&dp->icmp6_data16[0]));
TCHECK(dp->icmp6_data16[0]);
printf("(id=%d", EXTRACT_16BITS(&dp->icmp6_data16[0]));
- cp = (u_char *)dp + icmp6len;
+ cp = (u_char *)dp + length;
in6 = (struct in6_addr *)(dp + 1);
for (; (u_char *)in6 < cp; in6++) {
TCHECK(*in6);
in6 = (struct in6_addr *)(dp + 1);
for (; (u_char *)in6 < cp; in6++) {
TCHECK(*in6);
printf(")");
#define MPADVLEN 8
icmp6_opt_print((const u_char *)dp + MPADVLEN,
printf(")");
#define MPADVLEN 8
icmp6_opt_print((const u_char *)dp + MPADVLEN,
-icmp6_rrenum_print(u_int icmp6len, const u_char *bp, const u_char *ep)
+icmp6_rrenum_print(const u_char *bp, const u_char *ep)
{
struct icmp6_router_renum *rr6;
struct icmp6_hdr *dp;
{
struct icmp6_router_renum *rr6;
struct icmp6_hdr *dp;
#ifndef lint
static const char rcsid[] _U_ =
#ifndef lint
static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/tcpdump/print-ip6.c,v 1.32.2.4 2003-11-19 00:35:44 guy Exp $";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-ip6.c,v 1.32.2.5 2003-11-19 01:28:19 guy Exp $";
#endif
#ifdef HAVE_CONFIG_H
#endif
#ifdef HAVE_CONFIG_H
nh = *cp;
break;
case IPPROTO_SCTP:
nh = *cp;
break;
case IPPROTO_SCTP:
- sctp_print(cp, (const u_char *)ip6,
- len + sizeof(struct ip6_hdr) - (cp - bp));
+ sctp_print(cp, (const u_char *)ip6, len);
goto end;
case IPPROTO_TCP:
goto end;
case IPPROTO_TCP:
- tcp_print(cp, len + sizeof(struct ip6_hdr) - (cp - bp),
- (const u_char *)ip6, fragmented);
+ tcp_print(cp, len, (const u_char *)ip6, fragmented);
goto end;
case IPPROTO_UDP:
goto end;
case IPPROTO_UDP:
- udp_print(cp, len + sizeof(struct ip6_hdr) - (cp - bp),
- (const u_char *)ip6, fragmented);
+ udp_print(cp, len, (const u_char *)ip6, fragmented);
goto end;
case IPPROTO_ICMPV6:
goto end;
case IPPROTO_ICMPV6:
- icmp6_print(cp, (const u_char *)ip6, fragmented);
+ icmp6_print(cp, len, (const u_char *)ip6, fragmented);
goto end;
case IPPROTO_AH:
advance = ah_print(cp);
goto end;
case IPPROTO_AH:
advance = ah_print(cp);