Commit graph

19 commits

Author SHA1 Message Date
Gregor Maier
f3a92ec30b Minor fixes for possible leaks on uncommon code path or on initialization. 2011-08-23 20:28:11 -07:00
Gregor Maier
4214d8d905 Fixing memleak in tunnel code. 2011-08-17 07:31:25 -07:00
Gregor Maier
08dc84a250 Tunnel decapsulation bugfix when FlipRoles is called.
If FlipRoles() is called the conn_val in Conn.cc gets Unref'ed and thus
my tunnel_partent RecordVal was lost. Fixing this.
2011-08-16 20:41:36 -07:00
Gregor Maier
cd592203a0 Remvoing old tunnel code (encap_hdr_size and udp_tunnels). 2011-08-07 13:55:46 -07:00
Gregor Maier
5ed3ec2f38 Finishing tunnel decapsulation support in C++ core.
Policy script is next.
2011-08-07 09:49:41 -07:00
Gregor Maier
8910cd2dca Adding support to de-capsulate tunnels. Checkpoint.
Re-organizing code. Adding UDP tunnel handlers.
Using policy level redef'able consts to tune behavior. UDP port settings
not working yet.
2011-08-04 15:25:13 -07:00
Gregor Maier
9c388a1809 Adding support to de-capsulate tunnels.
Checkpoint.
Decapsulation happens after IP Defragmentation. The "identity" of the
enclosing tunnel (the "parent") is added to the connection record of the
child (tunneled) connection as an optional field $tunnel_parent.
2011-08-03 14:12:47 -07:00
Robin Sommer
f83650f14a Fixing reporter's weird flow method. 2011-07-11 22:18:22 -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
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
Robin Sommer
6d2a89f1f8 Merge remote branch 'origin/topic/seth/net-stats-bif'
* origin/topic/seth/net-stats-bif:
  Removing a stray print statement.
  Changed netstats (packet loss) handling to script-land.

Nice idea to pass the old data into a regular scheduled event!

Conflicts:
	src/event.bif
2011-06-25 17:05:15 -07:00
Robin Sommer
93894eed9b Overhauling the internal reporting of messages to the user.
The Logger class is now in charge of reporting all errors, warnings,
informational messages, weirds, and syslogs. All other components
route their messages through the global bro_logger singleton.

The Logger class comes with these reporting methods:

    void Message(const char* fmt, ...);
    void Warning(const char* fmt, ...);
    void Error(const char* fmt, ...);
    void FatalError(const char* fmt, ...); // Terminate Bro.
    void Weird(const char* name);
    [ .. some more Weird() variants ... ]
    void Syslog(const char* fmt, ...);
    void InternalWarning(const char* fmt, ...);
    void InternalError(const char* fmt, ...); // Terminates Bro.

See Logger.h for more information on these.

Generally, the reporting now works as follows:

    - All non-fatal message are reported in one of two ways:

        (1) At startup (i.e., before we start processing packets),
            they are logged to stderr.

        (2) During processing, they turn into events:

            event log_message%(msg: string, location: string%);
            event log_warning%(msg: string, location: string%);
            event log_error%(msg: string, location: string%);

            The script level can then handle them as desired.

            If we don't have an event handler, we fall back to
            reporting on stderr.

    - All fatal errors are logged to stderr and Bro terminates
      immediately.

    - Syslog(msg) directly syslogs, but doesn't do anything else.

The three main types of messages can also be generated on the
scripting layer via new Log::* bifs:

    Log::error(msg: string);
    Log::warning(msg: string);
    Log::message(msg: string);

These pass through the bro_logger as well and thus are handled in the
same way. Their output includes location information.

More changes:

    - Removed the alarm statement and the alarm_hook event.

    - Adapted lots of locations to use the bro_logger, including some
      of the messages that were previously either just written to
      stdout, or even funneled through the alarm mechanism.

    - No distinction anymore between Error() and RunTime(). There's
      now only one class of errors; the line was quite blurred already
      anyway.

    - util.h: all the error()/warn()/message()/run_time()/pinpoint()
      functions are gone. Use the bro_logger instead now.

    - Script errors are formatted a bit differently due to the
      changes. What I've seen so far looks ok to me, but let me know
      if there's something odd.

Notes:

    - The default handlers for the new log_* events are just dummy
      implementations for now since we need to integrate all this into
      the new scripts anyway.

    - I'm not too happy with the names of the Logger class and its
      instance bro_logger. We now have a LogMgr as well, which makes
      this all a bit confusing. But I didn't have a good idea for
      better names so I stuck with them for now.

      Perhaps we should merge Logger and LogMgr?
2011-06-25 16:40:54 -07:00
Seth Hall
c60015af22 Changed netstats (packet loss) handling to script-land.
- Removed the net_stats_update event.
- Created a net_stats function for building and retrieving the
  current network statistics.
- Removed the internal timer for firing the net_stats_update event
  along with the global heartbeat_interval variable.
- Updated the netstats script to use the new BiF.
- Updated the stats script to use the new BiF.
2011-06-17 09:02:50 -04: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
a3a075174b Merging in 'topic/robin/cleanup-rewriter'.
Removing everything related to trace rewriting.

(I wasn't too careful in ensuring that I catch everything in the
scripts; Seth is working on those anyway.)

(Merging by cherry-picking the corresponding commit, as the branch was
accidentally made off of the logging stuff).
2011-04-01 15:23:50 -07:00
Robin Sommer
57fe369c4e Removing active mapping. 2011-03-14 18:31:17 -07:00
Gregor Maier
fc6fcded07 Fixing compiler warnings 2011-02-25 21:15:22 -08:00
Gregor Maier
f79ea244fa Support namespaces / modules in bif. Checkpoint.
(now actually commiting all the files)

This change is actually two-fold:
a) bif's now accept module XYZ; statements and module::ID for
   function, const, event, enum, etc. declartation
b) Added C++-namespaces to variables, functions, etc. that are declared
   in bif but accessed from C++
   This required some (lightweight) re-factoring of the C++ codes.
   Note, event's don't have their own C++ namespace yet, since this
   would require a rather huge re-factoring.

Compiles and passes test suite.
New namespace feature not tested yet.
Documentation to follow.
2011-02-11 09:37:23 -08:00
Robin Sommer
61757ac78b Initial import of svn+ssh:://svn.icir.org/bro/trunk/bro as of r7088 2010-09-27 20:42:30 -07:00