Package: ngrep
Version: 1.45.ds2-9
Severity: important
Tags: patch ipv6

It is known from LP #567286 in [1], since April, 2010, that ngrep
is incorrectly handling IPv6 packet lengths. A patch written by
Simon Engelsman was included as an attachment [2].

This correction should really have gone into the package well before
the development freeze of Squeeze. Now the time is ripe again.

I include here a trivial variation of the original patch.
The code alterations have been tried and tested with ICPMv6,
as well as TCP and UDP transported by IPv6.

Best regards,
  Mats Erik Andersson, DM


[1] https://bugs.launchpad.net/ubuntu/+source/ngrep/+bug/567286
[2] http://launchpadlibrarian.net/44952147/ngrep-fix-ipv6-support.patch


-------------------------------------------------------------------
--- ngrep-1.45.ds2.debian/ngrep.c       2011-02-24 23:53:37.000000000 +0100
+++ ngrep-1.45.ds2/ngrep.c      2011-02-26 01:01:41.000000000 +0100
@@ -711,11 +711,6 @@
             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;
 
@@ -731,11 +726,6 @@
             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;
 
@@ -769,7 +759,7 @@
             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;



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to