mirror of
https://github.com/zeek/zeek.git
synced 2025-10-07 17:18:20 +00:00
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.
This commit is contained in:
parent
b5050437fa
commit
dfed213f31
19 changed files with 62 additions and 29 deletions
10
CHANGES
10
CHANGES
|
@ -1,4 +1,14 @@
|
||||||
|
|
||||||
|
2.6-377 | 2019-06-05 16:15:58 -0700
|
||||||
|
|
||||||
|
* Deprecate functions with "bro" in them. (Jon Siwek, Corelight)
|
||||||
|
|
||||||
|
* "bro_is_terminating" is now "zeek_is_terminating"
|
||||||
|
|
||||||
|
* "bro_version" is now "zeek_version"
|
||||||
|
|
||||||
|
The old functions still exist for now, but are deprecated.
|
||||||
|
|
||||||
2.6-376 | 2019-06-05 13:29:57 -0700
|
2.6-376 | 2019-06-05 13:29:57 -0700
|
||||||
|
|
||||||
* GH-379: move catch-and-release and unified2 scripts to policy/ (Jon Siwek, Corelight)
|
* GH-379: move catch-and-release and unified2 scripts to policy/ (Jon Siwek, Corelight)
|
||||||
|
|
3
NEWS
3
NEWS
|
@ -361,6 +361,9 @@ Deprecated Functionality
|
||||||
such that existing code will not break, but will emit a deprecation
|
such that existing code will not break, but will emit a deprecation
|
||||||
warning.
|
warning.
|
||||||
|
|
||||||
|
- The ``bro_is_terminating`` and ``bro_version`` function are deprecated and
|
||||||
|
replaced by functions named ``zeek_is_terminating`` and ``zeek_version``.
|
||||||
|
|
||||||
- The ``rotate_file``, ``rotate_file_by_name`` and ``calc_next_rotate`` functions
|
- The ``rotate_file``, ``rotate_file_by_name`` and ``calc_next_rotate`` functions
|
||||||
were marked as deprecated. These functions were used with the old pre-2.0 logging
|
were marked as deprecated. These functions were used with the old pre-2.0 logging
|
||||||
framework and are no longer used. They also were marked as deprecated in their
|
framework and are no longer used. They also were marked as deprecated in their
|
||||||
|
|
2
VERSION
2
VERSION
|
@ -1 +1 @@
|
||||||
2.6-376
|
2.6-377
|
||||||
|
|
2
doc
2
doc
|
@ -1 +1 @@
|
||||||
Subproject commit 09d21c86c3f68b1fde426fe93d0b044ca839b968
|
Subproject commit 69a337c5c7958014566f138bfbce9ce95db47b3d
|
|
@ -889,7 +889,7 @@ function remove_rule_impl(id: string, reason: string) : bool
|
||||||
function rule_expire_impl(r: Rule, p: PluginState) &priority=-5
|
function rule_expire_impl(r: Rule, p: PluginState) &priority=-5
|
||||||
{
|
{
|
||||||
# do not emit timeout events on shutdown
|
# do not emit timeout events on shutdown
|
||||||
if ( bro_is_terminating() )
|
if ( zeek_is_terminating() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if ( r$id !in rules )
|
if ( r$id !in rules )
|
||||||
|
|
|
@ -405,7 +405,7 @@ function email_headers(subject_desc: string, dest: string): string
|
||||||
"From: ", mail_from, "\n",
|
"From: ", mail_from, "\n",
|
||||||
"Subject: ", mail_subject_prefix, " ", subject_desc, "\n",
|
"Subject: ", mail_subject_prefix, " ", subject_desc, "\n",
|
||||||
"To: ", dest, "\n",
|
"To: ", dest, "\n",
|
||||||
"User-Agent: Bro-IDS/", bro_version(), "\n");
|
"User-Agent: Bro-IDS/", zeek_version(), "\n");
|
||||||
if ( reply_to != "" )
|
if ( reply_to != "" )
|
||||||
header_text = string_cat(header_text, "Reply-To: ", reply_to, "\n");
|
header_text = string_cat(header_text, "Reply-To: ", reply_to, "\n");
|
||||||
return header_text;
|
return header_text;
|
||||||
|
|
|
@ -11,7 +11,7 @@ const COOKIE_BID_SIZE = 16777216;
|
||||||
# start at bit 40 (1 << 40)
|
# start at bit 40 (1 << 40)
|
||||||
const COOKIE_BID_START = 1099511627776;
|
const COOKIE_BID_START = 1099511627776;
|
||||||
# Zeek specific cookie ID shall have the 42 bit set (1 << 42)
|
# Zeek specific cookie ID shall have the 42 bit set (1 << 42)
|
||||||
const BRO_COOKIE_ID = 4;
|
const ZEEK_COOKIE_ID = 4;
|
||||||
# 8 bits group identifier
|
# 8 bits group identifier
|
||||||
const COOKIE_GID_SIZE = 256;
|
const COOKIE_GID_SIZE = 256;
|
||||||
# start at bit 32 (1 << 32)
|
# start at bit 32 (1 << 32)
|
||||||
|
|
|
@ -198,7 +198,7 @@ function match_conn(id: conn_id, reverse: bool &default=F): ofp_match
|
||||||
# 42 bit of the cookie set.
|
# 42 bit of the cookie set.
|
||||||
function generate_cookie(cookie: count &default=0): count
|
function generate_cookie(cookie: count &default=0): count
|
||||||
{
|
{
|
||||||
local c = BRO_COOKIE_ID * COOKIE_BID_START;
|
local c = ZEEK_COOKIE_ID * COOKIE_BID_START;
|
||||||
|
|
||||||
if ( cookie >= COOKIE_UID_SIZE )
|
if ( cookie >= COOKIE_UID_SIZE )
|
||||||
Reporter::warning(fmt("The given cookie uid '%d' is > 32bit and will be discarded", cookie));
|
Reporter::warning(fmt("The given cookie uid '%d' is > 32bit and will be discarded", cookie));
|
||||||
|
@ -211,7 +211,7 @@ function generate_cookie(cookie: count &default=0): count
|
||||||
# local function to check if a given flow_mod cookie is forged from this framework.
|
# local function to check if a given flow_mod cookie is forged from this framework.
|
||||||
function is_valid_cookie(cookie: count): bool
|
function is_valid_cookie(cookie: count): bool
|
||||||
{
|
{
|
||||||
if ( cookie / COOKIE_BID_START == BRO_COOKIE_ID )
|
if ( cookie / COOKIE_BID_START == ZEEK_COOKIE_ID )
|
||||||
return T;
|
return T;
|
||||||
|
|
||||||
Reporter::warning(fmt("The given Openflow cookie '%d' is not valid", cookie));
|
Reporter::warning(fmt("The given Openflow cookie '%d' is not valid", cookie));
|
||||||
|
@ -231,7 +231,7 @@ function get_cookie_gid(cookie: count): count
|
||||||
{
|
{
|
||||||
if( is_valid_cookie(cookie) )
|
if( is_valid_cookie(cookie) )
|
||||||
return (
|
return (
|
||||||
(cookie - (COOKIE_BID_START * BRO_COOKIE_ID) -
|
(cookie - (COOKIE_BID_START * ZEEK_COOKIE_ID) -
|
||||||
(cookie - ((cookie / COOKIE_GID_START) * COOKIE_GID_START))) /
|
(cookie - ((cookie / COOKIE_GID_START) * COOKIE_GID_START))) /
|
||||||
COOKIE_GID_START
|
COOKIE_GID_START
|
||||||
);
|
);
|
||||||
|
|
|
@ -89,7 +89,7 @@ export {
|
||||||
## Opaque controller-issued identifier.
|
## Opaque controller-issued identifier.
|
||||||
# This is optional in the specification - but let's force
|
# This is optional in the specification - but let's force
|
||||||
# it so we always can identify our flows...
|
# it so we always can identify our flows...
|
||||||
cookie: count; # &default=BRO_COOKIE_ID * COOKIE_BID_START;
|
cookie: count; # &default=ZEEK_COOKIE_ID * COOKIE_BID_START;
|
||||||
# Flow actions
|
# Flow actions
|
||||||
## Table to put the flow in. OFPTT_ALL can be used for delete,
|
## Table to put the flow in. OFPTT_ALL can be used for delete,
|
||||||
## to delete flows from all matching tables.
|
## to delete flows from all matching tables.
|
||||||
|
|
|
@ -35,7 +35,7 @@ event SumStats::finish_epoch(ss: SumStat)
|
||||||
{
|
{
|
||||||
local data = result_store[ss$name];
|
local data = result_store[ss$name];
|
||||||
local now = network_time();
|
local now = network_time();
|
||||||
if ( bro_is_terminating() )
|
if ( zeek_is_terminating() )
|
||||||
{
|
{
|
||||||
for ( key, val in data )
|
for ( key, val in data )
|
||||||
ss$epoch_result(now, key, val);
|
ss$epoch_result(now, key, val);
|
||||||
|
|
|
@ -78,10 +78,10 @@ export {
|
||||||
## The format of the number is ABBCC with A being the major version,
|
## The format of the number is ABBCC with A being the major version,
|
||||||
## bb being the minor version (2 digits) and CC being the patchlevel (2 digits).
|
## bb being the minor version (2 digits) and CC being the patchlevel (2 digits).
|
||||||
## As an example, Zeek 2.4.1 results in the number 20401
|
## As an example, Zeek 2.4.1 results in the number 20401
|
||||||
const number = Version::parse(bro_version())$version_number;
|
const number = Version::parse(zeek_version())$version_number;
|
||||||
|
|
||||||
## `VersionDescription` record pertaining to the currently running version of Zeek.
|
## `VersionDescription` record pertaining to the currently running version of Zeek.
|
||||||
const info = Version::parse(bro_version());
|
const info = Version::parse(zeek_version());
|
||||||
}
|
}
|
||||||
|
|
||||||
function at_least(version_string: string): bool
|
function at_least(version_string: string): bool
|
||||||
|
|
|
@ -141,7 +141,7 @@ function join_data_expiration(t: table[count] of Info, idx: count): interval
|
||||||
# Also, if Zeek is shutting down.
|
# Also, if Zeek is shutting down.
|
||||||
if ( (now - info$last_message_ts) > 5sec ||
|
if ( (now - info$last_message_ts) > 5sec ||
|
||||||
(now - info$ts) > max_txid_watch_time ||
|
(now - info$ts) > max_txid_watch_time ||
|
||||||
bro_is_terminating() )
|
zeek_is_terminating() )
|
||||||
{
|
{
|
||||||
Log::write(LOG, info);
|
Log::write(LOG, info);
|
||||||
|
|
||||||
|
|
|
@ -99,7 +99,7 @@ event check_stats(then: time, last_ns: NetStats, last_cs: ConnStats, last_ps: Pr
|
||||||
local fs = get_file_analysis_stats();
|
local fs = get_file_analysis_stats();
|
||||||
local ds = get_dns_stats();
|
local ds = get_dns_stats();
|
||||||
|
|
||||||
if ( bro_is_terminating() )
|
if ( zeek_is_terminating() )
|
||||||
# No more stats will be written or scheduled when Zeek is
|
# No more stats will be written or scheduled when Zeek is
|
||||||
# shutting down.
|
# shutting down.
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -17,7 +17,7 @@ export {
|
||||||
|
|
||||||
event TrimTraceFile::go(first_trim: bool)
|
event TrimTraceFile::go(first_trim: bool)
|
||||||
{
|
{
|
||||||
if ( bro_is_terminating() || trace_output_file == "" )
|
if ( zeek_is_terminating() || trace_output_file == "" )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if ( ! first_trim )
|
if ( ! first_trim )
|
||||||
|
|
36
src/bro.bif
36
src/bro.bif
|
@ -1735,15 +1735,24 @@ function getpid%(%) : count
|
||||||
%}
|
%}
|
||||||
|
|
||||||
%%{
|
%%{
|
||||||
extern const char* bro_version();
|
extern const char* zeek_version();
|
||||||
%%}
|
%%}
|
||||||
|
|
||||||
## Returns the Bro version string.
|
## Returns the Zeek version string. This function is deprecated, use
|
||||||
|
## :zeek:see:`zeek_version` instead.
|
||||||
##
|
##
|
||||||
## Returns: Bro's version, e.g., 2.0-beta-47-debug.
|
## Returns: Zeek's version, e.g., 2.0-beta-47-debug.
|
||||||
function bro_version%(%): string
|
function bro_version%(%): string &deprecated
|
||||||
%{
|
%{
|
||||||
return new StringVal(bro_version());
|
return new StringVal(zeek_version());
|
||||||
|
%}
|
||||||
|
|
||||||
|
## Returns the Zeek version string.
|
||||||
|
##
|
||||||
|
## Returns: Zeek's version, e.g., 2.0-beta-47-debug.
|
||||||
|
function zeek_version%(%): string
|
||||||
|
%{
|
||||||
|
return new StringVal(zeek_version());
|
||||||
%}
|
%}
|
||||||
|
|
||||||
## Converts a record type name to a vector of strings, where each element is
|
## Converts a record type name to a vector of strings, where each element is
|
||||||
|
@ -2068,12 +2077,23 @@ function dump_rule_stats%(f: file%): bool
|
||||||
return val_mgr->GetBool(1);
|
return val_mgr->GetBool(1);
|
||||||
%}
|
%}
|
||||||
|
|
||||||
## Checks if Bro is terminating.
|
## Checks if Zeek is terminating. This function is deprecated, use
|
||||||
|
## :zeek:see:`zeek_is_terminating` instead.
|
||||||
##
|
##
|
||||||
## Returns: True if Bro is in the process of shutting down.
|
## Returns: True if Zeek is in the process of shutting down.
|
||||||
##
|
##
|
||||||
## .. zeek:see:: terminate
|
## .. zeek:see:: terminate
|
||||||
function bro_is_terminating%(%): bool
|
function bro_is_terminating%(%): bool &deprecated
|
||||||
|
%{
|
||||||
|
return val_mgr->GetBool(terminating);
|
||||||
|
%}
|
||||||
|
|
||||||
|
## Checks if Zeek is terminating.
|
||||||
|
##
|
||||||
|
## Returns: True if Zeek is in the process of shutting down.
|
||||||
|
##
|
||||||
|
## .. zeek:see:: terminate
|
||||||
|
function zeek_is_terminating%(%): bool
|
||||||
%{
|
%{
|
||||||
return val_mgr->GetBool(terminating);
|
return val_mgr->GetBool(terminating);
|
||||||
%}
|
%}
|
||||||
|
|
|
@ -127,7 +127,7 @@ OpaqueType* ocsp_resp_opaque_type = 0;
|
||||||
int bro_argc;
|
int bro_argc;
|
||||||
char** bro_argv;
|
char** bro_argv;
|
||||||
|
|
||||||
const char* bro_version()
|
const char* zeek_version()
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
static char* debug_version = 0;
|
static char* debug_version = 0;
|
||||||
|
@ -152,7 +152,7 @@ bool bro_dns_fake()
|
||||||
|
|
||||||
void usage(int code = 1)
|
void usage(int code = 1)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "bro version %s\n", bro_version());
|
fprintf(stderr, "zeek version %s\n", zeek_version());
|
||||||
fprintf(stderr, "usage: %s [options] [file ...]\n", prog);
|
fprintf(stderr, "usage: %s [options] [file ...]\n", prog);
|
||||||
fprintf(stderr, " <file> | policy file, or read stdin\n");
|
fprintf(stderr, " <file> | policy file, or read stdin\n");
|
||||||
fprintf(stderr, " -a|--parse-only | exit immediately after parsing scripts\n");
|
fprintf(stderr, " -a|--parse-only | exit immediately after parsing scripts\n");
|
||||||
|
@ -569,7 +569,7 @@ int main(int argc, char** argv)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'v':
|
case 'v':
|
||||||
fprintf(stdout, "%s version %s\n", prog, bro_version());
|
fprintf(stdout, "%s version %s\n", prog, zeek_version());
|
||||||
exit(0);
|
exit(0);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -69,7 +69,7 @@ extern const char* hook_name(HookType h);
|
||||||
struct VersionNumber {
|
struct VersionNumber {
|
||||||
int major; //< Major version number.
|
int major; //< Major version number.
|
||||||
int minor; //< Minor version number.
|
int minor; //< Minor version number.
|
||||||
int patch; //< Patch version number (available since Bro 2.7).
|
int patch; //< Patch version number (available since Zeek 3.0).
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor.
|
* Constructor.
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
event zeek_init()
|
event zeek_init()
|
||||||
{
|
{
|
||||||
local a = bro_version();
|
local a = zeek_version();
|
||||||
if ( |a| == 0 )
|
if ( |a| == 0 )
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
|
@ -22,7 +22,7 @@ print Version::parse("1.12-beta-drunk");
|
||||||
print Version::parse("JustARandomString");
|
print Version::parse("JustARandomString");
|
||||||
|
|
||||||
# check that current running version of Zeek parses without error
|
# check that current running version of Zeek parses without error
|
||||||
Version::parse(bro_version());
|
Version::parse(zeek_version());
|
||||||
|
|
||||||
@TEST-START-NEXT
|
@TEST-START-NEXT
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue