]> git.ipfire.org Git - thirdparty/snort3.git/commitdiff
Merge pull request #1104 in SNORT/snort3 from flow_depth to master
authorMichael Altizer (mialtize) <mialtize@cisco.com>
Tue, 6 Feb 2018 20:02:14 +0000 (15:02 -0500)
committerMichael Altizer (mialtize) <mialtize@cisco.com>
Tue, 6 Feb 2018 20:02:14 +0000 (15:02 -0500)
Squashed commit of the following:

commit 82eba08d04656950da60a337658e0c6688eb98c3
Author: Russ Combs (rucombs) <rucombs@cisco.com>
Date:   Tue Feb 6 10:24:07 2018 -0500

    help: upper case proto acronyms etc.

commit 77c0190b0ad815a2c8d2ad0a310b8941149b7be5
Author: Russ Combs (rucombs) <rucombs@cisco.com>
Date:   Tue Feb 6 09:00:06 2018 -0500

    build: fix static analysis issues

commit 2cf991a279505c6e9827080796c5c9db1f7ca826
Author: Tom Peters <thopeter@cisco.com>
Date:   Thu Feb 1 17:31:44 2018 -0500

    http_inspect: apply request/response depth to packet data

commit a9bad28e8feb80bc3b896ceda4e807c67691ad78
Author: Russ Combs (rucombs) <rucombs@cisco.com>
Date:   Mon Feb 5 09:48:17 2018 -0500

    wizard: count user scans and hits separate from tcp

commit 0721de15f359cdd29e1e3a7f8901638af0ba3cac
Author: Russ Combs (rucombs) <rucombs@cisco.com>
Date:   Sun Feb 4 13:15:30 2018 -0500

    build: fix cppcheck warnings

commit 615b82752fbec18837b71e986a67c834eff7b643
Author: Russ Combs (rucombs) <rucombs@cisco.com>
Date:   Sat Feb 3 22:08:44 2018 -0500

    detection: refactor alt_dsize

commit 644ccb2c07a562a19e94c6d38125cfa3c5b555f3
Author: Russ Combs (rucombs) <rucombs@cisco.com>
Date:   Sat Feb 3 14:22:18 2018 -0500

    detection: use detection limit (alt_dsize)

commit 192fe396cf8360996ce24d47255e6eeabb337f64
Author: Russ Combs (rucombs) <rucombs@cisco.com>
Date:   Sat Feb 3 08:56:37 2018 -0500

    search_engine: rename inspect_stream_inserts to detect_raw_tcp for clarity; default to true for 2.X rule sets

commit 50082d488fc84a0764bcd60c7521d1e9d0fe9892
Author: Russ Combs (rucombs) <rucombs@cisco.com>
Date:   Sat Feb 3 08:54:24 2018 -0500

    detection: do not change search_engine.inspect_stream_inserts configuration

51 files changed:
src/actions/act_reject.cc
src/detection/context_switcher.cc
src/detection/detection_util.h
src/detection/fp_config.h
src/detection/fp_create.cc
src/detection/fp_detect.cc
src/framework/cursor.cc
src/hash/lru_cache_shared.h
src/hash/xhash.cc
src/host_tracker/host_tracker_module.cc
src/ips_options/ips_ack.cc
src/ips_options/ips_icmp_id.cc
src/ips_options/ips_icmp_seq.cc
src/ips_options/ips_icode.cc
src/ips_options/ips_id.cc
src/ips_options/ips_itype.cc
src/ips_options/ips_seq.cc
src/ips_options/ips_tos.cc
src/ips_options/ips_ttl.cc
src/ips_options/ips_window.cc
src/main/modules.cc
src/main/snort_module.cc
src/network_inspectors/appid/appid_http_session.cc
src/network_inspectors/appid/appid_module.cc
src/network_inspectors/appid/appid_utils/sf_mlmp.cc
src/network_inspectors/appid/test/appid_api_test.cc
src/network_inspectors/appid/thirdparty_appid_utils.cc
src/network_inspectors/port_scan/ps_module.cc
src/network_inspectors/reputation/reputation_module.cc
src/protocols/packet.h
src/service_inspectors/dce_rpc/dce_http_proxy_splitter.cc
src/service_inspectors/dnp3/ips_dnp3_func.cc
src/service_inspectors/dnp3/ips_dnp3_ind.cc
src/service_inspectors/dnp3/ips_dnp3_obj.cc
src/service_inspectors/ftp_telnet/ftp_module.cc
src/service_inspectors/ftp_telnet/telnet_module.cc
src/service_inspectors/gtp/gtp_module.cc
src/service_inspectors/gtp/ips_gtp_version.cc
src/service_inspectors/http_inspect/http_inspect.cc
src/service_inspectors/modbus/ips_modbus_unit.cc
src/service_inspectors/sip/sip_module.cc
src/service_inspectors/smtp/smtp.cc
src/service_inspectors/smtp/smtp_util.cc
src/service_inspectors/wizard/wizard.cc
src/stream/base/stream_module.cc
src/stream/ip/ip_module.cc
src/stream/tcp/tcp_module.cc
src/stream/udp/udp_module.cc
tools/snort2lua/config_states/config_detection.cc
tools/snort2lua/keyword_states/kws_file.cc
tools/snort2lua/preprocessor_states/pps_perfmonitor.cc

index 63742cc1d14217a11e6e039fd3ddb0ccb58006fe..051d8ae3cfbb68218db60d9597a50a201931ed40 100644 (file)
@@ -127,10 +127,10 @@ void RejectAction::send(Packet* p)
 static const Parameter s_params[] =
 {
     { "reset", Parameter::PT_ENUM, "source|dest|both", nullptr,
-      "send tcp reset to one or both ends" },
+      "send TCP reset to one or both ends" },
 
     { "control", Parameter::PT_ENUM, "network|host|port|all", nullptr,
-      "send icmp unreachable(s)" },
+      "send ICMP unreachable(s)" },
 
     { nullptr, Parameter::PT_MAX, nullptr, nullptr, nullptr }
 };
index b45f45752462a7542cd706cf0658b72c7a3b20ad..0ec88573829fda9a00a2ae313826ea0c19607cfc 100644 (file)
@@ -240,7 +240,7 @@ TEST_CASE("ContextSwitcher normal", "[ContextSwitcher]")
         mgr.set_context_data(1, a);
         mgr.interrupt();
         CHECK(mgr.idle_count() == max-2);
-        CHECK(mgr.busy_count() == 2);
+        CHECK((mgr.busy_count() == 2));
 
         unsigned u = mgr.suspend();
         CHECK(mgr.idle_count() == max-2);
@@ -249,7 +249,7 @@ TEST_CASE("ContextSwitcher normal", "[ContextSwitcher]")
 
         mgr.resume(u);
         CHECK(mgr.idle_count() == max-2);
-        CHECK(mgr.busy_count() == 2);
+        CHECK((mgr.busy_count() == 2));
         CHECK(mgr.hold_count() == 0);
 
         mgr.complete();
@@ -291,7 +291,7 @@ TEST_CASE("ContextSwitcher abort", "[ContextSwitcher]")
         CHECK(mgr.idle_count() == max-3);
 
         mgr.suspend();
-        CHECK(mgr.busy_count() == 2);
+        CHECK((mgr.busy_count() == 2));
         CHECK(mgr.hold_count() == 1);
 
         mgr.abort();
