mirror of
https://github.com/zeek/zeek.git
synced 2025-10-05 16:18:19 +00:00
Move packet dumping to packet_mgr
This commit is contained in:
parent
8ece1cf484
commit
afdc08085f
4 changed files with 29 additions and 27 deletions
|
@ -8,6 +8,7 @@
|
|||
#include "Stats.h"
|
||||
#include "zeek/Sessions.h"
|
||||
#include "zeek/RunState.h"
|
||||
#include "iosource/PktDumper.h"
|
||||
|
||||
using namespace zeek::packet_analysis;
|
||||
|
||||
|
@ -95,8 +96,7 @@ void Manager::ProcessPacket(Packet* packet)
|
|||
bool dumped_packet = false;
|
||||
if ( packet->dump_packet || zeek::detail::record_all_packets )
|
||||
{
|
||||
// TODO: should this stay in Session?
|
||||
sessions->DumpPacket(packet);
|
||||
DumpPacket(packet);
|
||||
dumped_packet = true;
|
||||
}
|
||||
|
||||
|
@ -109,8 +109,7 @@ void Manager::ProcessPacket(Packet* packet)
|
|||
|
||||
// Check whether packet should be recorded based on session analysis
|
||||
if ( packet->dump_packet && ! dumped_packet )
|
||||
// TODO: should this stay in Session?
|
||||
sessions->DumpPacket(packet);
|
||||
DumpPacket(packet);
|
||||
}
|
||||
|
||||
bool Manager::ProcessInnerPacket(Packet* packet)
|
||||
|
@ -156,3 +155,19 @@ AnalyzerPtr Manager::InstantiateAnalyzer(const std::string& name)
|
|||
Tag tag = GetComponentTag(name);
|
||||
return tag ? InstantiateAnalyzer(tag) : nullptr;
|
||||
}
|
||||
|
||||
void Manager::DumpPacket(const Packet *pkt, int len)
|
||||
{
|
||||
if ( ! run_state::detail::pkt_dumper )
|
||||
return;
|
||||
|
||||
if ( len != 0 )
|
||||
{
|
||||
if ( (uint32_t)len > pkt->cap_len )
|
||||
reporter->Warning("bad modified caplen");
|
||||
else
|
||||
const_cast<Packet *>(pkt)->cap_len = len;
|
||||
}
|
||||
|
||||
run_state::detail::pkt_dumper->Dump(pkt);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue