Commit graph

436 commits

Author SHA1 Message Date
Bernhard Amann
80c319b522 adjust timings of a few leak tests.
Without the longer timeouts, these consistently fail for me
on caddy when doing "make test".
2014-02-26 14:47:40 -08:00
Jon Siwek
2636d3aee7 Add memory leak unit test for SNMP. 2014-02-18 15:58:53 -06:00
Robin Sommer
ba81aa4387 Support for MPLS over VLAN.
Patch by Chris Kanich.

BIT-1017 #merged
2014-02-14 12:07:24 -08:00
Robin Sommer
a57f0ef9a0 Merge remote-tracking branch 'origin/fastpath'
* origin/fastpath:
  Increase timeouts of some unit tests.
  Fix memory leak in modbus analyzer.
  add channel_id tls extension number.
2014-02-13 12:45:02 -08:00
Jon Siwek
e844727e73 Increase timeouts of some unit tests. 2014-02-12 17:03:51 -06:00
Robin Sommer
d81bfed45d Fixing memory leaks in input framework. 2014-02-06 17:58:56 -08:00
Robin Sommer
4621745906 Merge remote-tracking branch 'origin/fastpath'
* origin/fastpath:
  Also use exec-module test to check for leaks.
2014-01-30 16:02:22 -08:00
Bernhard Amann
62b3cb0a5b Also use exec-module test to check for leaks. 2014-01-28 12:28:12 -08:00
Robin Sommer
3f47c5bc87 Merge remote-tracking branch 'origin/master' into topic/robin/dynamic-plugins-2.3 2014-01-24 20:26:00 -08:00
Jon Siwek
9b12967d40 Improve gap reporting in TCP connections that never see data.
The previous behavior was to accomodate SYN/FIN/RST-filtered traces by
not reporting missing data (via the content_gap event) for such
connections.  The new behavior always reports gaps for connections that
are established and terminate normally, but sequence numbers indicate
that all data packets of the connection were missed.  The behavior can
be reverted by redef'ing "detect_filtered_trace".
2014-01-24 16:21:02 -06:00
Jon Siwek
5b3573394e Improve TCP FIN retransmission handling.
In the case multiple FIN packets are seen from a TCP endpoint (e.g.
when one is retransmitted), only the first counted towards a byte in the
sequence space.  This could cause a subsequent FIN packet to induce an
incorrect wrap around in the sequence numbers (e.g.  the retransmitted
FIN packet now is one sequence number behind the the first) and
misleadingly large connection sizes.  The change is to always treat a
FIN packet as counting one byte in to the sequence space.
2014-01-24 15:51:58 -06:00
Robin Sommer
fdd386a898 A test with a plugin exercising all hooks. 2014-01-22 14:35:31 -08:00
Robin Sommer
ea01a1be30 Reworking plugin interface to not rely on macros.
The Plugin.cc file is now just a standard class, with the interface
changed a bit to make it more easy to write. However, there're still
some conventions that one must follow to make everything work (like
using the right namespace structure).

This commit also includes the option to compile built-in plugins
dynamically instead of statically by adding
SET(BRO_PLUGIN_BUILD_DYNAMIC TRUE) to their CMake config. This hasn't
been tested much yet, and I'm still undecided if it's somethign we
would want to do by default--but we could now if wanted. :)

Also some minor other cleanup of plugin APIs and built infrastructure.

All tested on MacOS only currently.
2014-01-20 13:39:11 -08:00
Jon Siwek
7717a3eb67 BIT-867 - Support GRE tunnel decapsulation.
This includes enhanced GRE headers.  GRE tunnels are treated just like
IP-in-IP tunnels by parsing past the GRE header in between the delivery
and payload IP packets.
2014-01-16 16:03:04 -06:00
Robin Sommer
b91b62b2b1 Test updates. 2013-12-16 11:57:57 -08:00
Robin Sommer
a80dd10215 Updates of the dynamic plugin code.
Includes:

    - Cleanup of the plugin API, in particular generally changing
      const char* to std::string

    - Renaming environment variable BRO_PLUGINS to BRO_PLUGIN_PATH,
      defaulting to <prefix>/lib/bro/plugins

    - Reworking how dynamic plugins are searched and activated. See
      doc/devel/plugins.rst for details.

    - New @load-plugin directive to explicitly activate a plugin

    - Support for Darwin. (Linux untested right now)

    - The init-plugin updates come with support for "make test", "make
      sdist", and "make bdist" (see how-to).

    - Test updates.