index 79668e627a6ed01926e3d4a3dbe96b9b010ee009..33c78c9318d4ee836cf88c0c0d0b0c185dbcb5cb 100644 (file)
@@ -22,8 +22,7 @@
 #define DETECTION_UTIL_H
 
 // this is a legacy junk-drawer file that needs to be refactored
-// it provides file and alt data pointers, event trace foo, and
-// some http stuff.
+// it provides file and alt data and event trace foo.
 
 #include "main/snort_config.h"
 
@@ -41,13 +40,6 @@ struct DataBuffer
     unsigned len;
 };
 
-#define SetDetectLimit(pktPtr, altLen) \
-{ \
-    (pktPtr)->alt_dsize = altLen; \
-}
-
-#define IsLimitedDetect(pktPtr) ((pktPtr)->packet_flags & PKT_HTTP_DECODE)
-
 // FIXIT-L event trace should be placed in its own files
 void EventTrace_Init();
 void EventTrace_Term();
index 006a9dd74ec1f979eef973454ac3a29e1446535d..1fd47eec5d5bdf19d681bf3d82da9150598d7510 100644 (file)
@@ -145,7 +145,7 @@ public:
 private:
     const struct MpseApi* search_api;
 
-    bool inspect_stream_insert = false;
+    bool inspect_stream_insert = true;
     bool trim;
     bool split_any_any = false;
     bool debug_print_fast_pattern = false;
index 2285304573bc3f7b892bce5b8233775aa6e60150..85dc53e785f43433660d1ba2f140db6ad727ba55 100644 (file)
@@ -513,7 +513,9 @@ static int fpAddPortGroupRule(
         return -1;
 
     OptFpList* next = nullptr;
-    bool exclude, only_literal = !MpseManager::is_regex_capable(fp->get_search_api());
+    bool only_literal = !MpseManager::is_regex_capable(fp->get_search_api());
+    bool exclude;
+
     pmv = get_fp_content(otn, next, srvc, only_literal, exclude);
 
     if ( !pmv.empty() )
@@ -1265,11 +1267,7 @@ static void fpCreateServiceMapPortGroups(SnortConfig* sc)
         fpBuildServicePortGroups(sc, sc->spgmmTable->to_cli[i],
             sc->sopgTable->to_cli[i], sc->srmmTable->to_cli[i], fp);
     }
-    if ( !sc->sopgTable->set_user_mode() )
-    {
-        fp->set_stream_insert(true);
-        ParseWarning(WARN_RULES, "legacy mode fast pattern searching enabled");
-    }
+    sc->sopgTable->set_user_mode();
 }
 
 /*
index 6882f931bbabab132ed12eb0d441af6f4696a545..d6b002b25bd629e814423df640ee18c3d756a197 100644 (file)
@@ -914,14 +914,9 @@ static int fp_search(
         // ports search raw packet only
         if ( Mpse* so = port_group->mpse[PM_TYPE_PKT] )
         {
-            uint16_t pattern_match_size = p->dsize;
-
-            if ( IsLimitedDetect(p) && (p->alt_dsize < p->dsize) )
-                pattern_match_size = p->alt_dsize;
-
-            if ( pattern_match_size )
+            if ( uint16_t pattern_match_size = p->get_detect_limit() )
             {
-                trace_logf(detection, TRACE_FP_SEARCH, "%ld fp %s[%d]\n",
+                trace_logf(detection, TRACE_FP_SEARCH, "%ld fp %s[%u]\n",
                     pc.total_from_daq, pm_type_strings[PM_TYPE_PKT], pattern_match_size);
 
                 search_data(so, omd, p->data, pattern_match_size, pc.pkt_searches);
index 5a96ae0b4840b2c4fc6ef7b51c3a957c67d68c51..2288afcf56b6fb436d723c9a5c6b42e2f5351e8b 100644 (file)
@@ -47,13 +47,9 @@ void Cursor::reset(Packet* p)
     {
         set("alt_data", buf.data, buf.len);
     }
-    else if ( IsLimitedDetect(p) )
-    {
-        set("pkt_data", p->data, p->alt_dsize);
-    }
     else
     {
-        set("pkt_data", p->data, p->dsize);
+        set("pkt_data", p->data, p->get_detect_limit());
     }
 }
 
index d2cf0a95f6c108824914769492bfe79d747632ab..81c4d65bf53c714e593184161208d036fe4c06f1 100644 (file)
@@ -158,7 +158,7 @@ bool LruCacheShared<Key, Data, Hash>::set_max_size(size_t newsize)
     list_iter=list.end();
     while (current_size > newsize)
     {
-        list_iter--;
+        --list_iter;
         current_size--;
         map.erase(list_iter->first);
         list.erase(list_iter);
@@ -199,7 +199,7 @@ void LruCacheShared<Key, Data, Hash>::insert(const Key& key, const Data& data)
     {
         LruListIter list_iter;
         list_iter = list.end();
-        list_iter--;
+        --list_iter;
         map.erase(list_iter->first);
         list.erase(list_iter);
         stats.prunes++;
index 3c12237e2d84ba5afde1a1481f1f6b53d7d8bc79..0aa192107fa001a9a8a1a769d3c0daa785dd8e22 100644 (file)
@@ -1053,7 +1053,7 @@ int anrfree(void* key, void* data)
 
     /* Decide if we can free this node. */
 
-    //bx++; if(bx == 4 )bx=0;       /* for testing */
+    bx++; if(bx == 4 )bx=0;       /* for testing */
 
     /* if we are allowing the node to die, kill it */
     if ( !bx )
index 090fe2d5a316f6acecf7a2f1e0acfee0d889ca15..ad500f2b131813b22b14465509554568267cfbbc 100644 (file)
@@ -44,7 +44,7 @@ const Parameter HostTrackerModule::service_params[] =
       "service identifier" },
 
     { "proto", Parameter::PT_ENUM, "tcp | udp", "tcp",
-      "ip protocol" },
+      "IP protocol" },
 
     { "port", Parameter::PT_PORT, nullptr, nullptr,
       "port number" },
@@ -54,14 +54,14 @@ const Parameter HostTrackerModule::service_params[] =
 
 const Parameter HostTrackerModule::host_tracker_params[] =
 {
-    { "ip", Parameter::PT_ADDR, nullptr, "0.0.0.0/32",
+    { "IP", Parameter::PT_ADDR, nullptr, "0.0.0.0/32",
       "hosts address / cidr" },
 
     { "frag_policy", Parameter::PT_ENUM, IP_POLICIES, nullptr,
       "defragmentation policy" },
 
     { "tcp_policy", Parameter::PT_ENUM, TCP_POLICIES, nullptr,
-      "tcp reassembly policy" },
+      "TCP reassembly policy" },
 
     { "services", Parameter::PT_LIST, HostTrackerModule::service_params, nullptr,
       "list of service parameters" },
index 7fc6389ab3c24fc112575a77ae35e5dc5cd304c8..773a099106d784aa61a46da915d7ebf85e152fd1 100644 (file)
@@ -98,7 +98,7 @@ IpsOption::EvalStatus TcpAckOption::eval(Cursor&, Packet* p)
 static const Parameter s_params[] =
 {
     { "~range", Parameter::PT_INTERVAL, RANGE, nullptr,
-      "check if tcp ack value is 'value | min<>max | <max | >min'" },
+      "check if TCP ack value is 'value | min<>max | <max | >min'" },
 
     { nullptr, Parameter::PT_MAX, nullptr, nullptr, nullptr }
 };
