From Gregory Stark: fix up the check for packets not in a given

connection to check for addresses and ports at the same time, rather
then checking the source addresses, destination addresses, and ports
separately, as the latter doesn't handle A:X->B:Y and B:X->A:Y both
being active connections.

svn path=/trunk/; revision=7966
This commit is contained in:
Guy Harris 2003-07-06 00:30:40 +00:00
parent a99b2c3b2b
commit 511b5486df
3 changed files with 17 additions and 7 deletions

View File

@ -1759,6 +1759,7 @@ And assorted fixes and enhancements by the people listed above and by:
Kaloian Stoilov <kalkata [AT] yahoo.com>
Steven Lass <stevenlass [AT] mail.com>
Nathan Jennings <njen [AT] bellsouth.net>
Gregory Stark <gsstark [AT] mit.edu>
Alain Magloire <alainm[AT]rcsm.ece.mcgill.ca> was kind enough to
give his permission to use his version of snprintf.c.

View File

@ -1843,6 +1843,7 @@ B<http://www.ethereal.com>.
Kaloian Stoilov <kalkata [AT] yahoo.com>
Steven Lass <stevenlass [AT] mail.com>
Nathan Jennings <njen [AT] bellsouth.net>
Gregory Stark <gsstark [AT] mit.edu>
Alain Magloire <alainm[AT]rcsm.ece.mcgill.ca> was kind enough to give his
permission to use his version of snprintf.c.

View File

@ -1,6 +1,6 @@
/* follow.c
*
* $Id: follow.c,v 1.32 2002/12/02 23:43:25 guy Exp $
* $Id: follow.c,v 1.33 2003/07/06 00:30:40 guy Exp $
*
* Copyright 1998 Mike Hall <mlh@io.com>
*
@ -140,12 +140,20 @@ reassemble_tcp( gulong sequence, gulong length, const char* data,
/* Now check if the packet is for this connection. */
memcpy(srcx, net_src->data, len);
memcpy(dstx, net_dst->data, len);
if ((memcmp(srcx, ip_address[0], len) != 0 &&
memcmp(srcx, ip_address[1], len) != 0) ||
(memcmp(dstx, ip_address[0], len) != 0 &&
memcmp(dstx, ip_address[1], len) != 0) ||
(srcport != tcp_port[0] && srcport != tcp_port[1]) ||
(dstport != tcp_port[0] && dstport != tcp_port[1]))
if (
! (
memcmp(srcx, ip_address[0], len) == 0 &&
memcmp(dstx, ip_address[1], len) == 0 &&
srcport == tcp_port[0] &&
dstport == tcp_port[1]
) &&
! (
memcmp(srcx, ip_address[1], len) == 0 &&
memcmp(dstx, ip_address[0], len) == 0 &&
srcport == tcp_port[1] &&
dstport == tcp_port[0]
)
)
return;
/* Initialize our stream chunk. This data gets written to disk. */