+128
+-- fixed RangeCheck
+-- doc tweaks, defined peg count
+-- ensure fp_length / fp_offset are applied correctly
+-- allow \a\b\f\n\r\t\v in content strings
+-- fixed capture for prune counts
+
127
-- REG_TEST out logging tcp options for rebuilt packets to match snort bug
-- tweaked S5_TRACE output for consistency
-- added stream_tcp.segs_split peg
-- snort2lua patch
-- changed from 2.10 to 3.0
--- fixed RangeCheck
--- doc tweaks, defined peg count
--- ensure fp_length / fp_offset are applied correctly
--- allow \a\b\f\n\r\t\v in content strings
126
-- pulled latest from tom
static THREAD_LOCAL PegCount icmp_count = 0;
static THREAD_LOCAL PegCount ip_count = 0;
-PegCount FlowControl::get_flow_count(uint8_t proto)
+uint32_t FlowControl::max_flows(uint8_t proto)
+{
+ FlowCache* cache = get_cache(proto);
+
+ if ( cache )
+ return cache->get_max_flows();
+
+ return 0;
+}
+
+PegCount FlowControl::get_prunes (uint8_t proto)
+{
+ FlowCache* cache = get_cache(proto);
+ return cache ? cache->get_prunes() : 0;
+}
+
+PegCount FlowControl::get_flows(uint8_t proto)
{
switch ( proto )
{
+ // FIXIT should be using an enum for these
case IPPROTO_TCP: return tcp_count;
case IPPROTO_UDP: return udp_count;
case IPPROTO_ICMP: return icmp_count;
}
}
-void FlowControl::clear_flow_counts()
+void FlowControl::clear_counts()
{
tcp_count = udp_count = 0;
icmp_count = ip_count = 0;
+
+ FlowCache* cache;
+
+ if ( (cache = get_cache(IPPROTO_IP)) )
+ cache->reset_prunes();
+
+ if ( (cache = get_cache(IPPROTO_ICMP)) )
+ cache->reset_prunes();
+
+ if ( (cache = get_cache(IPPROTO_TCP)) )
+ cache->reset_prunes();
+
+ if ( (cache = get_cache(IPPROTO_UDP)) )
+ cache->reset_prunes();
}
//-------------------------------------------------------------------------
Active_Resume();
}
-uint32_t FlowControl::max_flows(uint8_t proto)
-{
- FlowCache* cache = get_cache(proto);
-
- if ( cache )
- return cache->get_max_flows();
-
- return 0;
-}
-
-void FlowControl::get_prunes (uint8_t proto, PegCount& prunes)
-{
- FlowCache* cache = get_cache(proto);
-
- if ( cache )
- prunes = cache->get_prunes();
-}
-
-void FlowControl::reset_prunes (uint8_t proto)
-{
- FlowCache* cache = get_cache(proto);
-
- if ( cache )
- cache->reset_prunes();
-}
-
//-------------------------------------------------------------------------
// packet foo
//-------------------------------------------------------------------------
FlowData*);
uint32_t max_flows(uint8_t proto);
- void get_prunes(uint8_t proto, PegCount&);
- void reset_prunes(uint8_t proto);
- PegCount get_flow_count(uint8_t);
- void clear_flow_counts();
+ PegCount get_prunes(uint8_t);
+ PegCount get_flows(uint8_t);
+ void clear_counts();
private:
class FlowCache* get_cache(uint8_t);
#ifdef PPM_MGR
ppm_sum_stats();
#endif
- InspectorManager::thread_term(snort_conf);
+ InspectorManager::thread_stop(snort_conf);
ModuleManager::accumulate(snort_conf);
+ InspectorManager::thread_term(snort_conf);
ActionManager::thread_term(snort_conf);
IpsManager::clear_options();
}
}
-void InspectorManager::thread_term(SnortConfig* sc)
+void InspectorManager::thread_stop(SnortConfig*)
{
// pin->tterm() only called for default policy
set_default_policy();
p->pp_class.init = true;
}
}
+}
+void InspectorManager::thread_term(SnortConfig* sc)
+{
for ( auto* p : sc->framework_config->clist )
{
if ( p->api.tterm )
static void print_config(SnortConfig*);
static void thread_init(SnortConfig*);
+ static void thread_stop(SnortConfig*);
static void thread_term(SnortConfig*);
static void release_policy(FrameworkPolicy*);
sp_ctor,
sp_dtor,
nullptr, // ssn
- sp_reset
+ sp_reset // FIXIT-L only inspector using this, eliminate?
};
#ifdef BUILDING_SO
struct BaseStats
{
- PegCount tcp;
- PegCount udp;
- PegCount icmp;
- PegCount ip;
+ PegCount tcp_flows;
+ PegCount tcp_prunes;
+
+ PegCount udp_flows;
+ PegCount udp_prunes;
+
+ PegCount icmp_flows;
+ PegCount icmp_prunes;
+
+ PegCount ip_flows;
+ PegCount ip_prunes;
};
static BaseStats g_stats;
static const char* const base_pegs[] =
{
"tcp flows",
+ "tcp prunes",
"udp flows",
+ "udp prunes",
"icmp flows",
- "ip flows"
+ "icmp prunes",
+ "ip flows",
+ "ip prunes"
};
void base_sum()
{
- t_stats.tcp = flow_con->get_flow_count(IPPROTO_TCP);
- t_stats.udp = flow_con->get_flow_count(IPPROTO_UDP);
- t_stats.icmp = flow_con->get_flow_count(IPPROTO_ICMP);
- t_stats.ip = flow_con->get_flow_count(IPPROTO_IP);
+ t_stats.tcp_flows = flow_con->get_flows(IPPROTO_TCP);
+ t_stats.tcp_prunes = flow_con->get_prunes(IPPROTO_TCP);
+
+ t_stats.udp_flows = flow_con->get_flows(IPPROTO_UDP);
+ t_stats.udp_prunes = flow_con->get_prunes(IPPROTO_UDP);
+
+ t_stats.icmp_flows = flow_con->get_flows(IPPROTO_ICMP);
+ t_stats.icmp_prunes = flow_con->get_prunes(IPPROTO_ICMP);
+
+ t_stats.ip_flows = flow_con->get_flows(IPPROTO_IP);
+ t_stats.ip_prunes = flow_con->get_prunes(IPPROTO_IP);
sum_stats((PegCount*)&g_stats, (PegCount*)&t_stats,
array_size(base_pegs));
void base_reset()
{
- flow_con->clear_flow_counts();
+ flow_con->clear_counts();
memset(&t_stats, 0, sizeof(t_stats));
}
flow_con->purge_flows(IPPROTO_UDP);
flow_con->purge_flows(IPPROTO_ICMP);
flow_con->purge_flows(IPPROTO_IP);
-
- delete flow_con;
- flow_con = nullptr;
}
void StreamBase::show(SnortConfig*)
delete p;
}
+void base_tterm()
+{
+ delete flow_con;
+ flow_con = nullptr;
+}
+
static const InspectApi base_api =
{
{
nullptr, // init
nullptr, // term
nullptr, // tinit
- nullptr, // tterm
+ base_tterm,
base_ctor,
base_dtor,
nullptr, // ssn
icmp_responder_ip = tmpIp;
}
-//-------------------------------------------------------------------------
-// api related methods
-//-------------------------------------------------------------------------
-
-#if 0
-void icmp_stats()
-{
- // FIXIT-L move these to the actual owner
- // FIXIT-L need to get these before delete flow_con
- //flow_con->get_prunes(IPPROTO_UDP, icmpStats.prunes);
-}
-#endif
-
-void icmp_reset()
-{
- memset(&icmpStats, 0, sizeof(icmpStats));
- flow_con->reset_prunes(IPPROTO_ICMP);
-}
-
icmp_ctor,
icmp_dtor,
icmp_ssn,
- icmp_reset
+ nullptr, // reset
};
const BaseApi* nin_stream_icmp = &icmp_api.base;
tcp_ctor,
tcp_dtor,
tcp_ssn,
- tcp_reset
+ nullptr // reset
};
const BaseApi* nin_stream_tcp = &tcp_api.base;
struct TcpStats
{
PegCount sessions;
- PegCount prunes;
PegCount timeouts;
PegCount resyns;
PegCount discards;
const char* tcp_pegs[] =
{
"sessions",
- "prunes",
"timeouts",
"resyns",
"discards",
// tcp module stuff
//-------------------------------------------------------------------------
-void tcp_reset()
-{
- flow_con->reset_prunes(IPPROTO_TCP);
-}
-
void tcp_show(StreamTcpConfig* tcp_config)
{
Stream5PrintTcpConfig(tcp_config);
udp_ctor,
udp_dtor,
udp_ssn,
- udp_reset
+ nullptr // reset
};
const BaseApi* nin_stream_udp = &udp_api.base;
return 0;
}
-//-------------------------------------------------------------------------
-// api related methods
-//-------------------------------------------------------------------------
-
-#if 0
-void udp_stats()
-{
- // FIXIT-L need to get these before delete flow_con
- //flow_con->get_prunes(IPPROTO_UDP, udpStats.prunes);
-}
-#endif
-
-void udp_reset()
-{
- flow_con->reset_prunes(IPPROTO_UDP);
-}
-