index 04ee805b56a772825471c057bbc929b5c05a2f4f..fac6b465b2e9ecb89f2b4fcd71095a5e723900bf 100644 (file)
@@ -127,7 +127,7 @@ IpsOption::EvalStatus IcmpIdOption::eval(Cursor&, Packet* p)
 static const Parameter s_params[] =
 {
     { "~range", Parameter::PT_INTERVAL, RANGE, nullptr,
-      "check if icmp id is in given range" },
+      "check if ICMP ID is in given range" },
 
     { nullptr, Parameter::PT_MAX, nullptr, nullptr, nullptr }
 };
index e4cae55912630ef6633cacf34ba36fd6ca0a4f2e..e150edeee5173497bb0096b207f33ff88150f288 100644 (file)
@@ -128,7 +128,7 @@ IpsOption::EvalStatus IcmpSeqOption::eval(Cursor&, Packet* p)
 static const Parameter s_params[] =
 {
     { "~range", Parameter::PT_INTERVAL, RANGE, nullptr,
-      "check if icmp sequence number is in given range" },
+      "check if ICMP sequence number is in given range" },
 
     { nullptr, Parameter::PT_MAX, nullptr, nullptr, nullptr }
 };
index 2038f155d1e84cb61c36988db5955bce99b549b5..4b05f5a06a45c69309e1db1998e73612e6909aed 100644 (file)
@@ -99,7 +99,7 @@ IpsOption::EvalStatus IcodeOption::eval(Cursor&, Packet* p)
 static const Parameter s_params[] =
 {
     { "~range", Parameter::PT_INTERVAL, RANGE, nullptr,
-      "check if icmp code is in given range is" },
+      "check if ICMP code is in given range is" },
 
     { nullptr, Parameter::PT_MAX, nullptr, nullptr, nullptr }
 };
index 2bd8104698f0b29f0b05b47a732f82dcf784642b..55c241f03e219f0bf48b7e8a087f899ef77115b6 100644 (file)
@@ -97,7 +97,7 @@ IpsOption::EvalStatus IpIdOption::eval(Cursor&, Packet* p)
 static const Parameter s_params[] =
 {
     { "~range", Parameter::PT_INTERVAL, RANGE, nullptr,
-      "check if the ip id is in the given range" },
+      "check if the IP ID is in the given range" },
 
     { nullptr, Parameter::PT_MAX, nullptr, nullptr, nullptr }
 };
index d0322838cc721aec9f77a78976e6b78c791aaf6a..bceb7b7a774db1d41fb076a056b2b4c93e347412 100644 (file)
@@ -100,7 +100,7 @@ IpsOption::EvalStatus IcmpTypeOption::eval(Cursor&, Packet* p)
 static const Parameter s_params[] =
 {
     { "~range", Parameter::PT_INTERVAL, RANGE, nullptr,
-      "check if icmp type is in given range" },
+      "check if ICMP type is in given range" },
 
     { nullptr, Parameter::PT_MAX, nullptr, nullptr, nullptr }
 };
index b05d4f02378820a63b17444e4369db73f1ccc5c0..6a0e43b9925724b4be7e138051450c8d4a5dee1c 100644 (file)
@@ -98,7 +98,7 @@ IpsOption::EvalStatus TcpSeqOption::eval(Cursor&, Packet* p)
 static const Parameter s_params[] =
 {
     { "~range", Parameter::PT_INTERVAL, RANGE, nullptr,
-      "check if tcp sequence number is in given range" },
+      "check if TCP sequence number is in given range" },
 
     { nullptr, Parameter::PT_MAX, nullptr, nullptr, nullptr }
 };
index 12c09540171f5d9a69ca1fc3720c64c91bea1008..9ac03001df8f3f386ddf19aca163f9de9121f700 100644 (file)
@@ -101,7 +101,7 @@ IpsOption::EvalStatus IpTosOption::eval(Cursor&, Packet* p)
 static const Parameter s_params[] =
 {
     { "~range", Parameter::PT_INTERVAL, RANGE, nullptr,
-      "check if ip tos is in given range" },
+      "check if IP TOS is in given range" },
 
     { nullptr, Parameter::PT_MAX, nullptr, nullptr, nullptr }
 };
index b230a6d719a7fe59e0cb5d2a174af50b749c32ae..ca5c875ae0e260c436294a3815ee792d0157921e 100644 (file)
@@ -98,7 +98,7 @@ IpsOption::EvalStatus TtlOption::eval(Cursor&, Packet* p)
 static const Parameter s_params[] =
 {
     { "~range", Parameter::PT_INTERVAL, RANGE, nullptr,
-      "check if ip ttl is in the given range" },
+      "check if IP TTL is in the given range" },
 
     { nullptr, Parameter::PT_MAX, nullptr, nullptr, nullptr }
 };
index a140baf50288b13ac5a1ebda6ece5905a7bb18e7..7481a283ee47af94188b4a348e7c0555e7998307 100644 (file)
@@ -98,7 +98,7 @@ IpsOption::EvalStatus TcpWinOption::eval(Cursor&, Packet* p)
 static const Parameter s_params[] =
 {
     { "~range", Parameter::PT_INTERVAL, RANGE, nullptr,
-      "check if tcp window size is in given range" },
+      "check if TCP window size is in given range" },
 
     { nullptr, Parameter::PT_MAX, nullptr, nullptr, nullptr }
 };
index 685c9f1c051c03bbb1f94f03bf3f196049dc9d20..f2f79118648e4553596f73fba5420d454b33ca36 100644 (file)
@@ -238,8 +238,8 @@ static const Parameter search_engine_params[] =
     { "max_queue_events", Parameter::PT_INT, "2:100", "5",  // upper bound is MAX_EVENT_MATCH
       "maximum number of matching fast pattern states to queue per packet" },
 
-    { "inspect_stream_inserts", Parameter::PT_BOOL, nullptr, "false",
-      "inspect reassembled payload - disabling is good for performance, bad for detection" },
+    { "detect_raw_tcp", Parameter::PT_BOOL, nullptr, "true",
+      "detect on TCP payload before reassembly" },
 
     { "search_method", Parameter::PT_DYNAMIC, (void*)&get_search_methods, "ac_bnfa",
       "set fast pattern algorithm - choose available search engine" },
@@ -337,7 +337,7 @@ bool SearchEngineModule::set(const char*, Value& v, SnortConfig* sc)
     else if ( v.is("max_queue_events") )
         fp->set_max_queue_events(v.get_long());
 
-    else if ( v.is("inspect_stream_inserts") )
+    else if ( v.is("detect_raw_tcp") )
         fp->set_stream_insert(v.get_bool());
 
     else if ( v.is("search_method") )
@@ -1029,7 +1029,7 @@ static const Parameter network_params[] =
       "correlate unified2 events with configuration" },
 
     { "min_ttl", Parameter::PT_INT, "1:255", "1",
-      "alert / normalize packets with lower ttl / hop limit "
+      "alert / normalize packets with lower TTL / hop limit "
       "(you must enable rules and / or normalization also)" },
 
     { "new_ttl", Parameter::PT_INT, "1:255", "1",
@@ -1760,7 +1760,7 @@ static const Parameter service_params[] =
       "service identifier" },
 
     { "proto", Parameter::PT_ENUM, "tcp | udp", "tcp",
-      "ip protocol" },
+      "IP protocol" },
 
     { "port", Parameter::PT_PORT, nullptr, nullptr,
       "port number" },
