mirror of
https://github.com/zeek/zeek.git
synced 2025-10-07 17:18:20 +00:00
Merge remote-tracking branch 'origin/topic/jsiwek/gh-532-improve-disable-analyzer'
Includes fix for potential iterator invalidation during iteration. * origin/topic/jsiwek/gh-532-improve-disable-analyzer: GH-532: improve disable_analyzer BIF
This commit is contained in:
commit
8ab0650c1e
15 changed files with 263 additions and 60 deletions
|
@ -205,6 +205,15 @@ analyzer::Analyzer* TCP_Analyzer::FindChild(Tag arg_tag)
|
|||
return 0;
|
||||
}
|
||||
|
||||
bool TCP_Analyzer::RemoveChildAnalyzer(ID id)
|
||||
{
|
||||
auto rval = analyzer::TransportLayerAnalyzer::RemoveChildAnalyzer(id);
|
||||
|
||||
if ( rval )
|
||||
return rval;
|
||||
|
||||
return RemoveChild(packet_children, id);
|
||||
}
|
||||
|
||||
void TCP_Analyzer::EnableReassembly()
|
||||
{
|
||||
|
@ -1209,8 +1218,28 @@ void TCP_Analyzer::DeliverPacket(int len, const u_char* data, bool is_orig,
|
|||
|
||||
// Handle child_packet analyzers. Note: This happens *after* the
|
||||
// packet has been processed and the TCP state updated.
|
||||
LOOP_OVER_GIVEN_CHILDREN(i, packet_children)
|
||||
(*i)->NextPacket(len, data, is_orig, rel_data_seq, ip, caplen);
|
||||
analyzer_list::iterator next;
|
||||
|
||||
for ( auto i = packet_children.begin(); i != packet_children.end(); /* nop */ )
|
||||
{
|
||||
auto child = *i;
|
||||
|
||||
if ( child->IsFinished() || child->Removing() )
|
||||
{
|
||||
if ( child->Removing() )
|
||||
child->Done();
|
||||
|
||||
DBG_LOG(DBG_ANALYZER, "%s deleted child %s",
|
||||
fmt_analyzer(this).c_str(), fmt_analyzer(child).c_str());
|
||||
i = packet_children.erase(i);
|
||||
delete child;
|
||||
}
|
||||
else
|
||||
{
|
||||
child->NextPacket(len, data, is_orig, rel_data_seq, ip, caplen);
|
||||
++i;
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! reassembling )
|
||||
ForwardPacket(len, data, is_orig, rel_data_seq, ip, caplen);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue