From: Michael Altizer (mialtize) Date: Tue, 18 Apr 2017 17:06:57 +0000 (-0400) Subject: Merge pull request #860 in SNORT/snort3 from icc to master X-Git-Tag: 3.0.0-233~27 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=f560606f397fe382b38655bdf0f8d78ede795d77;p=thirdparty%2Fsnort3.git Merge pull request #860 in SNORT/snort3 from icc to master Squashed commit of the following: commit ca572eec71be76e79be4384f46444a5bbe6c3d52 Author: Michael Altizer Date: Mon Apr 17 17:59:51 2017 -0400 build: Clean up Intel compiler warnings and remarks --- diff --git a/extra/src/inspectors/http_server/hi_si.cc b/extra/src/inspectors/http_server/hi_si.cc index d57ad7f95..a3845b8a4 100644 --- a/extra/src/inspectors/http_server/hi_si.cc +++ b/extra/src/inspectors/http_server/hi_si.cc @@ -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; diff --git a/src/managers/so_manager.cc b/src/managers/so_manager.cc index a29e1c1a5..40da2e232 100644 --- a/src/managers/so_manager.cc +++ b/src/managers/so_manager.cc @@ -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]; diff --git a/src/network_inspectors/appid/appid_config.cc b/src/network_inspectors/appid/appid_config.cc index ea43c8fd2..c1d38f8b0 100644 --- a/src/network_inspectors/appid/appid_config.cc +++ b/src/network_inspectors/appid/appid_config.cc @@ -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); diff --git a/src/network_inspectors/appid/appid_config.h b/src/network_inspectors/appid/appid_config.h index 4b2536094..ededb3cdd 100644 --- a/src/network_inspectors/appid/appid_config.h +++ b/src/network_inspectors/appid/appid_config.h @@ -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; diff --git a/src/network_inspectors/appid/appid_module.cc b/src/network_inspectors/appid/appid_module.cc index ed3be6d3d..c0d17f285 100644 --- a/src/network_inspectors/appid/appid_module.cc +++ b/src/network_inspectors/appid/appid_module.cc @@ -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 diff --git a/src/network_inspectors/appid/appid_stats.cc b/src/network_inspectors/appid/appid_stats.cc index 7302abe02..b8a0dca94 100644 --- a/src/network_inspectors/appid/appid_stats.cc +++ b/src/network_inspectors/appid/appid_stats.cc @@ -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; diff --git a/src/network_inspectors/appid/detector_plugins/detector_dns.h b/src/network_inspectors/appid/detector_plugins/detector_dns.h index 822996136..046ae1d4c 100644 --- a/src/network_inspectors/appid/detector_plugins/detector_dns.h +++ b/src/network_inspectors/appid/detector_plugins/detector_dns.h @@ -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*); diff --git a/src/network_inspectors/appid/detector_plugins/detector_smtp.cc b/src/network_inspectors/appid/detector_plugins/detector_smtp.cc index 2e20abb24..668f83077 100644 --- a/src/network_inspectors/appid/detector_plugins/detector_smtp.cc +++ b/src/network_inspectors/appid/detector_plugins/detector_smtp.cc @@ -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); } diff --git a/src/network_inspectors/appid/service_plugins/service_discovery.cc b/src/network_inspectors/appid/service_plugins/service_discovery.cc index 1a49f3262..960edd39b 100644 --- a/src/network_inspectors/appid/service_plugins/service_discovery.cc +++ b/src/network_inspectors/appid/service_plugins/service_discovery.cc @@ -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(), diff --git a/src/network_inspectors/appid/service_state.cc b/src/network_inspectors/appid/service_state.cc index e5704db78..9e25e2b06 100644 --- a/src/network_inspectors/appid/service_state.cc +++ b/src/network_inspectors/appid/service_state.cc @@ -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); } } diff --git a/src/network_inspectors/perf_monitor/base_tracker.cc b/src/network_inspectors/perf_monitor/base_tracker.cc index e0d6ca2f0..9f792fcf7 100644 --- a/src/network_inspectors/perf_monitor/base_tracker.cc +++ b/src/network_inspectors/perf_monitor/base_tracker.cc @@ -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(); } diff --git a/src/service_inspectors/http_inspect/http_stream_splitter_scan.cc b/src/service_inspectors/http_inspect/http_stream_splitter_scan.cc index b799348f2..904feb149 100644 --- a/src/service_inspectors/http_inspect/http_stream_splitter_scan.cc +++ b/src/service_inspectors/http_inspect/http_stream_splitter_scan.cc @@ -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()) diff --git a/src/service_inspectors/sip/sip_parser.cc b/src/service_inspectors/sip/sip_parser.cc index 5007e9981..a6cd1f3a7 100644 --- a/src/service_inspectors/sip/sip_parser.cc +++ b/src/service_inspectors/sip/sip_parser.cc @@ -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); diff --git a/src/sfip/sf_cidr.cc b/src/sfip/sf_cidr.cc index ba062d30f..bd7b51c4d 100644 --- a/src/sfip/sf_cidr.cc +++ b/src/sfip/sf_cidr.cc @@ -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 diff --git a/src/stream/icmp/icmp_module.cc b/src/stream/icmp/icmp_module.cc index 767ee1fe5..dd48a71a3 100644 --- a/src/stream/icmp/icmp_module.cc +++ b/src/stream/icmp/icmp_module.cc @@ -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); } diff --git a/src/stream/ip/ip_module.cc b/src/stream/ip/ip_module.cc index c944cfabf..f2bddcddd 100644 --- a/src/stream/ip/ip_module.cc +++ b/src/stream/ip/ip_module.cc @@ -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); } diff --git a/src/stream/tcp/tcp_event_logger.cc b/src/stream/tcp/tcp_event_logger.cc index 3c0191f31..876de1c8a 100644 --- a/src/stream/tcp/tcp_event_logger.cc +++ b/src/stream/tcp/tcp_event_logger.cc @@ -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); } } diff --git a/src/stream/tcp/tcp_module.cc b/src/stream/tcp/tcp_module.cc index cc0eccbb1..9fb21ce4f 100644 --- a/src/stream/tcp/tcp_module.cc +++ b/src/stream/tcp/tcp_module.cc @@ -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); } diff --git a/src/stream/tcp/tcp_reassembler.cc b/src/stream/tcp/tcp_reassembler.cc index 5197ec5cd..d3dd1b5a3 100644 --- a/src/stream/tcp/tcp_reassembler.cc +++ b/src/stream/tcp/tcp_reassembler.cc @@ -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; }