@@ -1771,13 +1771,13 @@ static const Parameter service_params[] =
 static const Parameter hosts_params[] =
 {
     { "ip", Parameter::PT_ADDR, nullptr, "0.0.0.0/32",
-      "hosts address / cidr" },
+      "hosts address / CIDR" },
 
     { "frag_policy", Parameter::PT_ENUM, IP_POLICIES, nullptr,
       "defragmentation policy" },
 
     { "tcp_policy", Parameter::PT_ENUM, TCP_POLICIES, nullptr,
-      "tcp reassembly policy" },
+      "TCP reassembly policy" },
 
     { "services", Parameter::PT_LIST, service_params, nullptr,
       "list of service parameters" },
index fdad51a0e4a08f534e50ae837f9712eadc7d9d9c..37e29bacf070f40d6235c7dd6bda95c40614bcc9 100644 (file)
@@ -176,7 +176,7 @@ static const Parameter s_params[] =
 
 #ifdef SHELL
     { "-j", Parameter::PT_PORT, nullptr, nullptr,
-      "<port> to listen for telnet connections" },
+      "<port> to listen for Telnet connections" },
 #endif
 
     { "-k", Parameter::PT_ENUM, "all|noip|notcp|noudp|noicmp|none", "all",
index 01386c71d02e7abe06755c19cd326bf9d3a2c825..97c5f65273e0b629205587317be363ab460f672f 100644 (file)
@@ -435,7 +435,7 @@ int AppIdHttpSession::process_http_packet(int direction)
             {
                 if ( asd->service.get_id() == APP_ID_NONE || asd->service.get_id() == APP_ID_HTTP )
                 {
-                    AppIdServiceSubtype* local_subtype = nullptr;
+                    //AppIdServiceSubtype* local_subtype = nullptr;
                     char* vendorVersion = nullptr;
                     char* vendor = nullptr;
 
@@ -450,7 +450,8 @@ int AppIdHttpSession::process_http_packet(int direction)
                         snort_free(vendor);
                         snort_free(vendorVersion);
                     }
-                    if (local_subtype)
+#if 0
+                    if (local_subtype)  // FIXIT-W always false
                     {
                         AppIdServiceSubtype** tmpSubtype;
 
@@ -460,6 +461,7 @@ int AppIdHttpSession::process_http_packet(int direction)
 
                         *tmpSubtype = local_subtype;
                     }
+#endif
                 }
             }
 
index 9ddc2c9ebc73980c0dac7d9df765fb6aafae4314..7c31c77bc01b699c23bf2b01280a713050896282 100644 (file)
@@ -44,12 +44,12 @@ THREAD_LOCAL ProfileStats appidPerfStats;
 static const Parameter session_log_filter[] =
 {
     { "src_ip", Parameter::PT_ADDR, nullptr, "0.0.0.0/32",
-      "source ip address in CIDR format" },
+      "source IP address in CIDR format" },
     { "dst_ip", Parameter::PT_ADDR, nullptr, "0.0.0.0/32",
-      "destination ip address in CIDR format" },
+      "destination IP address in CIDR format" },
     { "src_port", Parameter::PT_PORT, "1:", nullptr, "source port" },
     { "dst_port", Parameter::PT_PORT, "1:", nullptr, "destination port" },
-    { "protocol", Parameter::PT_STRING, nullptr, nullptr,"ip protocol" },
+    { "protocol", Parameter::PT_STRING, nullptr, nullptr,"IP protocol" },
     { "log_all_sessions", Parameter::PT_BOOL, nullptr, "false",
       "enable logging for all appid sessions" },
     { nullptr, Parameter::PT_MAX, nullptr, nullptr, nullptr }