Notes: The new hook mechanism, which allows plugins to hook into Bro's
core a well-defined points, is still essentially untested.
2013-12-16 11:57:56 -08:00
Jon Siwek
63c36d58f3 Another attempt to improve core.when-interpreter-exceptions unit test.
lookup_hostname("localhost") occassionally timed out (after allowed 10
secs) when running test suite on some systems.  Not sure why, but
changed to use the Exec module for when block conditions instead as the
scope of the test doesn't depend on a particular type of condition, it
just needs something that will work reliably/quickly.
2013-12-11 14:28:23 -06:00
Bernhard Amann
504d22b91b fix memory leak in input framework.
If the input framework was used to read event streams and
those streams contained records with more than one field, not all
elements of the threading Values were cleaned up.

The reason for this is, that the SendEventStreamEvent function
returned the number of record elements in the outmost record
instead of the number of unrolled elements in the whole vector.

This number is later used to determine how many objects to delete.

Also - add a whole bunch of leak checks for the input framework
that would have caught that and should cover quite a number of
use-cases.
2013-12-05 10:53:12 -08:00
Jon Siwek
2ea6011186 Improve a unit test involving 'when' conditionals.
May fix a sporadic failure, in which case it was just not getting enough
time to run or lookup_hostname() taking longer than ~3 seconds.  Else,
the new output should give more hints on what's going wrong.  In any
case, termination conditions for the test are now explicit.
2013-12-03 16:51:36 -06:00
Robin Sommer
555df1e7ea Checkpointing the dynamic plugin code.
This is essentially the code from the dynamic-plugin branch except for
some pieces that I have split out into separate, earlier commits.

I'm going to updatre things in this branch going forward.
2013-11-26 14:04:29 -08:00
Jon Siwek
1750e351c4 Prevent division/modulo by zero in scripts.
Integral/floating-point division/modulo by zero in C++ is undefined
behavior, so to prevent such cases in a script from crashing Bro,
they're now reported as an error (with script location information) and
the event handler in which it occurred returns immediately.
2013-09-20 16:36:00 -05:00
Jon Siwek
7799a86a7f Adjust HLL cluster leak test so leaks trigger a failure. 2013-09-04 16:53:58 -05:00
Jon Siwek
3939b629ae Adjust DNS memory leak test to actually fail if there's a leak. 2013-09-04 16:49:04 -05:00
Jon Siwek
62de5678f7 Fix memory leak in DNS TXT lookups. 2013-09-04 16:47:44 -05:00
Robin Sommer
295987c8d0 Making the confidence configurable. 2013-08-31 10:34:50 -07:00
Robin Sommer
4dcf8fc0db Merge remote-tracking branch 'origin/topic/bernhard/hyperloglog'
* origin/topic/bernhard/hyperloglog: (32 commits)
  add clustered leak test for hll. No issues.
  make gcc happy
  (hopefully) fix refcounting problem in hll/bloom-filter opaque vals. Thanks Robin.
  re-use same hash class for all add operations
  get hll ready for merging
  and forgot a file...
  adapt to new structure
  fix opaqueval-related memleak.
  make it compile on case-sensitive file systems and fix warnings
  make error rate configureable
  add persistence test not using predetermined random seeds.
  update cluster test to also use hll
  persistence really works.
  well, with this commit synchronizing the data structure should work.. ...if we had consistent hashing.
  and also serialize the other things we need
  ok, this bug was hard to find.
  serialization compiles.
  change plugin after feedback of seth
  Forgot a file. Again. Like always. Basically.
  do away with old file.
  ...
2013-08-30 11:30:05 -07:00
Bernhard Amann
2dd0d057e6 Merge remote-tracking branch 'origin/master' into topic/bernhard/hyperloglog
Conflicts:
	src/NetVar.cc
	src/NetVar.h
2013-08-30 08:43:47 -07:00
Jon Siwek
dc2e3d6e04 Fix global opaque val segfault, addresses BIT-1071
The opaque types need to be created before scripts are parsed.
2013-08-29 17:17:40 -05:00
Bernhard Amann
4cd20c6375 add clustered leak test for hll. No issues. 2013-08-29 14:01:22 -07:00
Jon Siwek
fb8b78840b Fix bloom filter memory leaks. 2013-08-29 11:24:24 -05:00
Jon Siwek
7a2972d0e4 Add bits_per_uid unit test, addressing BIT0-1016. 2013-08-28 16:12:11 -05:00
Jon Siwek
57b193593d Make mem leak tests able to time out.
This is a workaround for what seems to be a deadlock in gperftools
(seen in their 2.0 and 2.1 releases) that happens occasionally.
2013-08-15 14:27:02 -05:00
Jon Siwek
db7b6661fe Fix a unit test outdated by recent sumstats changes. 2013-08-09 09:50:05 -05:00
Robin Sommer
d349520745 Another test fix.
The classic "uniq -c" is not portable ...
2013-07-18 21:34:02 -07:00
Robin Sommer
006e370ee0 Canonyfying the output of core.print-bpf-filters.
I couldn't figure out why it's not stable but it doesn't seem to
matter for now unless more such situations show up.
2013-07-18 19:58:19 -07:00
Seth Hall
8322bbfd62 Small test fixes. 2013-07-09 23:28:09 -04:00
Robin Sommer
2ea1f483db Bringing back test for enable_auto_protocol_capture_filters (formerly
all_packets).
2013-07-08 13:06:03 -07:00
Seth Hall
5f8ee93ef0 Merge remote-tracking branch 'origin/master' into topic/seth/analyzer-framework
Conflicts:
	scripts/base/init-default.bro
	scripts/base/protocols/dns/main.bro
	scripts/base/protocols/ftp/main.bro
	scripts/base/protocols/http/main.bro
	scripts/base/protocols/irc/main.bro
	scripts/base/protocols/smtp/main.bro
	scripts/base/protocols/ssh/main.bro
	scripts/base/protocols/ssl/main.bro
	scripts/base/protocols/syslog/main.bro
	src/main.cc
	testing/btest/Baseline/coverage.default-load-baseline/canonified_loaded_scripts.log
