]> git.ipfire.org Git - thirdparty/snort3.git/commitdiff
Merge pull request #860 in SNORT/snort3 from icc to master
authorMichael Altizer (mialtize) <mialtize@cisco.com>
Tue, 18 Apr 2017 17:06:57 +0000 (13:06 -0400)
committerMichael Altizer (mialtize) <mialtize@cisco.com>
Tue, 18 Apr 2017 17:06:57 +0000 (13:06 -0400)
Squashed commit of the following:

commit ca572eec71be76e79be4384f46444a5bbe6c3d52
Author: Michael Altizer <mialtize@cisco.com>
Date:   Mon Apr 17 17:59:51 2017 -0400

    build: Clean up Intel compiler warnings and remarks

19 files changed:
extra/src/inspectors/http_server/hi_si.cc
src/managers/so_manager.cc
src/network_inspectors/appid/appid_config.cc
src/network_inspectors/appid/appid_config.h
src/network_inspectors/appid/appid_module.cc
src/network_inspectors/appid/appid_stats.cc
src/network_inspectors/appid/detector_plugins/detector_dns.h
src/network_inspectors/appid/detector_plugins/detector_smtp.cc
src/network_inspectors/appid/service_plugins/service_discovery.cc
src/network_inspectors/appid/service_state.cc
src/network_inspectors/perf_monitor/base_tracker.cc
src/service_inspectors/http_inspect/http_stream_splitter_scan.cc
src/service_inspectors/sip/sip_parser.cc
src/sfip/sf_cidr.cc
src/stream/icmp/icmp_module.cc
src/stream/ip/ip_module.cc
src/stream/tcp/tcp_event_logger.cc
src/stream/tcp/tcp_module.cc
src/stream/tcp/tcp_reassembler.cc

