mirror of
https://github.com/zeek/zeek.git
synced 2025-10-12 19:48:20 +00:00
dump_packet & dump_current_packet better detect which file is being dumped to
This commit is contained in:
parent
f35eae2e7e
commit
1953c04581
1 changed files with 4 additions and 8 deletions
12
src/bro.bif
12
src/bro.bif
|
@ -29,7 +29,6 @@ using namespace std;
|
|||
TableType* var_sizes;
|
||||
|
||||
static iosource::PktDumper* addl_pkt_dumper = 0;
|
||||
static StringVal* open_file_dumper;
|
||||
|
||||
bro_int_t parse_int(const char*& fmt)
|
||||
{
|
||||
|
@ -3292,16 +3291,15 @@ function dump_current_packet%(file_name: string%) : bool
|
|||
{
|
||||
addl_pkt_dumper = iosource_mgr->OpenPktDumper(file_name->CheckString(), true);
|
||||
{
|
||||
else if ( addl_pkt_dumper && open_file_dumper != file_name)
|
||||
else if ( addl_pkt_dumper && addl_pkt_dumper->Path() != file_name->CheckString())
|
||||
{
|
||||
addl_pkt_dumper->Close();
|
||||
addl_pkt_dumper = iosource_mgr->OpenPktDumper(file_name->CheckString(), true);
|
||||
}
|
||||
// else if (addl_pkt_dumper && open_file_dumper == file_name) do nothing
|
||||
// else if (addl_pkt_dumper && addl_pkt_dumper->Path() == file_name->CheckString()) do nothing
|
||||
|
||||
if ( addl_pkt_dumper )
|
||||
{
|
||||
open_file_dumper = file_name;
|
||||
addl_pkt_dumper->Dump(pkt);
|
||||
}
|
||||
|
||||
|
@ -3376,17 +3374,15 @@ function dump_packet%(pkt: pcap_packet, file_name: string%) : bool
|
|||
{
|
||||
addl_pkt_dumper = iosource_mgr->OpenPktDumper(file_name->CheckString(), true);
|
||||
{
|
||||
else if ( addl_pkt_dumper && open_file_dumper != file_name)
|
||||
else if ( addl_pkt_dumper && addl_pkt_dumper->Path() != file_name->CheckString())
|
||||
{
|
||||
addl_pkt_dumper->Close();
|
||||
addl_pkt_dumper = iosource_mgr->OpenPktDumper(file_name->CheckString(), true);
|
||||
}
|
||||
// else if (addl_pkt_dumper && open_file_dumper == file_name) do nothing
|
||||
// else if (addl_pkt_dumper && addl_pkt_dumper->Path() == file_name->CheckString()) do nothing
|
||||
|
||||
if ( addl_pkt_dumper )
|
||||
{
|
||||
open_file_dumper = file_name;
|
||||
|
||||
pkt_timeval ts;
|
||||
uint32 caplen, len, link_type;
|
||||
u_char *data;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue