TCP Reassembler hotfix for conns > 2GB.

The TCP Reassembler does not deliver any data to analyzers after the
first 2GB due to signed integer overflow (Actually it will deliver again
between 4--6GB, etc.) This happens silently, i.e., without content_gap
events or Undelivered calls.

See Comments in TCP_Reassembler.cc for more details.

As a hotfix that seems to work I disabled the seq_to_skip features. It
wasn't used by any analyzer or policy script (Note, that seq_to_skip is
different from skip_deliveries).

See also ticket #348
This commit is contained in:
Gregor Maier 2011-01-12 09:38:13 -08:00
parent d24f7a6aad
commit a5632aff4e
4 changed files with 74 additions and 16 deletions

View file

@ -6,6 +6,13 @@
#include "Reassem.h"
#include "TCP_Endpoint.h"
// The skip_to_seq feature does not work correctly with
// connections >2GB due to use of 32 bit signed ints (see
// comments in TCP_Reassembler.cc)
// Since it's not used by any analyzer or policy script we disable
// it. Could be added back in once we start using 64bit integers.
// #define XXX_USE_SEQ_TO_SKIP
class BroFile;
class Connection;
class TCP_Analyzer;
@ -60,9 +67,11 @@ public:
void MatchUndelivered(int up_to_seq = -1);
#ifdef XXX_USE_SEQ_TO_SKIP
// Skip up to seq, as if there's a content gap.
// Can be used to skip HTTP data for performance considerations.
void SkipToSeq(int seq);
#endif
int DataSent(double t, int seq, int len, const u_char* data,
bool replaying=true);
@ -85,9 +94,10 @@ public:
const TCP_Endpoint* Endpoint() const { return endp; }
int IsOrig() const { return endp->IsOrig(); }
#ifdef XXX_USE_SEQ_TO_SKIP
bool IsSkippedContents(int seq, int length) const
{ return seq + length <= seq_to_skip; }
#endif
private:
TCP_Reassembler() { }
@ -110,7 +120,9 @@ private:
unsigned int did_EOF:1;
unsigned int skip_deliveries:1;
#ifdef XXX_USE_SEQ_TO_SKIP
int seq_to_skip;
#endif
bool in_delivery;
BroFile* record_contents_file; // file on which to reassemble contents