Merge pull request #12 from alperakcan/master

Fix packet length calculation if IP length is 0, due to TSO
This commit is contained in:
Alexandre Dulaunoy 2017-05-29 14:57:49 +02:00 committed by GitHub
commit f96ec877dd
3 changed files with 11 additions and 2 deletions

View file

@ -15,6 +15,7 @@ Richard Levitte
Hugh Mandeville Hugh Mandeville
Eric Murray Eric Murray
Henrik Nordstrom Henrik Nordstrom
Alper Akcan
If you think you should be on this list, send me mail at <ekr@rtfm.com>. If you think you should be on this list, send me mail at <ekr@rtfm.com>.

View file

@ -1,3 +1,7 @@
Mon 29 May 2017 03:49:00 PM +03 Alper <alper.akcan@gmail.com>
* Fix packet length calculation if IP length is
0 due to TSO.
Wed Aug 21 10:48:45 2002 EKR <ekr@rtfm.com> Wed Aug 21 10:48:45 2002 EKR <ekr@rtfm.com>
* Installed Greg Stark's new Win32 patches. * Installed Greg Stark's new Win32 patches.

View file

@ -133,8 +133,12 @@ int network_process_packet(handler,timestamp,data,length)
hlen=p.ip->ip_hl * 4; hlen=p.ip->ip_hl * 4;
p.data += hlen; p.data += hlen;
p.len =ntohs(p.ip->ip_len)-hlen; p.len = ntohs(p.ip->ip_len);
if (p.len == 0) {
DBG((0,"ip length reported as 0, presumed to be because of 'TCP segmentation offload' (TSO)\n"));
p.len = p._len;
}
p.len -= hlen;
switch(p.ip->ip_p){ switch(p.ip->ip_p){
case IPPROTO_TCP: case IPPROTO_TCP: