Commit graph

49 commits

Author SHA1 Message Date
Vern Paxson
0f18a01bf7 fixed out-of-range enum constant 2021-04-01 19:16:07 -07:00
Vern Paxson
e21c0f1115 correcting some simple typos 2021-03-18 08:19:46 -07:00
Christian Kreibich
1bd658da8f Support for log filter policy hooks
This adds a "policy" hook into the logging framework's streams and
filters to replace the existing log filter predicates. The hook
signature is as follows:

    hook(rec: any, id: Log::ID, filter: Log::Filter);

The logging manager invokes hooks on each log record. Hooks can veto
log records via a break, and modify them if necessary. Log filters
inherit the stream-level hook, but can override or remove the hook as
needed.

The distribution's existing log streams now come with pre-defined
hooks that users can add handlers to. Their name is standardized as
"log_policy" by convention, with additional suffixes when a module
provides multiple streams. The following adds a handler to the Conn
module's default log policy hook:

    hook Conn::log_policy(rec: Conn::Info, id: Log::ID, filter: Log::Filter)
            {
            if ( some_veto_reason(rec) )
                break;
            }

By default, this handler will get invoked for any log filter
associated with the Conn::LOG stream.

The existing predicates are deprecated for removal in 4.1 but continue
to work.
2020-09-30 12:32:45 -07:00
Tim Wojtulewicz
33a7927704 Add proper JSON serialization via C++, deprecate json.zeek 2019-07-02 12:52:26 -07:00
Jon Siwek
dfed213f31 Deprecate functions with "bro" in them.
* "bro_is_terminating" is now "zeek_is_terminating"

* "bro_version" is now "zeek_version"

The old function names still exist for now, but are deprecated.
2019-06-05 16:18:57 -07:00
Daniel Thayer
be182aac83 More bro-to-zeek renaming in scripts and other files 2019-05-16 02:36:41 -05:00
Jon Siwek
a8c0cd7dee Fix potential race in openflow broker plugin
Broker::subscribe() after Broker::peer() may result in losing messages,
always best to do the reverse order.

Also possibly improved chance of unstable unit test output order.
2019-05-15 10:12:32 -07:00
Jon Siwek
aebcb1415d GH-234: rename Broxygen to Zeexygen along with roles/directives
* All "Broxygen" usages have been replaced in
  code, documentation, filenames, etc.

* Sphinx roles/directives like ":bro:see" are now ":zeek:see"

* The "--broxygen" command-line option is now "--zeexygen"
2019-04-22 19:45:50 -07:00
Jon Siwek
a994be9eeb Merge remote-tracking branch 'origin/topic/seth/zeek_init'
* origin/topic/seth/zeek_init:
  Some more testing fixes.
  Update docs and tests for bro_(init|done) -> zeek_(init|done)
  Implement the zeek_init handler.
2019-04-19 11:24:29 -07:00
Seth Hall
8cefb9be42 Implement the zeek_init handler.
Implements the change and a test.
2019-04-14 08:37:35 -04:00
Daniel Thayer
18bd74454b Rename all scripts to have ".zeek" file extension 2019-04-11 21:12:40 -05:00
Vern Paxson
88fd7510c6 reap the fruits of v += e 2018-07-26 12:51:36 -07:00
Robin Sommer
fe7e1ee7f0 Merge topic/actor-system throug a squashed commit. 2018-05-18 22:39:23 +00:00
Daniel Thayer
aa8d200e80 Fix various typos in the openflow framework docs 2016-11-09 14:29:03 -06:00
Johanna Amann
52d694f3bd Merge remote-tracking branch 'origin/master' into topic/johanna/netcontrol-improvements 2016-05-19 16:17:07 -07:00
Daniel Thayer
d91dd8d9a8 Fix Bro and unit tests when broker is not enabled
When Bro was compiled with broker disabled, then some Bro scripts
were referencing functions and types that were not defined.  Fixed
by adding @ifdefs to several scripts.  Removed one @ifdef because
it was causing several unit tests to fail.

Also fixed the @TEST-REQUIRES check in tests that rely on broker so
that such tests are skipped when broker is disabled.
2016-05-10 06:24:35 -05:00
Johanna Amann
86836c0bb8 Merge remote-tracking branch 'origin/master' into topic/johanna/netcontrol-improvements 2016-05-02 11:23:36 -07:00
Daniel Thayer
f44bb4d9b8 Add script wrapper functions for broker BIFs
Also renamed the "print" function to "send_print" and the "event"
function to "send_event" because Bro shows a syntax error when a
Bro script function is named "event" or "print".
2016-04-26 18:10:30 -05:00
Daniel Thayer
9f5c820c7b Rename the BrokerComm namespace to Broker 2016-03-30 14:31:25 -05:00
Johanna Amann
0bac1faa09 NetControl: add predicates to broker plugin
I apparently just forgot to add these.
2016-03-14 18:48:49 -07:00
Robin Sommer
2233521de7 Merge remote-tracking branch 'origin/topic/johanna/netcontrol'
BIT-1550 #merged

* origin/topic/johanna/netcontrol: (72 commits)
  Update baselines and news
  Move prefixtable back to all IPv6 internal handling.
  NetControl: Add functions to search for rules affecting IPs/subnets
  Add check_subnet bif that allows exact membership test for subnet tables.
  Rewrite internal handling of rules.
  Add bif that allows searching for all matching subnets in table.
  Add signaling of succesful initialization of plugins to NetControl.
  Add rule hooks to the acld plugin.
  Add new logfiles for shunting and drops to netcontrol
  Extend NetControl logging and fix bugs.
  Update OpenFlow API and events.
  small acld plugin fix
  Revert "introduce &weaken attribute"
  Fix crash when printing type of recursive structures.
  Testcase for crash when a record contains a function referencing a record.
  Rename Pacf to NetControl
  fix acld plugin to use address instead of subnet (and add functions for conversion)
  implement quarantine
  miscelaneous missing bits and pieces
  Acld implementation for Pacf - Bro side.
  ...
2016-03-11 14:29:23 -08:00
Johanna Amann
42e4072673 Add signaling of succesful initialization of plugins to NetControl.
This does not really have many user-facing changes. The one big change
is that users now should initialize plugins in the

NetControl::init()

event instead of bro_init.

Once all plugins finished initializing and the NetControl framework
starts operations, the NetControl::init_done() event is raised.

Rules that are sent to NetControl before the plugins have finished
initializing are ignored - this is important when several plugins that
require external connections have to be initialized at the beginning.
Without this delay, rules could end up at the wrong plugin.
2016-03-08 14:49:22 -08:00
Johanna Amann
8f60974bc0 Add new logfiles for shunting and drops to netcontrol
Also fix small bugs and update baselines.
2016-02-17 12:48:16 -08:00
Johanna Amann
a38327bd08 Extend NetControl logging and fix bugs.
Netcontrol log now includes more information; before that, it had not
quite caught up to the new capabilities (like flow modifying and
redirection, as well as mac addresses).

Furthermore, this fixes a number of bugs with cluster mode (like
duplicate events), test failures due to updates in Bro, etc.
2016-02-11 19:47:29 -08:00
Johanna Amann
9f3c0c9bb4 Update OpenFlow API and events.
Events now generally carry the unique ID of the backend that is given
during initialization; there are a few more functions and other
bugfixes.

A few netcontrol tests are still broken (mostly due to a pcap update in
msater).
2016-02-11 13:10:40 -08:00
Johanna Amann
f2be226a5a make openflow framework work in clusters. 2015-05-26 13:55:16 -07:00
Johanna Amann
94fbd492ca update a few consts to openflow 1.3 - we downconvert them to the less
common 1.0 in the controller when necessary.
2015-05-23 12:17:56 -07:00
Johanna Amann
b9953e7048 change type of flow_mod entries to count - the type is defined in other
records and this leads to unfortunate problems with external scripts that would
have to convert values into bro port types themseves.
2015-05-22 13:37:57 -07:00
Johanna Amann
5f0a630116 add support for switches notifying openflow and pacf about flow removal.
I just noticed - the OpenFlow events also really should send the
instance of openflow that they are with them. That is a... tad
complicated though due to a number of reasons (among others how the
events are currently generated), so this will have to wait for a bit.
2015-05-18 13:38:38 -07:00
Johanna Amann
c0111bc4d2 add flow modification to pacf and openflow.
More or less untested, but there should not be any big problems.
2015-05-15 13:29:44 -07:00
Johanna Amann
6014b395b8 handle the notification events correctly.
Now if a rule is inserted correctly (or fails to be inserted) into
openflow, we actually get the corresponding Pacf events that everything
worked.
2015-05-15 11:24:18 -07:00
Johanna Amann
208d150a0e Change openflow plugin for broker and allow specification of topics per
instance.
2015-05-13 16:23:24 -07:00
Johanna Amann
a403dbd83e add broker output plugin for openflow (at the moment we more or less
just send the flow_mod event along - there still is no feedback) and add
a testcase for it.

