Change Sessions::dump_this_packet to a bool

This commit is contained in:
Tim Wojtulewicz 2020-04-01 10:46:06 -07:00
parent 3ce1c9ffd6
commit 0d695ac453
2 changed files with 8 additions and 8 deletions

View file

@ -79,7 +79,7 @@ NetSessions::NetSessions()
packet_filter = 0; packet_filter = 0;
dump_this_packet = 0; dump_this_packet = false;
num_packets_processed = 0; num_packets_processed = 0;
if ( pkt_profile_mode && pkt_profile_freq > 0 && pkt_profile_file ) if ( pkt_profile_mode && pkt_profile_freq > 0 && pkt_profile_file )
@ -130,7 +130,7 @@ void NetSessions::NextPacket(double t, const Packet* pkt)
++num_packets_processed; ++num_packets_processed;
dump_this_packet = 0; dump_this_packet = false;
if ( record_all_packets ) if ( record_all_packets )
DumpPacket(pkt); DumpPacket(pkt);
@ -265,7 +265,7 @@ void NetSessions::DoNextPacket(double t, const Packet* pkt, const IP_Hdr* ip_hdr
if ( ip_hdr->IsFragment() ) if ( ip_hdr->IsFragment() )
{ {
dump_this_packet = 1; // always record fragments dump_this_packet = true; // always record fragments
if ( caplen < len ) if ( caplen < len )
{ {
@ -308,7 +308,7 @@ void NetSessions::DoNextPacket(double t, const Packet* pkt, const IP_Hdr* ip_hdr
// there, it's always the last. // there, it's always the last.
if ( ip_hdr->LastHeader() == IPPROTO_ESP ) if ( ip_hdr->LastHeader() == IPPROTO_ESP )
{ {
dump_this_packet = 1; dump_this_packet = true;
if ( esp_packet ) if ( esp_packet )
mgr.Enqueue(esp_packet, IntrusivePtr{AdoptRef{}, ip_hdr->BuildPktHdrVal()}); mgr.Enqueue(esp_packet, IntrusivePtr{AdoptRef{}, ip_hdr->BuildPktHdrVal()});
@ -321,7 +321,7 @@ void NetSessions::DoNextPacket(double t, const Packet* pkt, const IP_Hdr* ip_hdr
// last if present. // last if present.
if ( ip_hdr->LastHeader() == IPPROTO_MOBILITY ) if ( ip_hdr->LastHeader() == IPPROTO_MOBILITY )
{ {
dump_this_packet = 1; dump_this_packet = true;
if ( ! ignore_checksums && mobility_header_checksum(ip_hdr) != 0xffff ) if ( ! ignore_checksums && mobility_header_checksum(ip_hdr) != 0xffff )
{ {
@ -710,7 +710,7 @@ void NetSessions::DoNextPacket(double t, const Packet* pkt, const IP_Hdr* ip_hdr
else if ( record_packet ) else if ( record_packet )
{ {
if ( record_content ) if ( record_content )
dump_this_packet = 1; // save the whole thing dump_this_packet = true; // save the whole thing
else else
{ {
@ -1287,7 +1287,7 @@ void NetSessions::Weird(const char* name, const Packet* pkt,
const EncapsulationStack* encap, const char* addl) const EncapsulationStack* encap, const char* addl)
{ {
if ( pkt ) if ( pkt )
dump_this_packet = 1; dump_this_packet = true;
if ( encap && encap->LastType() != BifEnum::Tunnel::NONE ) if ( encap && encap->LastType() != BifEnum::Tunnel::NONE )
reporter->Weird(fmt("%s_in_tunnel", name), addl); reporter->Weird(fmt("%s_in_tunnel", name), addl);

View file

@ -231,9 +231,9 @@ protected:
analyzer::stepping_stone::SteppingStoneManager* stp_manager; analyzer::stepping_stone::SteppingStoneManager* stp_manager;
Discarder* discarder; Discarder* discarder;
PacketFilter* packet_filter; PacketFilter* packet_filter;
int dump_this_packet; // if true, current packet should be recorded
uint64_t num_packets_processed; uint64_t num_packets_processed;
PacketProfiler* pkt_profiler; PacketProfiler* pkt_profiler;
bool dump_this_packet; // if true, current packet should be recorded
}; };