Commit graph

6667 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
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
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
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
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
Robin Sommer
2c439fd0a2 Fixing typo 2012-01-23 22:00:56 -08:00
Robin Sommer
08683175c1 Interface draft for new IP address wrapper class. 2012-01-22 21:41:42 -08:00
Jon Siwek
1e4c3d8ea2 Teach CompHash to allow indexing by records with vector/table/set fields.
Addresses #464.
2012-01-20 16:54:48 -06:00
Bernhard Amann
f24c50b49a remove unnecessary stuff from function. 2012-01-20 12:42:23 -08:00
Bernhard Amann
ac1708f843 fix handling of predicates - now the second argument that is sent to the predicate really is a recordVal and not a ListVal. 2012-01-20 12:33:48 -08:00
Matthias Vallentin
6c255d13ff Merge remote-tracking branch 'origin/master' into topic/bif_cleanup
Conflicts:
	src/bro.bif
2012-01-18 14:56:53 -08:00
Jon Siwek
713e3ac5d0 Add "# @no-test" tag to blacklist statements from test coverage analysis.
It can apply to either single statements:

    print "don't cover"; # @no-test

or a block of statements:

    if ( F )
        { # @no-test
        ...
        }
2012-01-13 14:52:58 -06:00
Bernhard Amann
eb53a3d1c8 make input framework compile with brov6 2012-01-12 11:51:12 -08:00
Bernhard Amann
d476e9f3f4 Merge remote-tracking branch 'origin/master' into topic/bernhard/input 2012-01-12 11:07:12 -08:00
Jon Siwek
9aefeec4ce Integrate Bro script coverage profiling with the btest suite. 2012-01-11 16:30:25 -06:00
Jon Siwek
1181444f37 Merge branch 'master' into topic/jsiwek/brofiler
Conflicts:
	src/main.cc
2012-01-11 10:57:44 -06:00
Robin Sommer
3d2dc5f5fc Merge remote-tracking branch 'origin/topic/script-reference'
* origin/topic/script-reference: (50 commits)
  A few updates for the FAQ.
  Fixing some doc warnings.
  Forgot to add protocol identifier support for TLS 1.2
  Finished SSL & syslog autodocs.
  Adding the draft SSL extension type next_protocol_negotiation.
  Fix some documentation errors.
  Tweaks.
  A set of script-reference polishing.
  fixed a couple typos in comments
  Add summary documentation to bif files.
  Add ssl and syslog script documentation
  Add Conn and DNS protocol script documentation. (fixes #731)
  Small updates to the default local.bro.
  Documentation updates for HTTP & IRC scripts.
  SSH&FTP Documentation updates.
  Fixing a warning from the documentation generation.
  This completes framework documentation package 4.
  Minor notice documentation tweaks.
  Fix some malformed Broxygen xref roles.
  Minor doc tweaks to init-bare.bro.
  ...

Conflicts:
	aux/broccoli
	aux/broctl
	src/bro.bif
	src/strings.bif

Includes:

    - Updated baselines for autodoc tests.
    - Now excluding stats.bro from external texts, it's not stable.
2012-01-10 14:00:44 -08:00
Bernhard Amann
3138f015ce Merge remote-tracking branch 'origin/master' into topic/bernhard/input 2012-01-10 11:33:26 -08:00
Robin Sommer
a2e8146e4f Merge remote-tracking branch 'origin/fastpath'
* origin/fastpath:
  Fix ref counting bug in BIFs that call internal_type. (fixes #740)
2012-01-10 10:32:59 -08:00
Jon Siwek
2348d794b6 Fix ref counting bug in BIFs that call internal_type. (fixes #740) 2012-01-10 12:25:33 -06:00
Seth Hall
a8f9af3531 Merge branch 'topic/script-reference' of ssh://git.bro-ids.org/bro into topic/script-reference 2012-01-10 00:25:54 -05:00
Seth Hall
6d3d289d5c Fix some documentation errors. 2012-01-09 22:50:49 -05:00
Robin Sommer
5ff7afaadb Tweaks. 2012-01-09 18:28:43 -08:00
Robin Sommer
e5a42e8a85 Merge branch 'topic/script-reference' of ssh://git.bro-ids.org/bro into topic/script-reference
Conflicts:
	scripts/base/frameworks/notice/actions/pp-alarms.bro
	scripts/base/frameworks/notice/main.bro
	src/bro.bif
	src/const.bif
	src/event.bif
	src/strings.bif
	src/types.bif
2012-01-09 18:07:43 -08:00
Robin Sommer
b10e02b691 A set of script-reference polishing.
Includes:

    - Quite a bit of CSS tweaking.

    - Some small changes to BroDoc.cc to change the order of sections.

    - A bit of tweaking some reST here and there.
2012-01-09 18:04:34 -08:00