Squashed commit of the following:
commit
a2fec11b2fe6016bc4cc2c342c3db5e5ed3af3b4
Author: Serhii Vlasiuk <svlasiuk@cisco.com>
Date: Fri Jul 23 10:06:58 2021 +0300
framework: update base API version to 4
commit
4a3afcd4aeda61ac6ced9527582cee5601f2d6c7
Author: Serhii Vlasiuk <svlasiuk@cisco.com>
Date: Fri Jul 9 16:32:22 2021 +0300
actions: session data stay accessible for loggers for reject rule action
Reject action does reset session. Reset session includes drop flow in particular
destruct HttpFlowData object. Alerts may include addiotional information from flow
in case of unified2 events it aggregates http headers. To avoid bad access exceptions,
flow data should be available in place of generating alerts and cleaned up after.
void RejectAction::exec(Packet* p, const OptTreeNode* otn)
{
- p->active->reset_session(p, get_active_action());
+ p->active->update_reset_status(p, false);
if ( otn )
Actions::alert(p, otn);
+
+ p->active->reset_session(p, get_active_action(), false, true);
}
//-------------------------------------------------------------------------
// this is the current version of the base api
// must be prefixed to subtype version
-#define BASE_API_VERSION 3
+#define BASE_API_VERSION 4
// set options to API_OPTIONS to ensure compatibility
#ifndef API_OPTIONS
reset_session(p, &default_reset, force);
}
-void Active::reset_session(Packet* p, ActiveAction* reject, bool force)
+void Active::update_reset_status(Packet* p, bool force)
{
active_action = ACT_RESET;
update_status(p, force);
+}
- if ( force or (p->context->conf->inline_mode() and SFDAQ::forwarding_packet(p->pkth)))
+void Active::reset_session(Packet* p, ActiveAction* reject, bool force, bool skip_update_status)
+{
+ if ( !skip_update_status )
+ update_reset_status(p, force);
+
+ if ( force or (p->context->conf->inline_mode() and SFDAQ::forwarding_packet(p->pkth)) )
Stream::drop_flow(p);
if (reject)
void trust_session(Packet*, bool force = false);
void block_session(Packet*, bool force = false);
void reset_session(Packet*, bool force = false);
- void reset_session(Packet*, snort::ActiveAction* r, bool force = false);
+ void reset_session(Packet*, snort::ActiveAction* r, bool force = false,
+ bool skip_update_status = false);
+ void update_reset_status(Packet*, bool force);
static void queue(snort::ActiveAction* a, snort::Packet* p);
static void clear_queue(snort::Packet*);