payload length, so we can report the latter at the end of dissection.
#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.5 2003-11-19 01:28:19 guy Exp $";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-ip6.c,v 1.32.2.6 2003-11-19 06:17:36 guy Exp $";
#endif
#ifdef HAVE_CONFIG_H
#endif
#ifdef HAVE_CONFIG_H
{
register const struct ip6_hdr *ip6;
register int advance;
{
register const struct ip6_hdr *ip6;
register int advance;
const u_char *ipend;
register const u_char *cp;
const u_char *ipend;
register const u_char *cp;
+ register u_int payload_len;
int nh;
int fragmented = 0;
u_int flow;
int nh;
int fragmented = 0;
u_int flow;
snapend = ipend;
cp = (const u_char *)ip6;
snapend = ipend;
cp = (const u_char *)ip6;
advance = sizeof(struct ip6_hdr);
nh = ip6->ip6_nxt;
while (cp < snapend && advance > 0) {
cp += advance;
advance = sizeof(struct ip6_hdr);
nh = ip6->ip6_nxt;
while (cp < snapend && advance > 0) {
cp += advance;
+ payload_len -= advance;
if (cp == (const u_char *)(ip6 + 1) &&
nh != IPPROTO_TCP && nh != IPPROTO_UDP &&
if (cp == (const u_char *)(ip6 + 1) &&
nh != IPPROTO_TCP && nh != IPPROTO_UDP &&
nh = *cp;
break;
case IPPROTO_SCTP:
nh = *cp;
break;
case IPPROTO_SCTP:
- sctp_print(cp, (const u_char *)ip6, len);
+ sctp_print(cp, (const u_char *)ip6, payload_len);
goto end;
case IPPROTO_TCP:
goto end;
case IPPROTO_TCP:
- tcp_print(cp, len, (const u_char *)ip6, fragmented);
+ tcp_print(cp, payload_len, (const u_char *)ip6,
+ fragmented);
goto end;
case IPPROTO_UDP:
goto end;
case IPPROTO_UDP:
- udp_print(cp, len, (const u_char *)ip6, fragmented);
+ udp_print(cp, payload_len, (const u_char *)ip6,
+ fragmented);
goto end;
case IPPROTO_ICMPV6:
goto end;
case IPPROTO_ICMPV6:
- icmp6_print(cp, len, (const u_char *)ip6, fragmented);
+ icmp6_print(cp, payload_len, (const u_char *)ip6,
+ fragmented);
goto end;
case IPPROTO_AH:
advance = ah_print(cp);
goto end;
case IPPROTO_AH:
advance = ah_print(cp);
+ pim_print(cp, payload_len);
goto end;
case IPPROTO_OSPF:
goto end;
case IPPROTO_OSPF:
+ ospf6_print(cp, payload_len);
goto end;
case IPPROTO_IPV6:
goto end;
case IPPROTO_IPV6:
+ ip6_print(cp, payload_len);
goto end;
case IPPROTO_IPV4:
goto end;
case IPPROTO_IPV4:
+ ip_print(cp, payload_len);
goto end;
case IPPROTO_NONE:
goto end;
case IPPROTO_NONE:
- (void)printf("ip-proto-%d %d", ip6->ip6_nxt, len);
+ (void)printf("ip-proto-%d %d", ip6->ip6_nxt,
+ payload_len);