index c06de1d152d28dac57a2ae27e8ccbc9d26424df2..af0a619a22b6b41575f4536741c539ce23b2181b 100644 (file)
@@ -270,19 +270,18 @@ static void destroyTreesRecursively(tMlmpTree* rootNode)
 
 static void dumpTreesRecursively(tMlmpTree* rootNode)
 {
-    tPatternPrimaryNode* primaryPatternNode;
-    tPatternNode* ddPatternNode;
-    char prefix[41];
-    uint32_t prefixSize;
+#ifdef DEBUG
+    uint32_t prefixSize = 4 * (rootNode->level) + 2;
 
-    prefixSize = 4 * (rootNode->level) + 2;
     if (prefixSize > 40)
         prefixSize = 40;
 
+    char prefix[41];
     memset(prefix, ' ', prefixSize);
     prefix[prefixSize] = '\0';
+#endif
 
-    for (primaryPatternNode = rootNode->patternList;
+    for (tPatternPrimaryNode* primaryPatternNode = rootNode->patternList;
         primaryPatternNode;
         primaryPatternNode = primaryPatternNode->nextPrimaryNode)
     {
@@ -292,7 +291,7 @@ static void dumpTreesRecursively(tMlmpTree* rootNode)
             primaryPatternNode->patternNode.partTotal,
             primaryPatternNode->patternNode.userData);
 
-        for (ddPatternNode = &primaryPatternNode->patternNode;
+        for (tPatternNode* ddPatternNode = &primaryPatternNode->patternNode;
             ddPatternNode;
             ddPatternNode = ddPatternNode->nextPattern)
         {
index 4c2cd0eccbe76ac358ebb2e86ef6882a81001d8d..9565e61d15f9e7a745e72ea7f48a833cab7a21c7 100644 (file)
@@ -530,7 +530,7 @@ TEST(appid_api, get_user_name)
     CHECK_TRUE(service == APPID_UT_ID);
     CHECK_TRUE(!isLoginSuccessful);
     mock_session->set_session_flags(APPID_SESSION_LOGIN_SUCCEEDED);
-    val = appid_api.get_user_name(mock_session, &service, &isLoginSuccessful);
+    appid_api.get_user_name(mock_session, &service, &isLoginSuccessful);
     CHECK_TRUE(service == APPID_UT_ID);
     CHECK_TRUE(isLoginSuccessful);
 }
@@ -704,7 +704,7 @@ TEST(appid_api, produce_ha_state)
     mock_flow_data= nullptr;
     SfIp ip;
     ip.pton(AF_INET, "192.168.1.222");
-    val = appid_api.consume_ha_state(flow, (uint8_t*)&appHA, 0, IpProtocol::TCP, &ip, 1066);
+    appid_api.consume_ha_state(flow, (uint8_t*)&appHA, 0, IpProtocol::TCP, &ip, 1066);
     mock_session = (AppIdSession*)flow->get_flow_data(AppIdSession::inspector_id);
     CHECK_TRUE(mock_session);
     CHECK_TRUE(mock_session->tp_app_id == appHA.appId[0]);
@@ -723,7 +723,7 @@ TEST(appid_api, produce_ha_state)
     delete mock_session;
     mock_session = nullptr;
     mock_flow_data= nullptr;
-    val = appid_api.consume_ha_state(flow, (uint8_t*)&appHA, 0, IpProtocol::TCP, &ip, 1066);
+    appid_api.consume_ha_state(flow, (uint8_t*)&appHA, 0, IpProtocol::TCP, &ip, 1066);
     mock_session = (AppIdSession*)flow->get_flow_data(AppIdSession::inspector_id);
     CHECK_TRUE(mock_session);
     uint64_t flags = mock_session->get_session_flags(APPID_SESSION_CLIENT_DETECTED |
index f13f42226025eaae5407ac6e02b5f5290abf8d37..9213e4b6b11f5e9e74a461a8af7b096fe8746ee5 100644 (file)
@@ -117,7 +117,7 @@ static void getXffFields()
 {
     // FIXIT-M need to get xff fields from http config
     const char** xffFields = nullptr; // = _dpd.getHttpXffFields(&thirdpartyConfig.numXffFields);
-    if (!xffFields)
+    //if (!xffFields)  FIXIT-W always true
     {
         xffFields = defaultXffFields;
         thirdpartyConfig.numXffFields = sizeof(defaultXffFields) / sizeof(defaultXffFields[0]);
index 2090ac9137dfb3f236447e2a1f3a73635b4b4e9c..cf9afcc5d5844c45c01e30809e7c01814feb4921 100644 (file)
@@ -81,55 +81,55 @@ static const Parameter ps_params[] =
       "list of CIDRs with optional ports" },
 
     { "tcp_ports", Parameter::PT_TABLE, scan_params, nullptr,
-      "tcp port scan configuration (one-to-one)" },
+      "TCP port scan configuration (one-to-one)" },
 
     { "tcp_decoy", Parameter::PT_TABLE, scan_params, nullptr,
-      "tcp decoy scan configuration (one-to-one decoy)" },
+      "TCP decoy scan configuration (one-to-one decoy)" },
 
     { "tcp_sweep", Parameter::PT_TABLE, scan_params, nullptr,
-      "tcp sweep scan configuration (one-to-many)" },
+      "TCP sweep scan configuration (one-to-many)" },
 
     { "tcp_dist", Parameter::PT_TABLE, scan_params, nullptr,
-      "tcp distributed scan configuration (many-to-one)" },
+      "TCP distributed scan configuration (many-to-one)" },
 
     { "udp_ports", Parameter::PT_TABLE, scan_params, nullptr,
-      "udp port scan configuration (one-to-one)" },
+      "UDP port scan configuration (one-to-one)" },
 
     { "udp_decoy", Parameter::PT_TABLE, scan_params, nullptr,
-      "udp decoy scan configuration (one-to-one)" },
+      "UDP decoy scan configuration (one-to-one)" },
 
     { "udp_sweep", Parameter::PT_TABLE, scan_params, nullptr,
-      "udp sweep scan configuration (one-to-many)" },
+      "UDP sweep scan configuration (one-to-many)" },
 
     { "udp_dist", Parameter::PT_TABLE, scan_params, nullptr,
-      "udp distributed scan configuration (many-to-one)" },
+      "UDP distributed scan configuration (many-to-one)" },
 
     { "ip_proto", Parameter::PT_TABLE, scan_params, nullptr,
-      "ip protocol scan configuration (one-to-one)" },
+      "IP protocol scan configuration (one-to-one)" },
 
     { "ip_decoy", Parameter::PT_TABLE, scan_params, nullptr,
-      "ip decoy scan configuration (one-to-one decoy)" },
+      "IP decoy scan configuration (one-to-one decoy)" },
 
     { "ip_sweep", Parameter::PT_TABLE, scan_params, nullptr,
       "ip sweep scan configuration (one-to-many)" },
 
     { "ip_dist", Parameter::PT_TABLE, scan_params, nullptr,
-      "ip distributed scan configuration (many-to-one)" },
+      "IP distributed scan configuration (many-to-one)" },
 
     { "icmp_sweep", Parameter::PT_TABLE, scan_params, nullptr,
-      "icmp sweep scan configuration (one-to-many)" },
+      "ICMP sweep scan configuration (one-to-many)" },
 
     { "tcp_window", Parameter::PT_INT, "0:", "0",
-      "detection interval for all tcp scans" },
+      "detection interval for all TCP scans" },
 
     { "udp_window", Parameter::PT_INT, "0:", "0",
-      "detection interval for all udp scans" },
+      "detection interval for all UDP scans" },
 
     { "ip_window", Parameter::PT_INT, "0:", "0",
-      "detection interval for all ip scans" },
+      "detection interval for all IP scans" },
 
     { "icmp_window", Parameter::PT_INT, "0:", "0",
-      "detection interval for all icmp scans" },
+      "detection interval for all ICMP scans" },
 
     { nullptr, Parameter::PT_MAX, nullptr, nullptr, nullptr }
 };
index 140c904decf5aa3d6614a5f51b8964abbed37359..ff0bdb08649075a5f46e4706c173b7f3551bc68c 100644 (file)
@@ -43,13 +43,13 @@ using namespace std;
 static const Parameter s_params[] =
 {
     { "blacklist", Parameter::PT_STRING, nullptr, nullptr,
-      "blacklist file name with ip lists" },
+      "blacklist file name with IP lists" },
 
     { "memcap", Parameter::PT_INT, "1:4095", "500",
       "maximum total MB of memory allocated" },
 
     { "nested_ip", Parameter::PT_ENUM, "inner|outer|all", "inner",
-      "ip to use when there is IP encapsulation" },
+      "IP to use when there is IP encapsulation" },
 
     { "priority", Parameter::PT_ENUM, "blacklist|whitelist", "whitelist",
       "defines priority when there is a decision conflict during run-time" },
@@ -61,7 +61,7 @@ static const Parameter s_params[] =
       "specify the meaning of whitelist" },
 
     { "whitelist", Parameter::PT_STRING, nullptr, nullptr,
-      "whitelist file name with ip lists" },
+      "whitelist file name with IP lists" },
 
     { nullptr, Parameter::PT_MAX, nullptr, nullptr, nullptr }
 };
index a1eb455e457981c1d5936eddd568e89a3d4a338a..abebc7ace6e12a4bdd975b0dd8fcb3fea07b29aa 100644 (file)
@@ -42,7 +42,7 @@
 
 #define PKT_PDU_HEAD         0x00000100  /* start of PDU */
 #define PKT_PDU_TAIL         0x00000200  /* end of PDU */
-#define PKT_HTTP_DECODE      0x00000400  /* this packet has normalized http */
+#define PKT_DETECT_LIMIT     0x00000400  /* alt_dsize is valid */
 
 #define PKT_ALLOW_MULTIPLE_DETECT 0x00000800  /* packet has either pipelined mime attachments
                                                  or pipeline http requests */
@@ -111,7 +111,7 @@ struct SO_PUBLIC Packet
     uint32_t xtradata_mask;
 
     uint16_t proto_bits;        /* protocols contained within this packet */
-    uint16_t alt_dsize;         /* the dsize of a packet before munging (used for log)*/
+    uint16_t alt_dsize;         /* size for detection (iff PKT_DETECT_LIMIT) */
 
     uint8_t num_layers;         /* index into layers for next encap */
     // FIXIT-M Consider moving ip_proto_next below `pkth`.
@@ -188,6 +188,15 @@ struct SO_PUBLIC Packet
     inline PktType type() const
     { return ptrs.get_pkt_type(); } // defined in codec.h
 
+    void set_detect_limit(uint16_t n)
+    {
+        alt_dsize = n;
+        packet_flags |= PKT_DETECT_LIMIT;
+    }
+
+    uint16_t get_detect_limit()
+    { return (packet_flags & PKT_DETECT_LIMIT) ? alt_dsize : dsize; }
+
     const char* get_type() const;
     const char* get_pseudo_type() const;
 
