commit ca90da66ac237005af6fbdbdc16837ba41f19beb
parent 2d08506180b91487e213d2ac90b2bed282454a21
Author: Jordan Ritter <jpr5@darkridge.com>
Date: Tue, 19 Jun 2007 10:12:08 +0000
Fix for bug #1738953: why would I subtract the payload's length from a
variable that is supposed to describe exactly that?? Removed ip6_plen
from TCP, UDP and ICMPv6 calculations.
Diffstat:
1 file changed, 1 insertion(+), 11 deletions(-)
diff --git a/ngrep.c b/ngrep.c
@@ -721,11 +721,6 @@ void process(u_char *d, struct pcap_pkthdr *h, u_char *p) {
data = (unsigned char *)(tcp_pkt) + tcphdr_offset;
len -= link_offset + ip_hl + tcphdr_offset;
-#if USE_IPv6
- if (ip_ver == 6)
- len -= ntohs(ip6_pkt->ip6_plen);
-#endif
-
if ((int32_t)len < 0)
len = 0;
@@ -741,11 +736,6 @@ void process(u_char *d, struct pcap_pkthdr *h, u_char *p) {
data = (unsigned char *)(udp_pkt) + udphdr_offset;
len -= link_offset + ip_hl + udphdr_offset;
-#if USE_IPv6
- if (ip_ver == 6)
- len -= ntohs(ip6_pkt->ip6_plen);
-#endif
-
if ((int32_t)len < 0)
len = 0;
@@ -779,7 +769,7 @@ void process(u_char *d, struct pcap_pkthdr *h, u_char *p) {
uint16_t icmp6hdr_offset = (frag_offset) ? 0 : 4;
data = (unsigned char *)(icmp6_pkt) + icmp6hdr_offset;
- len -= link_offset + ip_hl + ntohs(ip6_pkt->ip6_plen) + icmp6hdr_offset;
+ len -= link_offset + ip_hl + icmp6hdr_offset;
if ((int32_t)len < 0)
len = 0;