Commit graph

394 commits

Author SHA1 Message Date
Robin Sommer
c81d428256 Adding test for new error handling. 2011-10-09 20:41:55 -07:00
Robin Sommer
bd9c937236 Fixing DNS memory leaks.
Some of the changes only clean up at termination to make perftools
happt, but there were some "real" leaks as well.

This fixes all DNS leaks I could reproducem, including most likely
what's reported in #534. Closing #534.

I'm also adding a new btest subdir core/leaks with tests requiring
perftools support. These don't compare against base lines but abort
whenever perftools reports a leak (with stack information to track it
down). Right now, these are passing.
2011-10-09 17:00:57 -07:00
Jon Siwek
41dd0b98e9 Merge branch 'master' into topic/jsiwek/reorg-followup
Conflicts:
	scripts/base/frameworks/cluster/setup-connections.bro
	scripts/base/frameworks/metrics/main.bro
	scripts/base/frameworks/notice/actions/email_admin.bro
	scripts/base/frameworks/notice/weird.bro
	scripts/base/protocols/mime/file-hash.bro
	scripts/base/protocols/mime/file-ident.bro
	scripts/policy/frameworks/communication/listen-clear.bro
	scripts/policy/frameworks/communication/listen-ssl.bro
	scripts/policy/frameworks/control/controller.bro
	scripts/policy/frameworks/metrics/http-example.bro
	scripts/policy/frameworks/metrics/ssl-example.bro
	scripts/policy/protocols/conn/scan.bro
	src/CMakeLists.txt
2011-08-15 15:34:25 -05:00
Robin Sommer
1ca9def9e6 Merge remote-tracking branch 'origin/topic/jsiwek/autodoc-fixes'
* origin/topic/jsiwek/autodoc-fixes:
  Update doc sources and touch up a few script comments.
  Fixes for script auto-documentation.

Conflicts:
	scripts/base/frameworks/logging/main.bro
2011-08-13 12:09:13 -07:00
Jon Siwek
2a9ea6b8ba Merge branch 'master' into topic/jsiwek/autodoc-fixes
Conflicts:
	scripts/CMakeLists.txt
	scripts/base/frameworks/cluster/setup-connections.bro
	scripts/base/frameworks/communication/__load__.bro
	scripts/base/frameworks/metrics/conn-example.bro
	scripts/base/frameworks/metrics/http-example.bro
	scripts/site/local.bro
