]> git.ipfire.org Git - thirdparty/snort3.git/commitdiff
FIXITs
authorRuss Combs <rucombs@cisco.com>
Wed, 20 Aug 2014 18:12:32 +0000 (14:12 -0400)
committerRuss Combs <rucombs@cisco.com>
Wed, 20 Aug 2014 18:12:32 +0000 (14:12 -0400)
15 files changed:
ChangeLog
doc/style.txt
src/framework/CMakeLists.txt
src/framework/Makefile.am
src/framework/share.h [deleted file]
src/loggers/alert_test.cc
src/managers/data_manager.cc
src/managers/data_manager.h
src/network_inspectors/port_scan/port_scan.cc
src/protocols/packet.h
src/service_inspectors/ftp_telnet/ftp.cc
src/service_inspectors/ftp_telnet/ftp_data.cc
src/service_inspectors/http_inspect/http_inspect.cc
src/stream/base/stream_base.cc
src/stream/ip/ip_defrag.cc

index 7155e0eb5f89bb8249b63de143d6d5c81921dcdb..5c98e63585ab993effdfaa719e475296cbb1a8f3 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+115
+-- remove share.h
+-- misc FIXITs
+
 114
 -- more FIXIT cleanup
 -- fixed flush bucket dumping
index 947599273585eb23a3248be501085abf9ed73228..61e89f123ac7959b5a0935ec90c3d46cda403d79 100644 (file)
@@ -25,7 +25,15 @@ yet firm so feedback is welcome to get something we can live with.
 * Function comment blocks are generally just noise that quickly becomes
   obsolete.  If you absolutely must comment on parameters, put each on a
   separate line along with the comment.  That way changing the signature
-  will cause a change to the comments too.
+  may prompt a change to the comments too.
+
+* Use FIXIT (not FIXTHIS or TODO or whatever) to mark things left for a
+  day or even in just a minute.  That way we can find them easily and won't
+  lose track of them.
+
+* Presently using FIXIT-X where X = P | H | M | L, indicating perf, high,
+  med, or low priority.  For now, H, M, or L can indicate alpha 1, 2, or 3.
+  Perf changes fall between alpha 1 and 2.
 
 ==== Types
 
index bd58d823c98ca520e9e2359a4590595e70995ea6..4afab657c96177a1f775b4ecdac6ace335d0173d 100644 (file)
@@ -13,7 +13,6 @@ set (FRAMEWORK_INCLUDES
     mpse.h
     parameter.h
     plug_data.h
-    share.h
     so_rule.h
     value.h
 )
index 1c2a5f9c9b34c933fb12fce79474648d9df4476d..13204d47efeab5550e2eaf96e691c4631a291bf9 100644 (file)
@@ -17,7 +17,6 @@ module.h \
 mpse.h \
 parameter.h \
 plug_data.h \
-share.h \
 so_rule.h \
 value.h
 
diff --git a/src/framework/share.h b/src/framework/share.h
deleted file mode 100644 (file)
index 88e4a23..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
-** Copyright (C) 2014 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.
-*/
-// share.h author Russ Combs <rucombs@cisco.com>
-
-#ifndef SHARE_H
-#define SHARE_H
-
-// FIXIT remove this dependency once stuff works
-// need to move below to share.cc or 
-// move below data mgr calls to share.cc
-// need to build dynamic plugins and on linux to verify
-#include "managers/data_manager.h"
-
-class PlugData;
-
-class Share
-{
-public:
-    static PlugData* acquire(const char* key)
-    { return DataManager::acquire(key); };
-
-    static void release(PlugData* p)
-    { return DataManager::release(p); };
-};
-
-#endif
-
index 06be0603df1ea1f1c34cdfe3c32653b231fdf7e8..83da6a9d0f7f055214804f535ecb2e54e3a0e37b 100644 (file)
@@ -181,16 +181,24 @@ void TestLogger::alert(Packet *p, const char *msg, Event *event)
     if (flags & TEST_FLAG_SESSION)
         LogIpAddrs(test_file, p);
 
