Allow BRO_DEFAULT_LISTEN_ADDRESS to control broker listen address

This environment variable is now set to listen only on IPv4 loopback
when running unit tests (instead of using the default INADDR_ANY).

This also moves some of the @loads out from init-bare.bro into a new
init-frameworks-and-bifs.bro in order to better support calling BIFs
(like `getenv`) from variable initializations in those particular
frameworks.
This commit is contained in:
Jon Siwek 2018-06-01 15:38:11 -05:00
parent 55f14c2eb8
commit 1b4e0116f4
10 changed files with 76 additions and 40 deletions

View file

@ -14,7 +14,7 @@ export {
## Default address on which to listen.
##
## .. bro:see:: Broker::listen
const default_listen_address = "" &redef;
const default_listen_address = getenv("BRO_DEFAULT_LISTEN_ADDRESS") &redef;
## Default interval to retry connecting to a peer if it cannot be made to work
## initially, or if it ever becomes disconnected.

View file

@ -1,4 +1,4 @@
@load base/bif/const.bif.bro
@load base/bif/const.bif
@load base/bif/types.bif
# Type declarations
@ -1797,9 +1797,11 @@ type gtp_delete_pdp_ctx_response_elements: record {
};
# Prototypes of Bro built-in functions.
@load base/bif/strings.bif
@load base/bif/bro.bif
@load base/bif/stats.bif
@load base/bif/reporter.bif
@load base/bif/strings.bif
@load base/bif/option.bif
## Deprecated. This is superseded by the new logging framework.
global log_file_name: function(tag: string): string &redef;
@ -4822,17 +4824,3 @@ const global_hash_seed: string = "" &redef;
## files. The larger the value, the more confidence in UID uniqueness.
## The maximum is currently 128 bits.
const bits_per_uid: count = 96 &redef;
# Load these frameworks here because they use fairly deep integration with
# BiFs and script-land defined types.
@load base/frameworks/logging
@load base/frameworks/broker
@load base/frameworks/input
@load base/frameworks/analyzer
@load base/frameworks/files
@load base/bif
# Load BiFs defined by plugins.
@load base/bif/plugins

View file

@ -0,0 +1,15 @@
# Load these frameworks here because they use fairly deep integration with
# BiFs and script-land defined types. They are also more likely to
# make use of calling BIFs for variable initializations, and that
# can't be done until init-bare.bro has been loaded completely (hence
# the separate file).
@load base/frameworks/logging
@load base/frameworks/broker
@load base/frameworks/input
@load base/frameworks/analyzer
@load base/frameworks/files
@load base/bif
# Load BiFs defined by plugins.
@load base/bif/plugins