2011-08-13 09:31:06 -05:00
Jon Siwek
00de88f4cb Fix reporter using part of the actual message as a format string
When not reporting via events, the final contents of the message buffer
after formatting was being used as a format string to fprintf instead of
writing out the actual string.
2011-08-12 23:24:44 -07:00
Jon Siwek
521f54c4f0 Fix check_for_unused_event_handlers option.
The format string given to the reporter warning call wasn't printing
the handler names.  Also changed it so that each warning message has
the full context of the warning.
2011-08-11 11:34:42 -05:00
Robin Sommer
1289e115c1 A set of new/changed tests regarding the new policy script organisation.
* test-all.bro renamed to test-all-policy.bro because it lists
      only the optional scripts now.

    * A new test that checks that the default config loads everything
      in base/*/

    * A new test that runs bare mode but loads all optional policy
      scripts (which fails horribly right now ...)

    * A new loaded_scripts test for the bare mode.
2011-08-08 18:29:35 -07:00
Jon Siwek
4ac6d0ae2e Fixes for script auto-documentation.
- Fixing the parts of the `make restdoc` and `make doc` process that were
  broken by the last Bro script re-organization

- Generated documentation for Bro scripts derived from BiFs now use the
  original BiF source file as the "original source file" link

- Renaming of the internal POLICYDEST definition and other misc places that
  refer to "policy" scripts; that terminology doesn't make total sense now

- Added a documentation blacklist reminder test that will fail if there's
  scripts that are blacklisted from being documentated because they're still
  in progress

- Some minor Bro script changes to fix small @load dependency errors

Addresses #543
2011-08-08 19:50:45 -05:00
Seth Hall
597a4d6704 Hopefully the last major script reorganization.
- policy/ renamed to scripts/

- By default BROPATH now contains:
	- scripts/
	- scripts/policy
	- scripts/site

- *Nearly* all tests pass.

- All of scripts/base/ is loaded by main.cc
	- Can be disabled by setting $BRO_NO_BASE_SCRIPTS
	- Scripts in scripts/base/ don't use relative path loading to ease use of BRO_NO_BASE_SCRIPTS (to copy and paste that script).

- The scripts in scripts/base/protocols/ only (or soon will only) do logging and state building.

- The scripts in scripts/base/frameworks/ add functionality without causing any additional overhead.

- All "detection" activity happens through scripts in scripts/policy/.

- Communications framework modified temporarily to need an environment variable to actually enable (ENABLE_COMMUNICATION=1)
	- This is so the communications framework can be loaded as part
	  of the base without causing trouble when it's not needed.
	- This will be removed once a resolution to ticket #540 is reached.
2011-08-05 23:09:53 -04:00
Jon Siwek
b340604346 core.load-pkg test now insensitive to default-loaded scripts. 2011-07-22 16:33:50 -07:00
Jon Siwek
2a997f5ef3 Update @prefixes test. 2011-07-20 16:02:38 -05:00
Jon Siwek
f6dfbef952 Rewrite a test using btest's TEST-START-FILE directive 2011-07-20 15:59:07 -05:00
Jon Siwek
0dd1a1e21e Fix @unload'd files from generating bro_script_loaded event. 2011-07-20 15:56:25 -05:00
Jon Siwek
089b822302 Merge branch 'master' into topic/script-load-changes 2011-07-20 15:38:22 -05:00
Robin Sommer
b2a3723a1d Fixing tests that need a diff canonifier. 2011-07-19 17:39:46 -07:00
Jon Siwek
9d468493f2 Renaming a test better. 2011-07-14 22:06:16 -05:00
Jon Siwek
d97003892b Reimplementation of the @prefixes statement.
Any added prefixes are now used *after* all input files have been
parsed to look for a prefixed, flattened version of the input file
somewhere in BROPATH and, if found, load it.

For example, if "lcl" is in @prefixes, and site.bro is loaded, then
a file named "lcl.site.bro" that's in BROPATH would end up being
automatically loaded as well.  Packages work similarly, e.g. loading
"protocols/http" means a file named "lcl.protocols.http.bro" in BROPATH
gets loaded automatically.
2011-07-14 21:32:02 -05:00
Jon Siwek
e5e3bf28ec Make @load statements recognize relative paths.
For example a script can do "@load ./foo" to load a script named
foo.bro that lives in the same directory or "@load ../bar" to load
a script named bar.bro in the parent directory, even if those
directories are not contained in BROPATH.
2011-07-14 11:35:23 -05:00
Seth Hall
0332a06012 Fixed most of the tests after the script reorganization. 2011-07-12 14:12:25 -04:00
Robin Sommer
084c2086a4 Fixing bug causing crash when running without arguments. 2011-07-07 19:56:48 -07:00
Robin Sommer
df1b2f922b Renaming reporter_message to report_info.
Same change internally.
2011-07-07 19:56:25 -07:00
Robin Sommer
eb0580c622 Fixing another memory leak.
This is the ConnVal leak that Gilbert also saw.
2011-07-07 19:46:40 -07:00
Robin Sommer
9709b1d522 Merge remote branch 'origin/topic/robin/reporting'
* origin/topic/robin/reporting:
  Syslog BiF now goes through the reporter as well.
  Avoiding infinite loops when an error message handlers triggers errors itself.
  Renaming the Logger to Reporter.
  Overhauling the internal reporting of messages to the user.

Updating a bunch of tests/baselines as well.

Conflicts:
	aux/broccoli
	policy.old/alarm.bro
	policy/all.bro
	policy/bro.init
	policy/frameworks/notice/weird.bro
	policy/notice.bro
	src/SSL-binpac.cc
	src/bro.bif
	src/main.cc
2011-07-01 13:59:21 -07:00
Robin Sommer
fb6a8cec19 Avoiding infinite loops when an error message handlers triggers errors
itself.

If an error is triggered inside one of the reporter_* handlers, the
message about that will now fall back to stderr.
2011-07-01 10:04:27 -07:00
Robin Sommer
66e2c3b623 Renaming the Logger to Reporter.
Also changing output to not include timestamps when we haven't started
processing packets yet.
2011-07-01 09:22:33 -07:00
Jon Siwek
3c055b16a5 Update core.conn-uid test/baseline.
All the UIDs in the baselines changed because they're now also
being generated for notices.
2011-06-29 12:49:07 -05:00
Jon Siwek
0d4be5d772 Fixing tests / updating baselines.
- core.load-unload: scripts that get loaded by default changed, so to
  make the test insensitive to that in the future, I changed the test
  to just check that the stdout is empty (the @unload'd script would have
  had output there)

- policy.frameworks.logging.rotate-custom: I saw that the ordering of
  the log postprocessor output caused a failure for me even though the
  overall content was the same, so it now sorts that part before diff'ing

- core.print-bpf-filters-ipv[4|6]: packet-filter log file name changed

- policy.protocols.conn.known-services: logging file names changes and
  local_nets is now in the Site module
2011-06-29 12:34:14 -05:00
Seth Hall
c070cb31da Merge remote branch 'origin/master' into topic/policy-scripts-new
Conflicts:
	policy/bro.init
	testing/btest/language/rare-events.bro
2011-06-25 23:49:20 -04:00
Jon Siwek
ea1f819b3e Update core.vlan-mpls test to use new policy scripts. 2011-06-20 16:06:44 -05:00
Jon Siwek
fc66d88a04 Updating the packet filter tests to use new policy scripts. 2011-06-20 15:56:16 -05:00
Jon Siwek
ef79ab3562 Update baseline for core.load-pkg test
I removed the diff'ing against which scripts Bro outputs as loaded
because that's going to be sensitive to changes in which scripts
get loaded by default.  What really matters is the output that shows
that Bro was able to load the script via a directory's __load__.bro
2011-06-20 14:10:02 -05:00
Jon Siwek
9de6e9170c Cleaning up the script loading implementation.
This change primarily improves the way Bro detects and prevents
the same script from being loaded twice.  It now compares inode
numbers instead of path names.
2011-06-20 12:10:09 -05:00
Jon Siwek
0f6a6ddc28 Fix baseline for core.conn-id (now core.conn-uid) test.
"conn-id.bro" was the name of a script in the policy/ directory that conn.bro
expected to @load, but when the unit test was also named "conn-id.bro",
it would be loaded twice during the test (once from conn.bro and once
as a command line argument to bro).  This means two event handlers were
registered in error and the baseline output contained duplicate lines
that can be removed.
2011-06-20 10:11:44 -05:00
Jon Siwek
b4d70a22db Fixed core.load-pkg test w/ diff canonifier instead 2011-06-10 15:07:32 -05:00
Jon Siwek
9e747a040d Revert "Fix core.load-pkg unit test."
This reverts commit 80558a994a.
2011-06-10 15:01:35 -05:00
Jon Siwek
13c90fc732 Fix core.conn-id test on some platforms.
The output of some versions of `wc` (e.g. MacOS) seems to indent
their output while others don't, causing the baseline diff to fail.
So pipe to sed to get rid of spaces before diffing.
2011-06-10 12:17:10 -05:00
Jon Siwek
80558a994a Fix core.load-pkg unit test.
Removed the test's diff against baseline output that contained absolute
paths so that it will work across systems.  Also don't redirect anything
to stderr so that failure information shows up in btest diagnostic output.
2011-06-10 11:53:51 -05:00
Robin Sommer
a236dd0d3d Fixing typo in test. 2011-06-02 22:07:36 -07:00
Robin Sommer
fac328685b @load now supports loading a directory.
With a directory "foo" somewhere in BROPATH, "@load foo" now checks if
there's a file "foo/__load__.bro". If so, it reads that file in. (If
not, Bro reports the same error as before, complaining that it can't
read a directory).
2011-06-02 21:57:24 -07:00
Robin Sommer
b16bb7fff4 Test updates.
Includes splitting up one test which's output now depends on wether
we've compiled with IPv6 support or not.
2011-05-10 19:33:37 -07:00
Robin Sommer
61c929bc16 Updating btests and a Makefile.
"make" now runs all the tests.
2011-05-10 17:56:45 -07:00
Robin Sommer
9ddc26328d Support for (mixed) MPLS and VLAN traffic, and a new default BPF
filter. (Seth Hall and Robin Sommer)

- Merging in the patch from #264, which provides support for mixed
  VLAN and MPLS traffic.

- Changing Bro's default filter from being built dynamically to being
  a static "ip or not ip". To get the old behaviour back (i.e., the
  dynamically built filter), redef "all_packets" to false.

- print-filter.bro now always prints the filter that Bro is actually
  using, even if overriden from the command line.
2011-04-29 09:10:43 -07:00
Robin Sommer
59d6202104 Merge remote branch 'origin/topic/robin/conn-ids'
* origin/topic/robin/conn-ids:
  Moving uid from conn_id to connection, and making output determistic if a hash seed is given.
  Extending conn_id with a globally unique identifiers.
2011-04-22 22:13:44 -07:00