index 3f3ac04712cd2578fe41d0e0e0ac11a93af9a485..c57972f3777e3ca2dda3b1fbd48b28be543b09a5 100644 (file)
@@ -239,7 +239,7 @@ TEST_CASE("DceHttpProxySplitter-scan - full_proxy_request", "[http_proxy_splitte
 {
     DceHttpProxySplitter* splitter = new DceHttpProxySplitter(true);
     Flow* flow = new Flow();
-    uint32_t fp;
+    uint32_t fp = 0;
 
     REQUIRE(splitter->scan(flow, (const uint8_t*)HTTP_PROXY_REQUEST,
         strlen(HTTP_PROXY_REQUEST), PKT_FROM_CLIENT, &fp) == StreamSplitter::FLUSH);
@@ -257,7 +257,7 @@ TEST_CASE("DceHttpProxySplitter-scan - extra_proxy_request", "[http_proxy_splitt
     const char* extra = "ignore";
     char* string = new char[strlen(HTTP_PROXY_REQUEST)+strlen(extra)+1];
     Flow* flow = new Flow();
-    uint32_t fp;
+    uint32_t fp = 0;
     strncpy(string,(const char*)HTTP_PROXY_REQUEST,strlen(HTTP_PROXY_REQUEST));
     strncpy(string+strlen(HTTP_PROXY_REQUEST),extra,strlen(extra));
 
@@ -291,12 +291,12 @@ TEST_CASE("DceHttpProxySplitter-scan - good_1_proxy_response", "[http_proxy_spli
 {
     DceHttpProxySplitter* splitter = new DceHttpProxySplitter(false);
     Flow* flow = new Flow();
-    uint32_t fp;
+    uint32_t fp = 0;
 
     REQUIRE(splitter->cutover_inspector() == false);
-    REQUIRE(splitter->scan(flow, (const uint8_t*)"HTTP/1.xxx\n\n", 12, PKT_FROM_SERVER, &fp) ==
-        StreamSplitter::FLUSH);
-    REQUIRE(fp == 12);
+    REQUIRE(splitter->scan(flow, (const uint8_t*)"HTTP/1.xxx\n\n", 12,
+        PKT_FROM_SERVER, &fp) == StreamSplitter::FLUSH);
+    REQUIRE((fp == 12));
     REQUIRE(splitter->cutover_inspector() == true);
     delete flow;
     delete splitter;
@@ -306,12 +306,12 @@ TEST_CASE("DceHttpProxySplitter-scan - good_2_proxy_response", "[http_proxy_spli
 {
     DceHttpProxySplitter* splitter = new DceHttpProxySplitter(false);
     Flow* flow = new Flow();
-    uint32_t fp;
+    uint32_t fp = 0;
 
     REQUIRE(splitter->cutover_inspector() == false);
-    REQUIRE(splitter->scan(flow, (const uint8_t*)"HTTP/1.xxx\nxx\n\n", 15, PKT_FROM_SERVER, &fp) ==
-        StreamSplitter::FLUSH);
-    REQUIRE(fp == 15);
+    REQUIRE(splitter->scan(flow, (const uint8_t*)"HTTP/1.xxx\nxx\n\n", 15,
+        PKT_FROM_SERVER, &fp) == StreamSplitter::FLUSH);
+    REQUIRE((fp == 15));
     REQUIRE(splitter->cutover_inspector() == true);
     delete flow;
     delete splitter;
@@ -320,12 +320,12 @@ TEST_CASE("DceHttpProxySplitter-scan - good_3_proxy_response", "[http_proxy_spli
 {
     DceHttpProxySplitter* splitter = new DceHttpProxySplitter(false);
     Flow* flow = new Flow();
-    uint32_t fp;
+    uint32_t fp = 0;
 
     REQUIRE(splitter->cutover_inspector() == false);
-    REQUIRE(splitter->scan(flow, (const uint8_t*)"HTTP/1.xxx\nxx\n\nyyy", 18, PKT_FROM_SERVER, &fp) ==
-        StreamSplitter::FLUSH);
-    REQUIRE(fp == 18);
+    REQUIRE(splitter->scan(flow, (const uint8_t*)"HTTP/1.xxx\nxx\n\nyyy", 18,
+        PKT_FROM_SERVER, &fp) == StreamSplitter::FLUSH);
+    REQUIRE((fp == 18));
     REQUIRE(splitter->cutover_inspector() == true);
     delete flow;
     delete splitter;
index 2c94a3ba1fb34f764de02b8e14d2f9529720ed72..74cd1054ef5f3e25ac4e2e3eecbaa35a7965e9d8 100644 (file)
@@ -38,7 +38,7 @@
 
 #define s_name "dnp3_func"
 #define s_help \
-    "detection option to check dnp3 function code"
+    "detection option to check DNP3 function code"
 
 static THREAD_LOCAL ProfileStats dnp3_func_perf_stats;
 
@@ -112,7 +112,7 @@ IpsOption::EvalStatus Dnp3FuncOption::eval(Cursor&, Packet* p)
 static const Parameter s_params[] =
 {
     { "~", Parameter::PT_STRING, nullptr, nullptr,
-      "match dnp3 function code or name" },
+      "match DNP3 function code or name" },
 
     { nullptr, Parameter::PT_MAX, nullptr, nullptr, nullptr }
 };
index 31f0052836daaf3811d4faead7d8c607d8f261a0..9c6c843ee2d96305fe2b8faf99e5fbfbb1731385 100644 (file)
@@ -38,7 +38,7 @@
 
 #define s_name "dnp3_ind"
 #define s_help \
-    "detection option to check dnp3 indicator flags"
+    "detection option to check DNP3 indicator flags"
 
 static THREAD_LOCAL ProfileStats dnp3_ind_perf_stats;
 
@@ -113,7 +113,7 @@ IpsOption::EvalStatus Dnp3IndOption::eval(Cursor&, Packet* p)
 static const Parameter s_params[] =
 {
     { "~", Parameter::PT_STRING, nullptr, nullptr,
-      "match given dnp3 indicator flags" },
+      "match given DNP3 indicator flags" },
 
     { nullptr, Parameter::PT_MAX, nullptr, nullptr, nullptr }
 };
index b12dec7afe0a053587cc040cc7c562928552c840..50d12c760fbe175fb62f87096cb2d86c4ed0ca81 100644 (file)
@@ -37,7 +37,7 @@
 
 #define s_name "dnp3_obj"
 #define s_help \
-    "detection option to check dnp3 object headers"
+    "detection option to check DNP3 object headers"
 
 /* Object decoding constants */
 #define DNP3_OBJ_HDR_MIN_LEN 3 /* group, var, qualifier */
@@ -153,9 +153,9 @@ IpsOption::EvalStatus Dnp3ObjOption::eval(Cursor&, Packet* p)
 static const Parameter s_params[] =
 {
     { "group", Parameter::PT_INT, "0:255", "0",
-      "match given dnp3 object header group" },
+      "match given DNP3 object header group" },
     { "var", Parameter::PT_INT, "0:255", "0",
-      "match given dnp3 object header var" },
+      "match given DNP3 object header var" },
     { nullptr, Parameter::PT_MAX, nullptr, nullptr, nullptr }
 };
 
index 1d3bc8cee3d3e60b41261e706ec53878e78f431b..03dab70a300dbfe87e9edb81d965010e04089133 100644 (file)
@@ -46,7 +46,7 @@ using namespace std;
 static const Parameter client_bounce_params[] =
 {
     { "address", Parameter::PT_ADDR, nullptr, "1.0.0.0/32",
-      "allowed ip address in CIDR format" },
+      "allowed IP address in CIDR format" },
 
     // FIXIT-L port and last_port should be replaced with a port list
     { "port", Parameter::PT_PORT, "1:", "20",
@@ -70,10 +70,10 @@ static const Parameter ftp_client_params[] =
       "ignore erase character and erase line commands when normalizing" },
 
     { "max_resp_len", Parameter::PT_INT, "-1:", "-1",
-      "maximum ftp response accepted by client" },
+      "maximum FTP response accepted by client" },
 
     { "telnet_cmds", Parameter::PT_BOOL, nullptr, "false",
-      "detect telnet escape sequences on ftp control channel" },
+      "detect Telnet escape sequences on FTP control channel" },
 
     { nullptr, Parameter::PT_MAX, nullptr, nullptr, nullptr }
 };
@@ -300,13 +300,13 @@ static const Parameter ftp_server_params[] =
       "default maximum length of commands handled by server; 0 is unlimited" },
 
     { "encrypted_traffic", Parameter::PT_BOOL, nullptr, "false",
-      "check for encrypted telnet and ftp" },
+      "check for encrypted Telnet and FTP" },
 
     { "ftp_cmds", Parameter::PT_STRING, nullptr, nullptr,
       "specify additional commands supported by server beyond RFC 959" },
 
     { "ignore_data_chan", Parameter::PT_BOOL, nullptr, "false",
-      "do not inspect ftp data channels" },
+      "do not inspect FTP data channels" },
 
     { "ignore_telnet_erase_cmds", Parameter::PT_BOOL, nullptr, "false",
       "ignore erase character and erase line commands when normalizing" },