-#if 0
-    if (flags & TEST_FLAG_REBUILT)
+    if ( (flags & TEST_FLAG_REBUILT) && (p->packet_flags && PKT_PSEUDO) )
     {
-        if (p->packet_flags & PKT_REBUILT_FRAG)
-            //TextLog_Print(test_file, "F:" STDu64 "\t", pc.rebuilt_frags);  FIXIT count in f3
-            //
-        else if (p->packet_flags & PKT_REBUILT_STREAM)
-            //TextLog_Print(test_file, "S:" STDu64 "\t", pc.rebuilt_tcp);  FIXIT count in s5
+        const char* s;
+        switch ( p->pseudo_type )
+        {
+        case PSEUDO_PKT_IP: s = "ip-defrag"; break;
+        case PSEUDO_PKT_TCP: s = "tcp-deseg"; break;
+        case PSEUDO_PKT_DCE_RPKT: s = "dce-pkt"; break;
+        case PSEUDO_PKT_DCE_SEG: s = "dce-deseg"; break;
+        case PSEUDO_PKT_DCE_FRAG: s = "dec-defrag"; break;
+        case PSEUDO_PKT_SMB_SEG: s = "smb-deseg"; break;
+        case PSEUDO_PKT_SMB_TRANS: s = "smb-trans"; break;
+        case PSEUDO_PKT_PS: s = "port_scan"; break;
+        case PSEUDO_PKT_SDF: s = "sdf"; break;
+        default: s = "pseudo pkt"; break;
+        }
+        TextLog_Print(test_file, "%s", s);
     }
-#endif
     TextLog_Print(test_file, "\n");
     TextLog_Flush(test_file);
 }
index d31e2e417e2c4957c5d1af565cf52294cf94291e..3cf30de48eea3d5c32a7d27b9f02a8486034e2e5 100644 (file)
@@ -92,7 +92,7 @@ void DataManager::instantiate(
         b->data = api->ctor(mod);
 }
 
-PlugData* DataManager::acquire(const char* key)
+PlugData* DataManager::acquire(const char* key, SnortConfig* sc)
 {
     DataBlock* b = get_data(key);
     assert(b);
@@ -101,7 +101,7 @@ PlugData* DataManager::acquire(const char* key)
     {
         // create default instance
         Module* mod = ModuleManager::get_module(key);
-        mod->begin(key, 0, nullptr);  // FIXIT really need sc?
+        mod->begin(key, 0, sc);
         mod->end(key, 0, nullptr);
         b->data = b->api->ctor(mod);
     }
index 871eb1c953f56713ad810e71e37f43b2e6b2f4ed..4585051ef66b7aaa579fc58ab8ebe5e8ba7758c6 100644 (file)
@@ -34,7 +34,7 @@ public:
 
     static void instantiate(const DataApi*, Module*, SnortConfig*);
 
-    static PlugData* acquire(const char* key);
+    static PlugData* acquire(const char* key, SnortConfig*);
     static void release(PlugData*);
 };
 
index 6971dda6fd289306b5a769b5499fbe703cf79137..5e7a7f282ef3d9c74ac7e4f8cfef4d9a13d8eab0 100644 (file)
@@ -56,6 +56,7 @@
 
 #include "main/analyzer.h"
 #include "protocols/packet.h"
+#include "managers/data_manager.h"
 #include "managers/packet_manager.h"
 #include "event.h"
 #include "event_wrapper.h"
@@ -66,7 +67,6 @@
 #include "filters/sfthreshold.h"
 #include "sfsnprintfappend.h"
 #include "framework/inspector.h"
-#include "framework/share.h"
 #include "framework/plug_data.h"
 #include "profiler.h"
 #include "detection/detect.h"
@@ -849,15 +849,15 @@ PortScan::~PortScan()
         delete config;
 
     if ( global )
-        Share::release(global);
+        DataManager::release(global);
 }
 
-bool PortScan::configure(SnortConfig*)
+bool PortScan::configure(SnortConfig* sc)
 {
     // FIXIT use fixed base file name
     config->logfile = SnortStrdup("portscan.log");
 
-    global = (PsData*)Share::acquire(PS_GLOBAL);
+    global = (PsData*)DataManager::acquire(PS_GLOBAL, sc);
     config->common = global->data;
     return true;
 }