index d57ad7f9539e12fb07c4cd7dd29c7f4a4d4a03bc..a3845b8a4e5cb5370ca18a03d4d7856c2cdd07bc 100644 (file)
@@ -78,12 +78,6 @@ static int InitServerConf(HTTPINSPECT_CONF* GlobalConf,
     int iServerSip;
     int iServerDip;
     int http_id_found = 0;
-    SfIp sip;
-    SfIp dip;
-
-    //structure copy
-    sip = SiInput->sip;
-    dip = SiInput->dip;
 
     ServerConfDip = ServerConfSip = GlobalConf;
 
index a29e1c1a501614a8b72a1f28aa23ff9bc211dac1..40da2e23204a6db9f5116a23a5fbcee5257fe0d8 100644 (file)
@@ -66,7 +66,7 @@ void SoManager::dump_plugins()
 //-------------------------------------------------------------------------
 
 // FIXIT-L eliminate this arbitrary limit on rule text size
-const unsigned window_bits = -9;
+const int window_bits = -9;
 const unsigned max_rule = 128000;
 static uint8_t so_buf[max_rule];
 
index ea43c8fd2d7e7f2a7d5ab2b27cb255e653925c07..c1d38f8b005f0b50d755bd638d406a96efe0a19b 100644 (file)
@@ -76,7 +76,7 @@ AppIdModuleConfig::AppIdModuleConfig()
 
 AppIdModuleConfig::~AppIdModuleConfig()
 {
-#if USE_RNA_CONFIG
+#ifdef USE_RNA_CONFIG
     snort_free((void*)conf_file);
 #endif
     snort_free((void*)app_detector_dir);
@@ -296,7 +296,7 @@ next:   ;
     globfree(&globs);
 }
 
-#if USE_RNA_CONFIG
+#ifdef USE_RNA_CONFIG
 void AppIdConfig::configure_analysis_networks(char* toklist[], uint32_t flag)
 {
     int zone;
@@ -717,7 +717,7 @@ bool AppIdConfig::init_appid( )
     map_app_names_to_snort_ids();
     AppIdUtils::init_netmasks(app_id_netmasks);
     app_info_mgr.init_appid_info_table(mod_config);
-#if USE_RNA_CONFIG
+#ifdef USE_RNA_CONFIG
     load_analysis_config(mod_config->conf_file, 0, mod_config->instance_id);
 #endif
     read_port_detectors(ODP_PORT_DETECTORS);
index 4b2536094b4eb298018ca4c1ed5e9f8f39b06fd3..ededb3cdd3096eb9a6f065c81ebd93b3329b582d 100644 (file)
@@ -94,7 +94,7 @@ public:
     AppIdModuleConfig();
     ~AppIdModuleConfig();
 
-#if USE_RNA_CONFIG
+#ifdef USE_RNA_CONFIG
     const char* conf_file = nullptr;
 #endif
     bool stats_logging_enabled = false;
index ed3be6d3dbb23dfca0918e10665f7bd2e0f6edca..c0d17f285774de70f835f525ed1230bebc6f6bec 100644 (file)
@@ -136,7 +136,7 @@ static const Parameter session_log_filter[] =
 
 static const Parameter s_params[] =
 {
-#if USE_RNA_CONFIG
+#ifdef USE_RNA_CONFIG
     { "conf", Parameter::PT_STRING, nullptr, nullptr,
       "RNA configuration file" },  // FIXIT-L eliminate reference to "RNA"
 #endif
@@ -202,7 +202,7 @@ const AppIdModuleConfig* AppIdModule::get_data()
 
 bool AppIdModule::set(const char*, Value& v, SnortConfig*)
 {
-#if USE_RNA_CONFIG
+#ifdef USE_RNA_CONFIG
     if ( v.is("conf") )
         config->conf_file = snort_strdup(v.get_string());
     else
index 7302abe020536b4954fab2f43c79b8cd6d681c55..b8a0dca948c0658d0ee787faf6706fc69721a6c8 100644 (file)
@@ -232,9 +232,9 @@ void AppIdStatistics::dump_statistics()
                 else
                 {
                     if (cooked_client)
-                        snprintf(tmpBuff, MAX_EVENT_APPNAME_LEN, "_err_cl_%u",app_id);
+                        snprintf(tmpBuff, MAX_EVENT_APPNAME_LEN, "_err_cl_%d",app_id);
                     else
-                        snprintf(tmpBuff, MAX_EVENT_APPNAME_LEN, "_err_%u",app_id);
+                        snprintf(tmpBuff, MAX_EVENT_APPNAME_LEN, "_err_%d",app_id);
 
                     tmpBuff[MAX_EVENT_APPNAME_LEN - 1] = 0;
                     app_name = tmpBuff;
index 822996136ea42f9a2a068d6a8fbe914d9771a821..046ae1d4c44d512671cfdf8e5c6115660e7b389f 100644 (file)
@@ -52,7 +52,7 @@ public:
         unsigned host_reporting, AppIdSession*);
 };
 
-class DnsTcpServiceDetector : public ServiceDetector, DnsValidator
+class DnsTcpServiceDetector : public ServiceDetector, public DnsValidator
 {
 public:
     DnsTcpServiceDetector(ServiceDiscovery*);
@@ -61,7 +61,7 @@ public:
     int validate(AppIdDiscoveryArgs&) override;
 };
 
-class DnsUdpServiceDetector : public ServiceDetector, DnsValidator
+class DnsUdpServiceDetector : public ServiceDetector, public DnsValidator
 {
 public:
     DnsUdpServiceDetector(ServiceDiscovery*);
index 2e20abb249eb91aecfcc07117fbe3fd484299ac8..668f83077eeffc3cd447201c4f3cbd61a7145222 100644 (file)
@@ -135,7 +135,6 @@ static const uint8_t APP_SMTP_MOZILLA[] = "Mozilla";
 static const uint8_t APP_SMTP_THUNDERBIRD_SHORT[] = "Thunderbird/";
 
 static THREAD_LOCAL SmtpClientDetector* smtp_client_detector = nullptr;
-static THREAD_LOCAL SmtpServiceDetector* smtp_service_detector = nullptr;
 
 SmtpClientDetector::SmtpClientDetector(ClientDiscovery* cdm)
 {
@@ -673,7 +672,6 @@ SmtpServiceDetector::SmtpServiceDetector(ServiceDiscovery* sd)
         { SMTPS_DEPRECATED_PORT, IpProtocol::TCP, false }
     };
 
-    smtp_service_detector = this;
     handler->register_detector(name, this, proto);
 }
 
index 1a49f326284aec35c9616277969bd4c0d6fb7a71..960edd39b745b65b0f030d6a8c6bd504ed090c41 100644 (file)
@@ -359,10 +359,10 @@ void ServiceDiscovery::get_next_service(const Packet* p, const int dir,
                 && (proto == IpProtocol::UDP) && !asd->tried_reverse_service )
             {
                 asd->tried_reverse_service = true;
-                ServiceDiscoveryState* sds = AppIdServiceState::get(p->ptrs.ip_api.get_src(),
+                ServiceDiscoveryState* rsds = AppIdServiceState::get(p->ptrs.ip_api.get_src(),
                     proto, p->ptrs.sp, asd->is_decrypted());
-                if ( sds && sds->service )
-                    asd->service_candidates.push_back(sds->service);
+                if ( rsds && rsds->service )
+                    asd->service_candidates.push_back(rsds->service);
                 else if ( udp_reversed_services[p->ptrs.sp].size() )
                 {
                     asd->service_candidates.insert(asd->service_candidates.end(),
index e5704db784ebac4f065de08aa9bc0c92a5ce14c8..9e25e2b066b47b6022b5513b23c4e675da0f03a1 100644 (file)
@@ -259,7 +259,7 @@ void AppIdServiceState::remove(const SfIp* ip, IpProtocol proto, uint16_t port,
 
         ipstr[0] = 0;
         sfip_ntop(ip, ipstr, sizeof(ipstr));
-        ErrorMessage("Failed to remove from hash: %s:%u:%u\n", ipstr, (unsigned)proto, port);
+        ErrorMessage("Failed to remove from hash: %s:%u:%hu\n", ipstr, (unsigned)proto, port);
     }
 }
 
index e0d6ca2f093404be29147b185fcdf17ecbf3fe9f..9f792fcf7e4f91f2b0b2a6269c714cc5e3a27e20 100644 (file)
@@ -41,8 +41,8 @@ BaseTracker::BaseTracker(PerfConfig* perf)
 
         formatter->register_section(m->get_name());
 
-        for (auto const& i : peg_map)
-            formatter->register_field(m->get_pegs()[i].name, &(m->get_counts()[i]));
+        for (auto const& peg : peg_map)
+            formatter->register_field(m->get_pegs()[peg].name, &(m->get_counts()[peg]));
     }
     formatter->finalize_fields();
 }
index b799348f2a406cfc3e49b8abe31258e4092b2dea..904feb149f07a8225e9eb50f5939393046d0a65f 100644 (file)
@@ -115,7 +115,7 @@ StreamSplitter::Status HttpStreamSplitter::scan(Flow* flow, const uint8_t* data,
     else if (HttpTestManager::use_test_output())
     {
         printf("Scan from flow data %" PRIu64
-            " direction %d length %u client port %u server port %u\n", session_data->seq_num,
+            " direction %d length %u client port %hu server port %hu\n", session_data->seq_num,
             source_id, length, flow->client_port, flow->server_port);
         fflush(stdout);
         if (HttpTestManager::get_show_scan())
index 5007e9981fe3623f4f6bfaea99f702551b9b8db0..a6cd1f3a737ffdc5aac674816d2f5837a6c5b898 100644 (file)
@@ -382,7 +382,6 @@ static bool sip_startline_parse(SIPMsg* msg, const char* buff, char* end, char**
     {
         char* space;
         char* version;
-        int length;
         SIPMethodNode* method;
 
         /*Process request*/
@@ -392,9 +391,8 @@ static bool sip_startline_parse(SIPMsg* msg, const char* buff, char* end, char**
         space = (char*)memchr(buff, ' ', end - buff);
         if (space == NULL)
             return false;
-        length = space - buff;
         msg->method = (char*)buff;
-        msg->methodLen = length;
+        msg->methodLen = space - buff;
         DebugFormat(DEBUG_SIP, "method: %.*s\n", msg->methodLen, msg->method);
 
         method = SIP_FindMethod (config->methods, msg->method, msg->methodLen);
index ba062d30f8b8c4c8881017ecf584b030d4ab4fba..bd7b51c4d32337593f2e7b7d427bbb463a6dfc10 100644 (file)
@@ -35,7 +35,7 @@ SfIpRet SfCidr::set(const char* src)
 */
 SfIpRet SfCidr::contains(const SfIp* ip) const
 {
-    unsigned int mask, temp, i;
+    uint16_t i;
     const uint32_t* pn, * pi;
 
     /* SFIP_CONTAINS is returned here due to how sfvar_ip_in
@@ -53,14 +53,14 @@ SfIpRet SfCidr::contains(const SfIp* ip) const
             return SFIP_NOT_CONTAINS;
     }
 
-    mask = 32 - (bits - 32 * i);
+    unsigned int mask = 32 - (bits - 32 * i);
     if (mask == 32)
         return SFIP_CONTAINS;
 
     /* At this point, there are some number of remaining bits to check.
      * Mask the bits we don't care about off of "ip" so we can compare
      * the ints directly */
-    temp = ntohl(*pi);
+    unsigned int temp = ntohl(*pi);
     temp = (temp >> mask) << mask;
 
     /* If pn was setup correctly through this library, there is no need to
index 767ee1fe5a4d81e49e02b45b43e3360224816f72..dd48a71a312730f7fe98c66d110d713bdaf56df3 100644 (file)
@@ -99,7 +99,7 @@ void StreamIcmpModule::sum_stats(bool accumulate_now_stats)
     assert(sizeof(IcmpStats)/sizeof(PegCount) == sizeof(IcmpStatTypes)/sizeof(CountType));
 
     static const IcmpStatTypes icmp_stat_types;
-    static const CountType* const count_types = (const CountType* const)&icmp_stat_types;
+    static const CountType* const count_types = (const CountType*)&icmp_stat_types;
 
     sum_stats_helper(accumulate_now_stats, count_types);
 }
index c944cfabfbf4a6e24889518d81220244aa8e38c2..f2bddcddd5bb736abf9762ba2a088234e93a0172 100644 (file)
@@ -222,7 +222,7 @@ void StreamIpModule::sum_stats(bool accumulate_now_stats)
     assert(sizeof(IpStats)/sizeof(PegCount) == sizeof(IpStatTypes)/sizeof(CountType));
 
     static const IpStatTypes ip_stat_types;
-    static const CountType* const count_types = (const CountType* const)&ip_stat_types;
+    static const CountType* const count_types = (const CountType*)&ip_stat_types;
 
     sum_stats_helper(accumulate_now_stats, count_types);
 }
index 3c0191f31506cb5d1bd89c3e2bbf9162e6b66973..876de1c8af62540a4fc74bc51b54fe98c359fd6c 100644 (file)
@@ -93,7 +93,7 @@ void TcpEventLogger::log_internal_event(uint32_t eventSid)
     {
         tcpStats.internalEvents++;
         SnortEventqAdd(GENERATOR_INTERNAL, eventSid);
-        DebugFormat(DEBUG_STREAM, "Stream raised internal event %d\n", eventSid);
+        DebugFormat(DEBUG_STREAM, "Stream raised internal event %u\n", eventSid);
     }
 }
 
index cc0eccbb1c0507f01d03dae5646da34381631ff7..9fb21ce4f527b4b15d0d6cdc9cfaf61a76883410 100644 (file)
@@ -370,7 +370,7 @@ void StreamTcpModule::sum_stats(bool accumulate_now_stats)
     assert(sizeof(TcpStats)/sizeof(PegCount) == sizeof(TcpStatTypes)/sizeof(CountType));
 
     static const TcpStatTypes tcp_stat_types;
-    static const CountType* const count_types = (const CountType* const)&tcp_stat_types;
+    static const CountType* const count_types = (const CountType*)&tcp_stat_types;
 
     sum_stats_helper(accumulate_now_stats, count_types);
 }
index 5197ec5cd65aed0581f8500e46cb5948c398e824..d3dd1b5a3c56dc90b0568837751ac34b2c64c557 100644 (file)
@@ -680,7 +680,7 @@ int TcpReassembler::flush_to_seq(uint32_t bytes, Packet* p, uint32_t pkt_flags)
 {
     if ( !bytes || !seglist.next )
     {
-        DebugFormat(DEBUG_STREAM_STATE, "bailing: no bytes: %d or empty seglist: %p\n",
+        DebugFormat(DEBUG_STREAM_STATE, "bailing: no bytes: %u or empty seglist: %p\n",
             bytes, (void*)seglist.next);
         return 0;
     }