@@ -315,7 +315,7 @@ static const Parameter ftp_server_params[] =
       "print command configurations on start up" },
 
     { "telnet_cmds", Parameter::PT_BOOL, nullptr, "false",
-      "detect telnet escape sequences of ftp control channel" },
+      "detect Telnet escape sequences of FTP control channel" },
 
     { nullptr, Parameter::PT_MAX, nullptr, nullptr, nullptr }
 };
@@ -340,8 +340,8 @@ static const RuleMap ftp_server_rules[] =
 static const PegInfo ftp_pegs[] =
 {
     { CountType::SUM, "total_packets", "total packets" },
-    { CountType::NOW, "concurrent_sessions", "total concurrent ftp sessions" },
-    { CountType::MAX, "max_concurrent_sessions", "maximum concurrent ftp sessions" },
+    { CountType::NOW, "concurrent_sessions", "total concurrent FTP sessions" },
+    { CountType::MAX, "max_concurrent_sessions", "maximum concurrent FTP sessions" },
 
     { CountType::END, nullptr, nullptr }
 };
index 453a7baa41356500e9e297bc7fdd74d7b0907e5d..8a58107ba7151c7b90bcd9cfa66b5da03dc37dc6 100644 (file)
@@ -35,22 +35,22 @@ using namespace std;
 //-------------------------------------------------------------------------
 
 #define TELNET_AYT_OVERFLOW_STR                  \
-    "consecutive telnet AYT commands beyond threshold"
+    "consecutive Telnet AYT commands beyond threshold"
 #define TELNET_ENCRYPTED_STR                     \
-    "telnet traffic encrypted"
+    "Telnet traffic encrypted"
 #define TELNET_SB_NO_SE_STR                      \
-    "telnet subnegotiation begin command without subnegotiation end"
+    "Telnet subnegotiation begin command without subnegotiation end"
 
 static const Parameter s_params[] =
 {
     { "ayt_attack_thresh", Parameter::PT_INT, "-1:", "-1",
-      "alert on this number of consecutive telnet AYT commands" },
+      "alert on this number of consecutive Telnet AYT commands" },
 
     { "check_encrypted", Parameter::PT_BOOL, nullptr, "false",
       "check for end of encryption" },
 
     { "encrypted_traffic", Parameter::PT_BOOL, nullptr, "false",
-      "check for encrypted telnet and ftp" },
+      "check for encrypted Telnet and FTP" },
 
     { "normalize", Parameter::PT_BOOL, nullptr, "false",
       "eliminate escape sequences" },
@@ -61,8 +61,8 @@ static const Parameter s_params[] =
 static const PegInfo telnet_pegs[] =
 {
     { CountType::SUM, "total_packets", "total packets" },
-    { CountType::NOW, "concurrent_sessions", "total concurrent telnet sessions" },
-    { CountType::MAX, "max_concurrent_sessions", "maximum concurrent telnet sessions" },
+    { CountType::NOW, "concurrent_sessions", "total concurrent Telnet sessions" },
+    { CountType::MAX, "max_concurrent_sessions", "maximum concurrent Telnet sessions" },
 
     { CountType::END, nullptr, nullptr }
 };
index 9c84cfa79027a3e5254002f1fa30d93c18161983..efed8943d8f963c42d90f39d6f5a821578f36b0e 100644 (file)
@@ -107,7 +107,7 @@ static const Parameter gtp_info_params[] =
 static const Parameter gtp_params[] =
 {
     { "version", Parameter::PT_INT, "0:2", "2",
-      "gtp version" },
+      "GTP version" },
 
     { "messages", Parameter::PT_LIST, gtp_msg_params, nullptr,
       "message dictionary" },
index c6b9e7440e56eee23bf889aca0cace6d79923b4a..51577dcfb14621a580eaa0ae17e663d30511d3d9 100644 (file)
@@ -102,7 +102,7 @@ static const Parameter s_params[] =
 };
 
 #define s_help \
-    "rule option to check gtp version"
+    "rule option to check GTP version"
 
 class GtpVersionModule : public Module
 {
index fe252baebf8540d225533e7f4727f5b955de1973..f0128648ad036abad208b15e923e0c77707387a8 100644 (file)
@@ -24,6 +24,7 @@
 #include "http_inspect.h"
 
 #include "detection/detection_engine.h"
+#include "detection/detection_util.h"
 #include "log/unified2.h"
 #include "protocols/packet.h"
 #include "stream/stream.h"
@@ -274,6 +275,13 @@ void HttpInspect::eval(Packet* p)
     if (session_data->section_type[source_id] == SEC__NOT_COMPUTE)
         return;
 
+    // Limit alt_dsize of message body sections to request/response depth
+    if ((session_data->detect_depth_remaining[source_id] > 0) &&
+        (session_data->detect_depth_remaining[source_id] < p->dsize))
+    {
+        p->set_detect_limit(session_data->detect_depth_remaining[source_id]);
+    }
+
     const int remove_workaround = session_data->zero_byte_workaround[source_id] ? 1 : 0;
     if (!process(p->data, p->dsize - remove_workaround, p->flow, source_id, true))
     {
index 724a83e07764d02e7fd9a41b8961f55134833a2d..15ed164fbcefc6d7a3c498f82ee7ba39e32d604a 100644 (file)
@@ -99,13 +99,13 @@ IpsOption::EvalStatus ModbusUnitOption::eval(Cursor&, Packet* p)
 static const Parameter s_params[] =
 {
     { "~", Parameter::PT_INT, "0:255", nullptr,
-      "modbus unit ID" },
+      "Modbus unit ID" },
 
     { nullptr, Parameter::PT_MAX, nullptr, nullptr, nullptr }
 };
 
 #define s_help \
-    "rule option to check modbus unit ID"
+    "rule option to check Modbus unit ID"
 
 class ModbusUnitModule : public Module
 {
index 27412f40d67f8f51bfc6ce1e778e7224a4aa1fc2..6867abed9b085f3ba0c0228ced7ce429a1a7dd67 100644 (file)
@@ -90,7 +90,7 @@ static const Parameter s_params[] =
       "maximum via field size" },
 
     { "methods", Parameter::PT_STRING, nullptr, default_methods,
-      "list of methods to check in sip messages" },
+      "list of methods to check in SIP messages" },
 
     { nullptr, Parameter::PT_MAX, nullptr, nullptr, nullptr }
 };
