mirror of
https://github.com/zeek/zeek.git
synced 2025-10-14 04:28:20 +00:00
Only allow a single trace file (-r) or interface (-i) option on the command-line
This commit is contained in:
parent
2b2121be60
commit
f16f0360ff
17 changed files with 93 additions and 141 deletions
|
@ -35,17 +35,9 @@ function precompile_pcap_filter%(id: PcapFilterID, s: string%): bool
|
|||
|
||||
bool success = true;
|
||||
|
||||
const iosource::Manager::PktSrcList& pkt_srcs(iosource_mgr->GetPktSrcs());
|
||||
|
||||
for ( iosource::Manager::PktSrcList::const_iterator i = pkt_srcs.begin();
|
||||
i != pkt_srcs.end(); i++ )
|
||||
{
|
||||
iosource::PktSrc* ps = *i;
|
||||
|
||||
if ( ! ps->PrecompileFilter(id->ForceAsInt(),
|
||||
s->CheckString()) )
|
||||
success = false;
|
||||
}
|
||||
iosource::PktSrc* ps = iosource_mgr->GetPktSrc();
|
||||
if ( ps && ! ps->PrecompileFilter(id->ForceAsInt(), s->CheckString()) )
|
||||
success = false;
|
||||
|
||||
return val_mgr->GetBool(success);
|
||||
%}
|
||||
|
@ -72,16 +64,9 @@ function Pcap::install_pcap_filter%(id: PcapFilterID%): bool
|
|||
%{
|
||||
bool success = true;
|
||||
|
||||
const iosource::Manager::PktSrcList& pkt_srcs(iosource_mgr->GetPktSrcs());
|
||||
|
||||
for ( iosource::Manager::PktSrcList::const_iterator i = pkt_srcs.begin();
|
||||
i != pkt_srcs.end(); i++ )
|
||||
{
|
||||
iosource::PktSrc* ps = *i;
|
||||
|
||||
if ( ! ps->SetFilter(id->ForceAsInt()) )
|
||||
success = false;
|
||||
}
|
||||
iosource::PktSrc* ps = iosource_mgr->GetPktSrc();
|
||||
if ( ps && ! ps->SetFilter(id->ForceAsInt()) )
|
||||
success = false;
|
||||
|
||||
return val_mgr->GetBool(success);
|
||||
%}
|
||||
|
@ -102,13 +87,9 @@ function Pcap::install_pcap_filter%(id: PcapFilterID%): bool
|
|||
## uninstall_dst_net_filter
|
||||
function error%(%): string
|
||||
%{
|
||||
const iosource::Manager::PktSrcList& pkt_srcs(iosource_mgr->GetPktSrcs());
|
||||
|
||||
for ( iosource::Manager::PktSrcList::const_iterator i = pkt_srcs.begin();
|
||||
i != pkt_srcs.end(); i++ )
|
||||
iosource::PktSrc* ps = iosource_mgr->GetPktSrc();
|
||||
if ( ps )
|
||||
{
|
||||
iosource::PktSrc* ps = *i;
|
||||
|
||||
const char* err = ps->ErrorMsg();
|
||||
if ( *err )
|
||||
return new StringVal(err);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue