* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
- * @(#) $Header: /tcpdump/master/tcpdump/interface.h,v 1.219 2003-11-18 23:26:37 guy Exp $ (LBL)
+ * @(#) $Header: /tcpdump/master/tcpdump/interface.h,v 1.220 2003-11-19 01:27:54 guy Exp $ (LBL)
*/
#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 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);
#ifndef lint
static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/tcpdump/print-icmp6.c,v 1.74 2003-11-16 09:36:22 guy Exp $";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-icmp6.c,v 1.75 2003-11-19 01:27:55 guy Exp $";
#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 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))
}
static int icmp6_cksum(const struct ip6_hdr *ip6, const struct icmp6_hdr *icp,
- int len)
+ u_int len)
{
size_t i;
register const u_int16_t *sp;
}
void
-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;
int dport;
const u_char *ep;
char buf[256];
- u_int icmp6len, prot;
+ u_int prot;
dp = (struct icmp6_hdr *)bp;
ip = (struct ip6_hdr *)bp2;
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;
- 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 (vflag) {
#define RTSOLLEN 8
icmp6_opt_print((const u_char *)dp + RTSOLLEN,
- icmp6len - RTSOLLEN);
+ length - RTSOLLEN);
}
break;
case ND_ROUTER_ADVERT:
EXTRACT_32BITS(&p->nd_ra_retransmit));
#define RTADVLEN 16
icmp6_opt_print((const u_char *)dp + RTADVLEN,
- icmp6len - RTADVLEN);
+ length - RTADVLEN);
}
break;
case ND_NEIGHBOR_SOLICIT:
if (vflag) {
#define NDSOLLEN 24
icmp6_opt_print((const u_char *)dp + NDSOLLEN,
- icmp6len - NDSOLLEN);
+ length - NDSOLLEN);
}
}
break;
}
#define NDADVLEN 24
icmp6_opt_print((const u_char *)dp + NDADVLEN,
- icmp6len - NDADVLEN);
+ length - NDADVLEN);
#undef NDADVLEN
}
}
#define REDIRECTLEN 40
if (vflag) {
icmp6_opt_print((const u_char *)dp + REDIRECTLEN,
- icmp6len - REDIRECTLEN);
+ length - REDIRECTLEN);
}
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:
- icmp6_nodeinfo_print(icmp6len, bp, ep);
+ icmp6_nodeinfo_print(length, bp, ep);
break;
case ICMP6_HADISCOV_REQUEST:
printf("icmp6: ha discovery request");
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);
printf(")");
#define MPADVLEN 8
icmp6_opt_print((const u_char *)dp + MPADVLEN,
- icmp6len - MPADVLEN);
+ length - MPADVLEN);
}
break;
default:
}
static void
-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;
#ifndef lint
static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/tcpdump/print-ip6.c,v 1.36 2003-11-19 00:36:07 guy Exp $";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-ip6.c,v 1.37 2003-11-19 01:27:55 guy Exp $";
#endif
#ifdef HAVE_CONFIG_H
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:
- 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:
- 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:
- 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);