mirror of
https://github.com/the-tcpdump-group/tcpdump.git
synced 2024-12-05 07:54:35 +08:00
Keep the remaining payload length in a separate variable from the total
payload length, so we can report the latter at the end of dissection.
This commit is contained in:
parent
01634d3492
commit
914cf46872
30
print-ip6.c
30
print-ip6.c
@ -21,7 +21,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] _U_ =
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-ip6.c,v 1.37 2003-11-19 01:27:55 guy Exp $";
|
||||
"@(#) $Header: /tcpdump/master/tcpdump/print-ip6.c,v 1.38 2003-11-19 06:17:10 guy Exp $";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@ -51,9 +51,10 @@ ip6_print(register const u_char *bp, register u_int length)
|
||||
{
|
||||
register const struct ip6_hdr *ip6;
|
||||
register int advance;
|
||||
register u_int len;
|
||||
u_int len;
|
||||
const u_char *ipend;
|
||||
register const u_char *cp;
|
||||
register u_int payload_len;
|
||||
int nh;
|
||||
int fragmented = 0;
|
||||
u_int flow;
|
||||
@ -79,11 +80,12 @@ ip6_print(register const u_char *bp, register u_int length)
|
||||
snapend = ipend;
|
||||
|
||||
cp = (const u_char *)ip6;
|
||||
payload_len = len;
|
||||
advance = sizeof(struct ip6_hdr);
|
||||
nh = ip6->ip6_nxt;
|
||||
while (cp < snapend && advance > 0) {
|
||||
cp += advance;
|
||||
len -= advance;
|
||||
payload_len -= advance;
|
||||
|
||||
if (cp == (const u_char *)(ip6 + 1) &&
|
||||
nh != IPPROTO_TCP && nh != IPPROTO_UDP &&
|
||||
@ -122,16 +124,19 @@ ip6_print(register const u_char *bp, register u_int length)
|
||||
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:
|
||||
tcp_print(cp, len, (const u_char *)ip6, fragmented);
|
||||
tcp_print(cp, payload_len, (const u_char *)ip6,
|
||||
fragmented);
|
||||
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:
|
||||
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);
|
||||
@ -154,18 +159,18 @@ ip6_print(register const u_char *bp, register u_int length)
|
||||
}
|
||||
|
||||
case IPPROTO_PIM:
|
||||
pim_print(cp, len);
|
||||
pim_print(cp, payload_len);
|
||||
goto end;
|
||||
case IPPROTO_OSPF:
|
||||
ospf6_print(cp, len);
|
||||
ospf6_print(cp, payload_len);
|
||||
goto end;
|
||||
|
||||
case IPPROTO_IPV6:
|
||||
ip6_print(cp, len);
|
||||
ip6_print(cp, payload_len);
|
||||
goto end;
|
||||
|
||||
case IPPROTO_IPV4:
|
||||
ip_print(cp, len);
|
||||
ip_print(cp, payload_len);
|
||||
goto end;
|
||||
|
||||
case IPPROTO_NONE:
|
||||
@ -173,7 +178,8 @@ ip6_print(register const u_char *bp, register u_int length)
|
||||
goto end;
|
||||
|
||||
default:
|
||||
(void)printf("ip-proto-%d %d", ip6->ip6_nxt, len);
|
||||
(void)printf("ip-proto-%d %d", ip6->ip6_nxt,
|
||||
payload_len);
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user