diff options
author | Guy Harris <guy@alum.mit.edu> | 2003-07-06 00:30:40 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2003-07-06 00:30:40 +0000 |
commit | 511b5486df613ee69bd72045f40be7213bfbc9e5 (patch) | |
tree | 01ca8f34101cb27810050ef9351187f1a1b99f8d /follow.c | |
parent | a99b2c3b2bee628695df4c1133f95decf5d49590 (diff) |
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
Diffstat (limited to 'follow.c')
-rw-r--r-- | follow.c | 22 |
1 files changed, 15 insertions, 7 deletions
@@ -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. */ |