Also fix a few other small problems.
2015-04-20 16:07:00 -07:00
Johanna Amann
e21238d454 add a few more flow_mod options and the option to check via a predicate
if a module wants to be responsible for a certain rule...
2015-04-16 15:44:46 -07:00
Johanna Amann
7d7578146f Add basic OpenFlow plugin for Pacf.
This also changes a few types in pacf and adds a few needed bits and
pieces to the OpenFlow framework.

And - it even has a testcase...
2015-04-14 15:24:22 -07:00
Johanna Amann
c42fbdab12 move openflow to use subnets instead of addr for matches. 2015-04-14 15:00:49 -07:00
Johanna Amann
21b78b7d92 add really simple log output plugin for openflow. 2015-04-13 12:55:38 -07:00
Johanna Amann
46058d0b02 a few small fixes to openflow
*rename module from Openflow to OpenFlow
*add match_conn function to convert conn_id to openflow match
*add a few things back into the openflow records like... table_id
*and - a test
2015-04-10 11:21:55 -07:00
Johanna Amann
dbc51371cb Rewrite big parts of the Openflow framework.
The API now does not follow the openflow specification quite as closely,
however I think it is much more usable. Furthermore, the Ryu plugin was
basically completely rewritten and is now more usable for general flow
manipulation.

This also adds a debug mode that just outputs the json fragments that
would be sent to ryu. At the moment, Ryu still assumes that every
request that it receives succeeds - it is not possible to get an error
message from the controller. Instead, one has to check if a flow was
added by doing a second REST request. Which seems unnecessary, and also
requires complete json parsing functionality. Hence we are not doing
that at the moment.

The alternative would be to use an external script for the actual
add-and-check-operation.
2015-04-07 15:37:46 -07:00
Johanna Amann
4195a0066a move the json stuff into utils - I guess we will need functionality like
this not just for openflow at some point of time.
2015-04-07 10:43:36 -07:00
Johanna Amann
fe5408e676 as a first step, restructure things a bit and remove the site scripts
users have to suply
2015-04-06 15:08:08 -07:00
Christian Struck
d80cc9ea10 [ADD] reworked code to new design suggested by seth.
The openflow framework now supports multiple
controllers. The design now looks a bit object
oriented and a new() function creates a controller
record.

Moved the JSON script from the JSON namespace into a
openflow specific OpenflowJSON namespace
2014-11-13 16:49:50 -08:00
Christian Struck
fef8476690 [FIX] small codestyle changes 2014-11-10 16:49:20 -08:00
Christian Struck
8e2c269c2e [ADD] status function to get flows from switch, error handling.
Added a function to receive status from the switch through the
openflow controller. (not yet implemented anywhere)

The flow_mod and flow_stats function now have default values which
report that the function is not implemented when they're called but
no plugin has registered its functions for them.
2014-11-06 15:53:09 -08:00
Christian Struck
c705375537 [ADD] made code event based, changed code style
the openflow framework does now use events to signal
the success or failure of openflow commands, further
the reporter framework is used to log errors.

added bro unique cookie, so the framework can recognize
which flows it installed and which not.

documented all of the code.

the code style should now me more like the rest of the
bro code.
2014-10-30 18:12:55 -07:00
Christian Struck
bf6dc12be4 [ADD] the possibility to remove flows and refactored the flow_mod function to fit the new capabilities. Also started to comment more of the code 2014-10-23 18:20:40 -07:00
Christian Struck
6c2a8cdff4 Seth's *any type* to JSON converter, slightly changed 2014-10-20 17:13:01 -07:00
Christian Struck
676207e968 Small implementation of the RYU restAPI functionality to add flows. 2014-10-20 17:10:49 -07:00
Christian Struck
d426f36ebe Small openflow api, that provides functionality to add flows. 2014-10-20 17:09:44 -07:00