2013-07-04 23:07:52 -04:00
Robin Sommer
a5cb605b1d Fixing test that was accidentally broken. 2013-06-03 20:10:48 -07:00
Robin Sommer
4ccd6d76fd Fixing tests.
Part of this involves making the file-analysis tests independent of
specific hash values. I've done that only partially though.
2013-05-17 18:14:35 -07:00
Robin Sommer
eb637f9f3e Merge remote-tracking branch 'origin/master' into topic/robin/plugins
Thanks to git this merge was less troublesome that I was afraid it
would be. Not all tests pass yet though (and file hashes have changed
unfortunately).

Conflicts:
	cmake
	doc/scripts/DocSourcesList.cmake
	scripts/base/init-bare.bro
	scripts/base/protocols/ftp/main.bro
	scripts/base/protocols/irc/dcc-send.bro
	scripts/test-all-policy.bro
	src/AnalyzerTags.h
	src/CMakeLists.txt
	src/analyzer/Analyzer.cc
	src/analyzer/protocol/file/File.cc
	src/analyzer/protocol/file/File.h
	src/analyzer/protocol/http/HTTP.cc
	src/analyzer/protocol/http/HTTP.h
	src/analyzer/protocol/mime/MIME.cc
	src/event.bif
	src/main.cc
	src/util-config.h.in
	testing/btest/Baseline/coverage.bare-load-baseline/canonified_loaded_scripts.log
	testing/btest/Baseline/coverage.default-load-baseline/canonified_loaded_scripts.log
	testing/btest/Baseline/istate.events-ssl/receiver.http.log
	testing/btest/Baseline/istate.events-ssl/sender.http.log
	testing/btest/Baseline/istate.events/receiver.http.log
	testing/btest/Baseline/istate.events/sender.http.log
2013-05-16 17:58:48 -07:00
Jon Siwek
ec50cad9db Merge branch 'master' into topic/jsiwek/file-analysis
Conflicts:
	scripts/base/protocols/ftp/main.bro
	src/OpaqueVal.h
	testing/btest/Baseline/coverage.bare-load-baseline/canonified_loaded_scripts.log
	testing/btest/Baseline/coverage.default-load-baseline/canonified_loaded_scripts.log
2013-05-06 10:21:16 -05:00
Robin Sommer
7f0e25bdef Replacing cluster leak test.
The former one used the old metrics framework, now switching to
sumstats.
2013-04-29 21:14:11 -07:00
Jon Siwek
641154f8e8 FileAnalysis: checkpoint in middle of big reorganization.
- FileAnalysis::Info is now just a record used for logging, the fa_file
  record type is defined in init-bare.bro as the analogue to a
  connection record.

- Starting to transfer policy hook triggers and analyzer results to
  events.
2013-04-09 15:49:58 -05:00
Jon Siwek
f0e9cdc30a FileAnalysis: add a memory leak unit test. 2013-03-27 16:33:33 -05:00
Jon Siwek
704c705e7b Merge branch 'master' into topic/jsiwek/file-analysis 2013-03-27 14:13:05 -05:00
Robin Sommer
2be985433c Test-suite passes.
All tests pass with one exception: some Broxygen tests are broken
because dpd_config doesn't exist anymore. Need to update the mechanism
for auto-documenting well-known ports.
2013-03-26 15:40:23 -07:00
Seth Hall
4e99d3a606 Add support for 802.1ah (Q-in-Q). 2013-03-22 12:38:43 -04:00
Jon Siwek
59ed5c75f1 FileAnalysis: add unit tests covering current protocol integration.
And had to make various fixes/refinements after scrutinizing results.
2013-03-19 15:50:05 -05:00
Jon Siwek
b30211c178 FileAnalysis: fix unit tests. 2013-03-18 12:29:41 -05:00