bool snort_proto_id_set_by_ha : 1;
bool efd_flow : 1; // Indicate that current flow is an elephant flow
bool svc_event_generated : 1; // Set if FLOW_NO_SERVICE_EVENT was generated for this flow
+ bool retry_queued : 1; // Set if a packet was queued for retry for this flow
} flags;
FlowState flow_state;
#include "protocols/tcp.h"
#include "protocols/udp.h"
#include "protocols/vlan.h"
+#include "pub_sub/packet_events.h"
#include "stream/stream.h"
#include "utils/util.h"
}
p->filtering_state = flow->filtering_state;
update_stats(flow, p);
+ if (p->is_retry())
+ {
+ RetryPacketEvent retry_event(p);
+ DataBus::publish(PKT_RETRY_EVENT, retry_event);
+ flow->flags.retry_queued = false;
+ }
+ else if ( flow->flags.retry_queued and ( !p->is_cooked() or p->is_defrag() ) )
+ {
+ RetryPacketEvent retry_event(p);
+ DataBus::publish(PKT_RETRY_EVENT, retry_event);
+ if ( !retry_event.is_still_pending() )
+ flow->flags.retry_queued = false;
+ }
}
else
{
void Flow::flush(bool) { }
void Flow::reset(bool) { }
void Flow::free_flow_data() { }
+void DataBus::publish(const char*, DataEvent&, Flow*) { }
void DataBus::publish(const char*, const uint8_t*, unsigned, Flow*) { }
void DataBus::publish(const char*, Packet*, Flow*) { }
const SnortConfig* SnortConfig::get_conf() { return nullptr; }
size_t FlowCache::uni_ip_flows_size() const { return 0; }
size_t FlowCache::flows_size() const { return 0; }
void Flow::init(PktType) { }
+void DataBus::publish(const char*, DataEvent&, Flow*) { }
void DataBus::publish(const char*, const uint8_t*, unsigned, Flow*) { }
void DataBus::publish(const char*, Packet*, Flow*) { }
const SnortConfig* SnortConfig::get_conf() { return nullptr; }
PacketTracer::dump(p);
}
-void Analyzer::add_to_retry_queue(DAQ_Msg_h daq_msg)
+void Analyzer::add_to_retry_queue(DAQ_Msg_h daq_msg, Flow* flow)
{
retry_queue->put(daq_msg);
+ if (flow)
+ flow->flags.retry_queued = true;
}
/*
if (p->active->packet_retry_requested())
{
- add_to_retry_queue(p->daq_msg);
+ add_to_retry_queue(p->daq_msg, p->flow);
daq_stats.retries_queued++;
}
else
namespace snort
{
class AnalyzerCommand;
+class Flow;
class SFDAQInstance;
struct Packet;
struct SnortConfig;
bool process_rebuilt_packet(snort::Packet*, const DAQ_PktHdr_t*, const uint8_t* pkt, uint32_t pktlen);
SO_PUBLIC bool inspect_rebuilt(snort::Packet*);
void finalize_daq_message(DAQ_Msg_h, DAQ_Verdict);
- void add_to_retry_queue(DAQ_Msg_h);
+ void add_to_retry_queue(DAQ_Msg_h, snort::Flow*);
// Functions called by analyzer commands
void start();
http_request_body_event.h
netflow_event.h
opportunistic_tls_event.h
+ packet_events.h
reputation_events.h
rna_events.h
sip_events.h
--- /dev/null
+//--------------------------------------------------------------------------
+// Copyright (C) 2022-2022 Cisco and/or its affiliates. All rights reserved.
+//
+// This program is free software; you can redistribute it and/or modify it
+// under the terms of the GNU General Public License Version 2 as published
+// by the Free Software Foundation. You may not use, modify or distribute
+// this program under any other version of the GNU General Public License.
+//
+// This program is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this program; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+//--------------------------------------------------------------------------
+// packet_events.h author Ron Dempster <rdempste@cisco.com>
+
+#ifndef PACKET_EVENTS_H
+#define PACKET_EVENTS_H
+
+#include "framework/data_bus.h"
+
+// A retry packet is being processed
+#define PKT_RETRY_EVENT "retry_packet"
+
+namespace snort
+{
+
+class RetryPacketEvent : public DataEvent
+{
+public:
+ explicit RetryPacketEvent(const Packet* p) : pkt(p)
+ { }
+
+ const Packet* get_packet() const override
+ { return pkt; }
+
+ void set_still_pending()
+ { still_pending = true; }
+
+ bool is_still_pending() const
+ { return still_pending; }
+
+private:
+ const Packet* pkt;
+ bool still_pending = false;
+};
+
+}
+
+#endif
if ( cp->active->packet_retry_requested() )
{
tcpStats.held_packet_retries++;
- Analyzer::get_local_analyzer()->add_to_retry_queue(msg);
+ Analyzer::get_local_analyzer()->add_to_retry_queue(msg, cp->flow);
}
else
{