Commit graph

12680 commits

Author SHA1 Message Date
Jon Siwek
4cb6a279f5 Add extra guard against non-IP, non-ARP packets being parsed as IPv6.
This would usually manifest in raising truncated_IP weirds, which is
misleading because it wasn't actually an IP packet in the first place.
Now unknown_packet_type weird is raised instead.
2012-02-07 11:42:55 -06:00
Bernhard Amann
8385d5bb2d it compiles :)
But that's all, not tested, don't expect it to do anything but crash.
2012-02-06 17:37:02 -08:00
Bernhard Amann
238e9545c0 Merge remote-tracking branch 'origin/topic/bernhard/log-threads' into topic/bernhard/input-threads 2012-02-06 16:15:22 -08:00
Bernhard Amann
833e724400 way less compile errors. 2012-02-06 16:14:39 -08:00
Bernhard Amann
e22d396229 typo 2012-02-06 13:53:33 -08:00
Bernhard Amann
f76bbf01a4 fix CreateBackend function - the way that the right backend was chosen & backends were initialized did not make sense... 2012-02-06 13:15:01 -08:00
Seth Hall
eca3261077 Protocol field for NULL encapsulation was read big endian. 2012-02-06 15:49:03 -05:00
Bernhard Amann
e726bfe301 Merge branch 'topic/bernhard/log-threads' into topic/bernhard/input-threads 2012-02-06 12:16:55 -08:00
Bernhard Amann
115e6a18b4 Merge branch 'topic/bernhard/log-send-proto' into topic/bernhard/log-threads
Send protocol type to log writers - the ascii writer simply ignores this, but the input reader needs support for this.

Conflicts:
	src/LogMgr.h
	src/logging/Manager.cc
2012-02-06 11:08:32 -08:00
Jon Siwek
1f58ac875b Fix some hashing bugs resulting from adaptation of new IPAddr class. 2012-02-06 13:05:52 -06:00
Bernhard Amann
23b2c95644 backend does not need friend access to manager 2012-02-06 10:57:07 -08:00
Bernhard Amann
f6c6387c52 Merge branch 'topic/bernhard/input' into topic/bernhard/input-threads
most stuff is inplace, logging framework needs a few changes merged before continuing here...

Conflicts:
	src/CMakeLists.txt
	src/LogMgr.h
	src/logging/Manager.cc
	src/main.cc
2012-02-06 10:54:07 -08:00
Jon Siwek
2e2f8f5d06 Merge branch 'master' into topic/v6-addr
Conflicts:
	src/bro.bif
2012-02-06 11:06:55 -06:00
Daniel Thayer
fe5d865e64 Remove --enable-brov6 from configure usage text 2012-02-03 18:06:02 -06:00
Jon Siwek
b3f1f45082 Remove --enable-brov6 flag, IPv6 now supported by default.
Internally, all BROv6 preprocessor switches were removed and
addr/subnet representations wrapped in the new IPAddr/IPPrefix classes.

Some script-layer changes of note:

- dns_AAAA_reply event signature changed: the string representation
  of an IPv6 addr is easily derived from the addr value, it doesn't
  need to be another parameter.  This event also now generated directly
  by the DNS analyzer instead of being "faked" into a dns_A_reply event.

- removed addr_to_count BIF.  It used to return the host-order
  count representation of IPv4 addresses only.  To make it more
  generic, we might later add a BIF to return a vector of counts
  in order to support IPv6.

- changed the result of enclosing addr variables in vertical pipes
  (e.g. |my_addr|) to return the bit-width of the address type which
  is 128 for IPv6 and 32 for IPv4.  It used to function the same
  way as addr_to_count mentioned above.

- remove bro_has_ipv6 BIF
2012-02-03 16:46:58 -06:00
Bernhard Amann
a0487ecb30 move Value and Field from the logging namespace to the threading namespace, because other modules using threading will need them. 2012-02-03 14:12:29 -08:00
Seth Hall
600d015dab One more very minor change I forgot to commit. 2012-02-03 16:27:51 -05:00
Seth Hall
0fbe925dc5 Fixed a misspelling. 2012-02-03 16:25:30 -05:00
Seth Hall
44bb4d0320 Updates for CHANGES and VERSION files. 2012-02-03 16:17:45 -05:00
Seth Hall
2cd88ee4f6 Merge remote-tracking branch 'origin/topic/bernhard/software'
* origin/topic/bernhard/software:
  change software framework interface again. At the moment everything should worl.
  start reworking interface of software framework. working apart from detect-webapps.bro, which direcly manipulates a no longer available interface...
  after talking to seth - change host_a field in record back to host.
  forgotten policy files.
  Software framework stores ports for server software.
2012-02-03 16:17:04 -05:00
Robin Sommer
819cb57952 Updating submodule(s).
[nomail]
2012-02-03 04:05:34 -08:00
Robin Sommer
70fe7876a1 Updating thread naming.
Also includes experimental code to adapt the thread name as shown by
top, but it's untested.
2012-02-03 04:04:38 -08:00
Robin Sommer
cf6a346b86 Fixing prof.log output.
The queue Size() method was not yet atomic.
2012-02-03 04:04:38 -08:00
Robin Sommer
4879cb7b0d Improved signal handling.
Sending SIGTERM triggers a normal shutdown of all threads that waits
until they have processed their remaining data. However, sending a 2nd
SIGTERM while waiting for them to finish will immediately kill them
all.
2012-02-03 04:04:38 -08:00
Robin Sommer
ffb4094d36 Bugfixes 2012-02-03 04:04:38 -08:00
Robin Sommer
29fc56105d Documenting logging API. 2012-02-03 04:04:37 -08:00
Robin Sommer
1058e11ffb Adding thread statistics to prof.log 2012-02-03 04:04:37 -08:00
Robin Sommer
4f0fc571ef Doing bulkd writes instead of individual writes now.
Also slight change to Writer API, going back to how the rotate methods
were before.
2012-02-03 04:04:37 -08:00
Robin Sommer
a428645b2a Documenting the threading/* classes.
Also switching from semaphores to mutexes as the former don't seem to
be fully supported on MacOS.
2012-02-03 04:04:37 -08:00
Robin Sommer
396e8c901c Merge remote-tracking branch 'origin/fastpath'
* origin/fastpath:
  Fix minor typos in documentation
2012-02-03 01:56:30 -08:00
Daniel Thayer
1d417a3e23 Fix minor typos in documentation 2012-02-02 18:48:23 -06:00
Robin Sommer
9c9b72a1b8 Merge remote-tracking branch 'origin/fastpath'
* origin/fastpath:
  Fix sorting of lines in Brofiler coverage.log
2012-01-31 11:51:25 -08:00
Daniel Thayer
4a6a9fe9f2 Fix sorting of lines in Brofiler coverage.log
Lines with a range were being output with text "lines", and so were
being listed after all other lines belonging to the same Bro script
(e.g., "lines 123-125" was listed after "line 492").  Fixed by using
the text "line" instead of "lines".

Line numbers with fewer digits were being listed after line numbers
with more digits (e.g., "line 85" was listed after "line 237").
Fixed by sorting on a reformatted string (this string does not appear
in the output) where line numbers are right justified (padded on left
with spaces) so that sorting produces the expected results.
2012-01-30 17:35:19 -06:00
Robin Sommer
2df3738d1a Merge remote-tracking branch 'origin/topic/bernhard/log-threads' into topic/robin/log-threads 2012-01-30 13:22:17 -08:00
Robin Sommer
b6912f16aa Merge branch 'master' of ssh://git.bro-ids.org/bro into topic/robin/log-threads 2012-01-30 13:22:02 -08:00
Bernhard Amann
6cc29a7832 make logging with threads compile on mac os and fix a couple of string literal warnings. 2012-01-30 12:12:14 -08:00
Seth Hall
c03efbb570 Small updates for the bittorrent analyzer to support 64bit types in binpac.
- This branch removes the attempt at bittorrent resynchronization.
  I don't think that the bittorrent resynchronization would really
  work very well anyway.

- This need to be merged after the topic/seth/64bit-type branch in binpac.
2012-01-27 22:55:42 -05:00
Robin Sommer
e4e770d475 Threaded logging framework.
This is based on Gilbert's code but I ended up refactoring it quite a
bit. That's why I didn't do a direct merge but started with a new
branch and copied things over to adapt. It looks quite a bit different
now as I tried to generalize things a bit more to also support the
Input Framework.

The larger changes code are:

    - Moved all logging code into subdirectory src/logging/. Code
      here is in namespace "logging".

    - Moved all threading code into subdirectory src/threading/. Code
      here is in namespace "threading".

    - Introduced a central thread manager that tracks threads and is
      in charge of termination and (eventually) statistics.

    - Refactored logging independent threading code into base classes
      BasicThread and MsgThread. The former encapsulates all the
      pthread code with simple start/stop methods and provides a
      single Run() method to override.

      The latter is derived from BasicThread and adds bi-directional
      message passing between main and child threads. The hope is that
      the Input Framework can reuse this part quite directly.

    - A log writer is now split into a general WriterFrontend
      (LogEmissary in Gilbert's code) and a type-specific
      WriterBackend. Specific writers are implemented by deriving from
      the latter. (The plugin interface is almost unchanged compared
      to the 2.0 version.).

      Frontend and backend communicate via MsgThread's message
      passing.

    - MsgThread (and thus WriterBackend) has a Heartbeat() method that
      a thread can override to execute code on a regular basis. It's
      triggered roughly once a second by the main thread.

    - Integration into "the rest of Bro". Threads can send messages to
      the reporter and do debugging output; they are hooked into the
      I/O loop for sending messages back; and there's a new debugging
      stream "threading" that logs, well, threading activity.

This all seems to work for the most part, but it's not done yet.

TODO list:

    - Not all tests pass yet. In particular, diffs for the external
      tests seem to indicate some memory problem (no crashes, just an
      occasional weird character).

    - Only tested in --enable-debug mode.

    - Only tested on Linux.

    - Needs leak check.

    - Each log write is currently a single inter-thread message. Bring
      Gilbert's bulk writes back.

    - Code needs further cleanup.

    - Document the class API.

    - Document the internal structure of the logging framework.

    - Check for robustness: live traffic, aborting, signals, etc.

    - Add thread statistics to profile.log (most of the code is there).

    - Customize the OS-visible thread names on platforms that support it.
2012-01-27 17:16:14 -08:00
Robin Sommer
c607785cec Merge remote-tracking branch 'origin/topic/jsiwek/brofiler'
* origin/topic/jsiwek/brofiler:
  Fix mktemp portability issue affecting test coverage. (addresses #752)

Closes #752.
2012-01-27 10:43:43 -08:00
Jon Siwek
0065cf6148 Fix mktemp portability issue affecting test coverage. (addresses #752)
Also update Makefiles to behave better for brief targets and in absence
of external test repos.
2012-01-27 11:01:50 -06:00
Robin Sommer
f6f9dd952f Fixed for Brofiler merge. 2012-01-26 20:55:24 -08:00
Robin Sommer
60ae6f01d1 Updating submodule(s).
[nomail]
2012-01-25 18:03:40 -08:00
Robin Sommer
6a3b41b84d Bugfix caught by test-suite. 2012-01-25 17:45:26 -08:00
Robin Sommer
d6767e1d83 Disalbing brofiling because of problem.
See #756.
2012-01-25 17:36:13 -08:00
Robin Sommer
6a6092daf8 Adding coverage to brief make target as well. 2012-01-25 17:35:25 -08:00
Robin Sommer
1aefccd96d Updating submodule(s).
[nomail]
2012-01-25 17:15:06 -08:00
Robin Sommer
848ae2355e Merge remote-tracking branch 'origin/topic/jsiwek/brofiler'
* origin/topic/jsiwek/brofiler:
  Fix superfluous/duplicate data getting in to testing coverage log.
  Add "# @no-test" tag to blacklist statements from test coverage analysis.
  Test coverage integration for external tests and complete suite.
  Integrate Bro script coverage profiling with the btest suite.
  Add simple profiling class to accumulate Stmt usage stats across runs.

Renaming environment variable BROFILER_FILE to BRO_PROFILER_FILE for
consistency. Yeah, I know, such a nice name! :)
2012-01-25 17:12:37 -08:00
Robin Sommer
b649ade9ba Merge remote-tracking branch 'origin/topic/bif_cleanup'
* origin/topic/bif_cleanup:
  Give mode2string a more generic name.
  Change some BiF return values from bool to any.
  Perform type checking on count-to-port conversion.
  Remove redundant connection_record() BiF.
  Remove redundant active_connection() BiF.
  Make exit() parameterizable.
  to_port() now parses a string instead of a count.

Closes #684.
2012-01-25 16:48:00 -08:00
Robin Sommer
7a8c9b1c69 Merge remote-tracking branch 'origin/topic/jsiwek/local-table-init'
* origin/topic/jsiwek/local-table-init:
  Allow local table variables to be initialized with {} list expressions.

Closes #739.
2012-01-25 13:47:42 -08:00
Robin Sommer
27ce62077f Merge remote-tracking branch 'origin/topic/jsiwek/complex-record-indices'
* origin/topic/jsiwek/complex-record-indices:
  Teach CompHash to allow indexing by records with vector/table/set fields.

Closes #464
2012-01-25 13:38:36 -08:00