mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 14:48:21 +00:00
Merge remote-tracking branch 'origin/topic/jsiwek/reporter-fatal-bif'
* origin/topic/jsiwek/reporter-fatal-bif: Add a Reporter::fatal BIF.
This commit is contained in:
commit
1726aee4e9
4 changed files with 12 additions and 5 deletions
|
@ -393,10 +393,7 @@ event bro_init() &priority=10
|
||||||
for ( pi in policy )
|
for ( pi in policy )
|
||||||
{
|
{
|
||||||
if ( pi$priority < 0 || pi$priority > 10 )
|
if ( pi$priority < 0 || pi$priority > 10 )
|
||||||
{
|
Reporter::fatal("All Notice::PolicyItem priorities must be within 0 and 10");
|
||||||
print "All Notice::PolicyItem priorities must be within 0 and 10";
|
|
||||||
exit();
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( pi$priority !in tmp )
|
if ( pi$priority !in tmp )
|
||||||
tmp[pi$priority] = set();
|
tmp[pi$priority] = set();
|
||||||
|
|
|
@ -121,7 +121,7 @@ function install()
|
||||||
NOTICE([$note=Compile_Failure,
|
NOTICE([$note=Compile_Failure,
|
||||||
$msg=fmt("Compiling packet filter failed"),
|
$msg=fmt("Compiling packet filter failed"),
|
||||||
$sub=default_filter]);
|
$sub=default_filter]);
|
||||||
exit();
|
Reporter::fatal(fmt("Bad pcap filter '%s'", default_filter));
|
||||||
}
|
}
|
||||||
|
|
||||||
# Do an audit log for the packet filter.
|
# Do an audit log for the packet filter.
|
||||||
|
|
|
@ -28,3 +28,11 @@ function Reporter::error%(msg: string%): bool
|
||||||
reporter->PopLocation();
|
reporter->PopLocation();
|
||||||
return new Val(1, TYPE_BOOL);
|
return new Val(1, TYPE_BOOL);
|
||||||
%}
|
%}
|
||||||
|
|
||||||
|
function Reporter::fatal%(msg: string%): bool
|
||||||
|
%{
|
||||||
|
reporter->PushLocation(frame->GetCall()->GetLocationInfo());
|
||||||
|
reporter->FatalError("%s", msg->CheckString());
|
||||||
|
reporter->PopLocation();
|
||||||
|
return new Val(1, TYPE_BOOL);
|
||||||
|
%}
|
||||||
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
# @TEST-EXEC-FAIL: bro -r $TRACES/web.trace -f "bad filter"
|
||||||
|
# @TEST-EXEC: test -s .stderr
|
Loading…
Add table
Add a link
Reference in a new issue