@@ -133,8 +133,8 @@ static const PegInfo sip_pegs[] =
 {
     { CountType::SUM, "packets", "total packets" },
     { CountType::SUM, "sessions", "total sessions" },
-    { CountType::NOW, "concurrent_sessions", "total concurrent sip sessions" },
-    { CountType::MAX, "max_concurrent_sessions", "maximum concurrent sip sessions" },
+    { CountType::NOW, "concurrent_sessions", "total concurrent SIP sessions" },
+    { CountType::MAX, "max_concurrent_sessions", "maximum concurrent SIP sessions" },
     { CountType::SUM, "events", "events generated" },
     { CountType::SUM, "dialogs", "total dialogs" },
     { CountType::SUM, "ignored_channels", "total channels ignored" },
index f96c40cb143f79757f58f91525d11265ef8db2cf..9311e6b8c21bf75a18ba1362d0c61a71af3c7d76 100644 (file)
@@ -1215,7 +1215,6 @@ static void snort_smtp(SMTP_PROTO_CONF* config, Packet* p)
 
     /* reset normalization stuff */
     smtp_normalizing = false;
-    SetDetectLimit(p, 0);
 
     if (pkt_dir == SMTP_PKT_FROM_SERVER)
     {
index d80268821e3062db1664344925aa215f7eed83ca..873fa6d2df4f477b83e2bc8bb36d0810cc1817d6 100644 (file)
@@ -99,7 +99,6 @@ int SMTP_CopyToAltBuffer(Packet* p, const uint8_t* start, int length)
 
     if ((unsigned long)length > alt_size - buf.len)
     {
-        //SetDetectLimit(p, 0);
         smtp_normalizing = false;
         return -1;
     }
index 7ceccf75637096442c53a5169f39aa5ff9237c59..886876e101d676a4600b35642a4ce52a73b3bb6f 100644 (file)
@@ -89,6 +89,23 @@ public:
 
     bool is_paf() override { return true; }
 
+private:
+    void count_scan(const Flow* f)
+    {
+        if ( f->pkt_type == PktType::TCP )
+            ++tstats.tcp_scans;
+        else
+            ++tstats.user_scans;
+    }
+
+    void count_hit(const Flow* f)
+    {
+        if ( f->pkt_type == PktType::TCP )
+            ++tstats.tcp_hits;
+        else
+            ++tstats.user_hits;
+    }
+
 private:
     Wizard* wizard;
     Wand wand;
@@ -152,10 +169,10 @@ StreamSplitter::Status MagicSplitter::scan(
     uint32_t, uint32_t*)
 {
     Profile profile(wizPerfStats);
-    ++tstats.tcp_scans;
+    count_scan(f);
 
     if ( wizard->cast_spell(wand, f, data, len) )
-        ++tstats.tcp_hits;
+        count_hit(f);
 
     else if ( wizard->finished(wand) )
         return ABORT;
index 4d046ff8f37b3ea8301acd17e4449d34fc47b00c..f1909e42c3fa664bed867bc3c2068c90e049f0b7 100644 (file)
@@ -59,7 +59,7 @@ CACHE_PARAMS(file_params,    "128",  "30",  "180", "5");
 static const Parameter s_params[] =
 {
     { "footprint", Parameter::PT_INT, "0:", "0",
-      "use zero for production, non-zero for testing at given size (for tcp and user)" },
+      "use zero for production, non-zero for testing at given size (for TCP and user)" },
 
     { "ip_frags_only", Parameter::PT_BOOL, nullptr, "false",
       "don't process non-frag flows" },
index a660ac76ab0c76a145d3affd00436c3ec8e92ba0..e240ca807a09ac8c85765857e8138000b6a1a1b0 100644 (file)
@@ -111,7 +111,7 @@ static const Parameter s_params[] =
       "alert if fragment length is below this limit before or after trimming" },
 
     { "min_ttl", Parameter::PT_INT, "1:255", "1",
-      "discard fragments with ttl below the minimum" },
+      "discard fragments with TTL below the minimum" },
 
     { "policy", Parameter::PT_ENUM, IP_POLICIES, "linux",
       "fragment reassembly policy" },
index 8da998aaf784ee3e220e5e1fd546224e00249ef9..dbbf5f534c389d571e4f88e78385a208d790f2ce 100644 (file)
@@ -153,10 +153,10 @@ static const Parameter s_params[] =
       "flush upon seeing a drop in segment size after given number of non-decreasing segments" },
 
     { "ignore_any_rules", Parameter::PT_BOOL, nullptr, "false",
-      "process tcp content rules w/o ports only if rules with ports are present" },
+      "process TCP content rules w/o ports only if rules with ports are present" },
 
     { "max_window", Parameter::PT_INT, "0:1073725440", "0",
-      "maximum allowed tcp window" },
+      "maximum allowed TCP window" },
 
     { "overlap_limit", Parameter::PT_INT, "0:255", "0",
       "maximum number of allowed overlapping segments per session" },
index 4c5609634baeb62cc0ec46b546086b026c97a00d..366ba9cf675c2778050cf0297b22ad08445ec3f7 100644 (file)
@@ -38,7 +38,7 @@ static const Parameter s_params[] =
       "session tracking timeout" },
 
     { "ignore_any_rules", Parameter::PT_BOOL, nullptr, "false",
-      "process udp content rules w/o ports only if rules with ports are present" },
+      "process UDP content rules w/o ports only if rules with ports are present" },
 
     { nullptr, Parameter::PT_MAX, nullptr, nullptr, nullptr }
 };
index f06b46124d02218997e6680a879b4da139594e9e..4a0e51c4e2eb18ca63d09498ecb18a8bf6abc948 100644 (file)
@@ -56,8 +56,8 @@ bool Detection::convert(std::istringstream& data_stream)
 
         else if (keyword == "no_stream_inserts")
         {
-            table_api.add_diff_option_comment("no_stream_inserts", "inspect_stream_inserts");
-            tmpval = table_api.add_option("inspect_stream_inserts", false);
+            table_api.add_diff_option_comment("no_stream_inserts", "detect_raw_tcp");
+            tmpval = table_api.add_option("detect_raw_tcp", false);
         }
 
         else if (keyword == "debug")
index 6e155779ebecb09265d656fc485954a2462cd9f9..92e993e721ce045c4200fd01d58476212d9c454b 100644 (file)
@@ -72,8 +72,6 @@ bool File::convert(std::istringstream& data_stream)
     while(util::get_string(data_stream, key_value_pair, ";"))
     {
         std::istringstream arg_stream(key_value_pair);
-        std::vector<std::string> word_list;
-
         util::trim(key_value_pair);
 
         size_t pos = key_value_pair.find_first_of(':');
index 754f29612a94437e93b5f6e810e14b58a70e4347..995d29214bfa4ca40415f858abaf5fa93b39fc35 100644 (file)
@@ -42,12 +42,13 @@ private:
 
 bool PerfMonitor::convert(std::istringstream& data_stream)
 {
-    std::string keyword;
-    bool retval = true;
-
     table_api.open_table("perf_monitor");
-    retval |= table_api.add_option("base", true);
-    retval |= table_api.add_option("cpu", true);
+
+    bool retval =
+        table_api.add_option("base", true) and
+        table_api.add_option("cpu", true);
+
+    std::string keyword;
 
     while (data_stream >> keyword)
     {