index cc07e901c0e618d044ddbc7fbd62bbf3efb3742e..fc63dc01b994d780fa4b1485f6ee231dc6b49dd8 100644 (file)
@@ -114,9 +114,9 @@ enum PseudoPacketType{
     PSEUDO_PKT_IP,
     PSEUDO_PKT_TCP,
     PSEUDO_PKT_DCE_RPKT,
-    PSEUDO_PKT_SMB_SEG,
     PSEUDO_PKT_DCE_SEG,
     PSEUDO_PKT_DCE_FRAG,
+    PSEUDO_PKT_SMB_SEG,
     PSEUDO_PKT_SMB_TRANS,
     PSEUDO_PKT_PS,
     PSEUDO_PKT_SDF,
index c56217b338699a703f49335bab14e2cc0c7a1b53..54ab645cb537f525358f2b6de46a49dd6cd47a57 100644 (file)
@@ -49,7 +49,7 @@
 #include "parser.h"
 #include "framework/inspector.h"
 #include "framework/plug_data.h"
-#include "framework/share.h"
+#include "managers/data_manager.h"
 #include "detection/detection_util.h"
 
 int16_t ftp_data_app_id = SFTARGET_UNKNOWN_PROTOCOL;
@@ -390,12 +390,12 @@ FtpServer::~FtpServer ()
 
     if ( ftp_client )
         // FIXIT make sure CleanupFTPClientConf() is called
-        Share::release(ftp_client);
+        DataManager::release(ftp_client);
 }
 
 bool FtpServer::configure (SnortConfig* sc)
 {
-    ftp_client = (ClientData*)Share::acquire(client_key);
+    ftp_client = (ClientData*)DataManager::acquire(client_key, sc);
 
     bind_server = ftp_server;
     bind_client = ftp_client->data;
index f164d471e07e0965f10e8abfde64a00720508f88..2b158fc1aa7de3f1ac5fa3f1923e2f29936bef5e 100644 (file)
@@ -49,7 +49,6 @@
 #include "parser.h"
 #include "framework/inspector.h"
 #include "framework/plug_data.h"
-#include "framework/share.h"
 #include "detection/detection_util.h"
 
 static const char* data_key = "ftp_data";
index 410221fc1efd8cd59cb177c264ed4b28f6a0a4c5..de24f11db29842ccf37d1f90bbc67e1fd248901a 100644 (file)
@@ -71,7 +71,7 @@
 #include "file_api/file_api.h"
 #include "sf_email_attach_decode.h"
 #include "framework/inspector.h"
-#include "framework/share.h"
+#include "managers/data_manager.h"
 
 #define ERRSTRLEN 1000
 
@@ -264,7 +264,7 @@ HttpInspect::~HttpInspect ()
         delete config;
 
     if ( global )
-        Share::release(global);
+        DataManager::release(global);
 }
 
 bool HttpInspect::get_buf(
@@ -301,7 +301,7 @@ bool HttpInspect::get_buf(unsigned id, Packet*, InspectionBuffer& b)
 
 bool HttpInspect::configure (SnortConfig* sc)
 {
-    global = (HttpData*)Share::acquire(GLOBAL_KEYWORD);
+    global = (HttpData*)DataManager::acquire(GLOBAL_KEYWORD, sc);
     config->global = global->data;
 
     HttpInspectInitializeGlobalConfig(config->global);
index f6a7fd6e1c867917a0e39ee9d4e347056730a9dc..6f2fd5bad78350f0dc69a9a9701702f83ba420b6 100644 (file)
@@ -32,7 +32,6 @@
 #include "snort_debug.h"
 #include "framework/inspector.h"
 #include "framework/plug_data.h"
-#include "framework/share.h"
 #include "managers/inspector_manager.h"
 #include "managers/module_manager.h"
 #include "flow/flow_control.h"
index 76296f9a48a38d936c01c78f73131846d6c38067..5d52df81c1c495591290c16a6bc310a2381a352a 100644 (file)
 #include "packet_io/active.h"
 #include "packet_io/sfdaq.h"
 #include "framework/inspector.h"
-#include "framework/share.h"
 #include "flow/flow_control.h"
 
 /*  D E F I N E S  **************************************************/