]> git.ipfire.org Git - thirdparty/snort3.git/commitdiff
Merge pull request #635 in SNORT/snort3 from ~MIALTIZE/snort3:os-cleanup to master
authorRuss Combs (rucombs) <rucombs@cisco.com>
Fri, 23 Sep 2016 20:48:52 +0000 (16:48 -0400)
committerRuss Combs (rucombs) <rucombs@cisco.com>
Fri, 23 Sep 2016 20:48:52 +0000 (16:48 -0400)
Squashed commit of the following:

commit c9776312bc8fe2b0320f2e79a068bef2e30d9dae
Author: Michael Altizer <mialtize@cisco.com>
Date:   Fri Sep 23 16:02:19 2016 -0400

    doc: Update style guide for 'using' statements and underscores

commit f8a541ce2ca3c349976f6f03d28ebed3d4e723fc
Author: Michael Altizer <mialtize@cisco.com>
Date:   Fri Sep 23 13:08:24 2016 -0400

    build: Fix 32-bit compiler warnings

commit c3692c6d4c2cafead8a65235b7eb37cb31790ae9
Author: Michael Altizer <mialtize@cisco.com>
Date:   Fri Sep 23 12:33:25 2016 -0400

    build: Fix illumos/OpenSolaris build and remove SOLARIS/SUNOS defines

commit 6315aaf73aeda470b3e698f994282762f2774652
Author: Michael Altizer <mialtize@cisco.com>
Date:   Fri Sep 23 11:21:56 2016 -0400

    packet_capture: Include top-level pcap.h for backward compatibility

commit e2446819cb97c0c3ea5ad38d4c1fdb77a5aa0c16
Author: Michael Altizer <mialtize@cisco.com>
Date:   Fri Sep 23 11:15:58 2016 -0400

    lua: Fix conflict with _L macro from ctype.h on OpenBSD

commit 1c4ac1695457446de11d8d2ad09e5b838514d7b1
Author: Michael Altizer <mialtize@cisco.com>
Date:   Fri Sep 23 02:41:38 2016 -0400

    cmake: Clean dead variables out of config.cmake.h

commit d0ff9dc6e9733e430f207f90ff289053837510fb
Author: Michael Altizer <mialtize@cisco.com>
Date:   Fri Sep 23 02:33:35 2016 -0400

    build: Remove superfluous LINUX and MACOS definitions

    They were only used in C/C++ code and can be replaced with the
    standard C preprocessor macros defined by platform compilers.

commit 368f216086edb97866d3e73939e18cc7c9af86a5
Author: Michael Altizer <mialtize@cisco.com>
Date:   Fri Sep 23 01:54:08 2016 -0400

    build: Remove superfluous OPENBSD and FREEBSD definitions

    They were only used in C/C++ code and can be replaced with the standard
    C preprocessor macros defined by platform compilers.

commit 7f2d77cebcb660f2d515f2fbd963049f838ced28
Author: Michael Altizer <mialtize@cisco.com>
Date:   Fri Sep 23 01:44:36 2016 -0400

    build: Entering 'std' namespace should be after all headers are included

    Otherwise, things get weird.  Especially on illumos.

commit b6265ea5a8af4bd9a8c1dbfa9f8a316b068fd848
Author: Michael Altizer <mialtize@cisco.com>
Date:   Fri Sep 23 01:21:44 2016 -0400

    build: Clean up u_int*_t usage

commit b82a09c460d5c27fd3c827ea65ce32a296d7a0b6
Author: Michael Altizer <mialtize@cisco.com>
Date:   Fri Sep 23 01:10:57 2016 -0400

    build: Remove SPARC support

    Sorry, but it probably didn't work anyway and we have nothing to test it
    on.  If anyone really wants it, they are free to test it and add it
    again.

commit 33d61442742c136b7c644e55d96aa875adb87dd4
Author: Michael Altizer <mialtize@cisco.com>
Date:   Mon Sep 12 15:39:18 2016 -0400

    main: Remove unused -w commandline option

commit cdf3b6f62e1cce4816fb7ac5ff6148eeb77d80df
Author: Michael Altizer <mialtize@cisco.com>
Date:   Mon Sep 12 13:50:39 2016 -0400

    Clean up some DAQ header inclusion creep.

116 files changed:
cmake/platforms.cmake
config.cmake.h.in
configure.ac
doc/style.txt
extra/src/inspectors/http_server/ips_http_header.cc
extra/src/loggers/alert_ex/alert_ex.cc
extra/src/loggers/alert_unixsock/alert_unixsock.cc
src/codecs/link/cd_ppp_encap.cc
src/codecs/root/cd_eth.cc
src/connectors/tcp_connector/test/tcp_connector_test.cc
src/flow/flow_key.cc
src/framework/mpse.cc
src/framework/parameter.cc
src/framework/range.cc
src/framework/value.cc
src/hash/sfxhash.cc
src/helpers/process.cc
src/ips_options/ips_byte_jump.cc
src/ips_options/ips_byte_test.cc
src/ips_options/ips_flowbits.cc
src/ips_options/ips_metadata.cc
src/ips_options/ips_replace.cc
src/ips_options/ips_so.cc
src/log/log.cc
src/log/log_text.cc
src/log/unified2.h
src/loggers/CMakeLists.txt
src/loggers/alert_csv.cc
src/loggers/alert_fast.cc
src/loggers/alert_full.cc
src/loggers/alert_sf_socket.cc
src/loggers/alert_syslog.cc
src/loggers/log_hext.cc
src/loggers/log_pcap.cc
src/loggers/loggers.cc
src/lua/lua_arg.h
src/main.cc
src/main/analyzer.cc
src/main/help.cc
src/main/snort.h
src/main/snort_config.h
src/main/snort_module.cc
src/managers/action_manager.cc
src/managers/event_manager.cc
src/managers/ips_manager.cc
src/managers/module_manager.cc
src/managers/mpse_manager.cc
src/managers/plugin_manager.cc
src/managers/script_manager.cc
src/managers/so_manager.cc
src/network_inspectors/appid/appid_session.cc
src/network_inspectors/appid/appid_utils/sf_mlmp.cc
src/network_inspectors/appid/appid_utils/sf_multi_mpse.cc
src/network_inspectors/appid/client_plugins/client_app_bit.cc
src/network_inspectors/appid/client_plugins/client_app_bit_tracker.cc
src/network_inspectors/appid/client_plugins/client_app_msn.cc
src/network_inspectors/appid/client_plugins/client_app_rtp.cc
src/network_inspectors/appid/client_plugins/client_app_smtp.cc
src/network_inspectors/appid/client_plugins/client_app_ssh.cc
src/network_inspectors/appid/client_plugins/client_app_timbuktu.cc
src/network_inspectors/appid/client_plugins/client_app_tns.cc
src/network_inspectors/appid/client_plugins/client_app_vnc.cc
src/network_inspectors/appid/client_plugins/client_app_ym.cc
src/network_inspectors/appid/detector_plugins/detector_dns.cc
src/network_inspectors/appid/detector_plugins/detector_dns.h
src/network_inspectors/appid/detector_plugins/detector_http.h
src/network_inspectors/appid/detector_plugins/http_url_patterns.h
src/network_inspectors/appid/fw_appid.cc
src/network_inspectors/appid/lua_detector_api.cc
src/network_inspectors/appid/lua_detector_module.cc
src/network_inspectors/appid/service_plugins/service_rpc.cc
src/network_inspectors/appid/service_plugins/service_ssl.cc
src/network_inspectors/appid/service_plugins/service_ssl.h
src/network_inspectors/appid/service_plugins/service_timbuktu.cc
src/network_inspectors/arp_spoof/arp_spoof.cc
src/network_inspectors/binder/bind_module.cc
src/network_inspectors/binder/binder.cc
src/network_inspectors/packet_capture/packet_capture.cc
src/network_inspectors/perf_monitor/base_tracker.cc
src/network_inspectors/perf_monitor/cpu_tracker.cc
src/packet_io/sfdaq.cc
src/packet_io/sfdaq.h
src/parser/cmd_line.cc
src/parser/parse_stream.cc
src/piglet/piglet_manager.cc
src/piglet/piglet_output.cc
src/piglet_plugins/pp_daq_pkthdr_iface.cc
src/protocols/packet.cc
src/protocols/packet.h
src/protocols/packet_manager.cc
src/service_inspectors/dce_rpc/dce_smb2.cc
src/service_inspectors/dce_rpc/dce_smb_utils.cc
src/service_inspectors/dce_rpc/dce_utils.h
src/service_inspectors/rpc_decode/rpc_decode.cc
src/service_inspectors/sip/sip_parser.cc
src/service_inspectors/wizard/wiz_module.cc
src/service_inspectors/wizard/wizard.cc
src/sfip/sf_ip.h
src/stream/file/file_module.cc
src/stream/icmp/icmp_module.cc
src/stream/ip/ip_defrag.cc
src/stream/ip/ip_module.cc
src/stream/libtcp/tcp_state_handler.cc
src/stream/tcp/tcp_state_close_wait.cc
src/stream/tcp/tcp_state_closing.cc
src/stream/tcp/tcp_state_fin_wait1.cc
src/stream/tcp/tcp_state_fin_wait2.cc
src/stream/tcp/tcp_state_last_ack.cc
src/stream/tcp/tcp_state_syn_recv.cc
src/stream/tcp/tcp_state_syn_sent.cc
src/stream/tcp/tcp_state_time_wait.cc
src/stream/udp/stream_udp.cc
src/stream/udp/udp_module.cc
src/stream/user/user_module.cc
src/target_based/snort_protocols.cc
src/utils/util.h

index 6be50a1ae2897e3f7541714490c9853ba27fc2b6..172c6944d75863df18a9edbca637a069f7f83345 100644 (file)
@@ -4,35 +4,8 @@
 # 
 
 
-# TODO:  Either make a macro or a  of platforms and loop over them.
-
-if (${CMAKE_SYSTEM_NAME} MATCHES "openbsd")
-    set(OPENBSD "1")
-endif ()
-
-if (${CMAKE_SYSTEM_NAME} MATCHES "solaris")
-    set(SOLARIS "1")
-endif ()
-
-if (${CMAKE_SYSTEM_NAME} MATCHES "sunos")
-    set(SUNOS "1")
-endif ()
-
-if (${CMAKE_SYSTEM_NAME} MATCHES "linux")
-    set(LINUX "1")
-endif ()
-
-if("${CMAKE_SYSTEM_NAME}" MATCHES "Linux")
-    set(LINUX "1")
-endif()
-
-if (${CMAKE_SYSTEM_NAME} MATCHES "freebsd")
-    set(FREEBSD "1")
-endif ()
-
 # APPLE is defined by Cmake
 if (APPLE)
-    set(MACOS 1)
     set(CMAKE_MACOSX_RPATH OFF)
 endif()
 
index 9649829e8e6e7de76eca713b5cdd8d5d90bf66db..9909c5ae76c7a525f674261501ebff5abf66e2d9 100644 (file)
 /* include internal decoders in binary */
 #cmakedefine STATIC_CODECS 1
 
-/* enable proc stats */
-#cmakedefine LINUX_SMP 1
-
-/* pass packet during initialization */
-#cmakedefine INLINE_FAILOPEN 1
-
 /* enalbe debug messages */
 #cmakedefine DEBUG_MSGS 1
 
@@ -63,9 +57,6 @@
 /* enable profiling */
 #cmakedefine PROFILE 1
 
-/* enable sourcefire tweaks */
-#cmakedefine SOURCEFIRE 1
-
 /* do not generate a core file on segfault etc */
 #cmakedefine NOCOREFILE 1
 
 #cmakedefine USE_TSC_CLOCK 1
 
 
-/* platforms */
-
-
-
-/* Define if OpenBSD */
-#cmakedefine OPENBSD 1
-
-/* Define if Irix */
-#cmakedefine IRIX 1
-
-/* Define if Solaris */
-#cmakedefine SOLARIS 1
-
-/* Define if SunOS */
-#cmakedefine SUNOS 1
-
-/* Define if Linux */
-#cmakedefine LINUX 1
-
-/* Define if HP-UX */
-#cmakedefine HPUX 1
-
-/* Define if FreeBSD */
-#cmakedefine FREEBSD 1
-
-/* Define if BSDi */
-#cmakedefine BSDI 1
-
-/* Define if AIX */
-#cmakedefine AIX 1
-
-/* Define if Tru64 or OSF*/
-#cmakedefine OSF1 1
-
-/* Define if MacOS */
-#cmakedefine MACOS 1
-
-
-
 /*  Print available system types and their sizes */
 
-
 /* Define to 1 if the system has the type `int16_t'. */
 #cmakedefine HAVE_INT16_T 1
 
 /* Define to 1 if the system has the type `uint8_t'. */
 #cmakedefine HAVE_UINT8_T 1
 
-/* Define to 1 if the system has the type `u_int16_t'. */
-#cmakedefine HAVE_U_INT16_T 1
-
-/* Define to 1 if the system has the type `u_int32_t'. */
-#cmakedefine HAVE_U_INT32_T 1
-
-/* Define to 1 if the system has the type `u_int64_t'. */
-#cmakedefine HAVE_U_INT64_T 1
-
-/* Define to 1 if the system has the type `u_int8_t'. */
-#cmakedefine HAVE_U_INT8_T 1
-
 /* The size of `char', as computed by sizeof. */
 #cmakedefine SIZEOF_CHAR @SIZEOF_CHAR@
 
 /* Define if words are big endian */
 #cmakedefine WORDS_BIGENDIAN 1
 
-/* Define if words must align */
-#cmakedefine WORDS_MUSTALIGN 1
-
-
 
 /*  Header file definitions */
 
 #cmakedefine HAVE_DUMBNET_H 1
 
 
-
 /*  Available libraries */
 
 /* hyperscan available */
 
 /* Library specific functions */
 
-/* Can cleanup lex buffer stack created by pcap bpf filter */
-#cmakedefine HAVE_PCAP_LEX_DESTROY 1
-
 /* Can output the library version. */
 #cmakedefine HAVE_PCAP_LIB_VERSION 1
 
 /* Define if the compiler supports visibility declarations. */
 #cmakedefine HAVE_VISIBILITY 1
 
-/* Define whether linuxthreads is being used */
-#cmakedefine HAVE_LINUXTHREADS 1
-
 /* Define if `thread_local` keyword should be used */
 #cmakedefine USE_THREAD_LOCAL 1
 
index c50576c7714a26fa5cc28b7ae0eca284dfedacf9..6d74b5b61b0eac452888ee25043ac8047acbd389 100644 (file)
@@ -82,25 +82,11 @@ linux="no"
 macos="no"
 
 case "$host" in
-  *-openbsd*)
-    AC_DEFINE([OPENBSD],[1],[Define if OpenBSD])
-    ;;
-  *-solaris*)
-    AC_DEFINE([SOLARIS],[1],[Define if Solaris])
-    ;;
-  *-sunos*)
-    AC_DEFINE([SUNOS],[1],[Define if SunOS])
-    ;;
   *-linux*)
     linux="yes"
-    AC_DEFINE([LINUX],[1],[Define if Linux])
-    ;;
-  *-freebsd*)
-    AC_DEFINE([FREEBSD],[1],[Define if FreeBSD])
     ;;
   *-apple*)
     macos="yes"
-    AC_DEFINE([MACOS],[1],[Define if MacOS])
 esac
 
 #--------------------------------------------------------------------------
@@ -119,19 +105,6 @@ AC_CHECK_PROG(have_w3m,w3m,yes,no)
 
 AM_CONDITIONAL(MAKE_TEXT_DOC, [test "x$have_w3m" = "xyes" -a "x$have_asciidoc" = "xyes"])
 
-AC_MSG_CHECKING(for sparc)
-if eval "echo $host_cpu|grep -i sparc >/dev/null"; then
-    AC_DEFINE([WORDS_MUSTALIGN],[1],[Define if words must align])
-    AC_MSG_RESULT(yes)
-
-    # gcc, sparc and optimization not so good
-    if test -n "$GCC"; then
-        NO_OPTIMIZE="yes"
-    fi
-else
-    AC_MSG_RESULT(no)
-fi
-
 #--------------------------------------------------------------------------
 # visibility foo
 #--------------------------------------------------------------------------
index dc7b10663accdea97d70a7dd8e9a4ece4a7820d0..6cf6b41c4c0fc6c8bc0701ad79e3a04380a1a6a7 100644 (file)
@@ -56,6 +56,9 @@ yet firm so feedback is welcome to get something we can live with.
   shouldn't have to sift through implementation details to see what is
   available to the client.
 
+* Any using statements in source files should be added only after all
+  includes have been declared.
+
 === Naming
 
 * Use camel case for namespaces, classes, and types like WhizBangPdfChecker.
@@ -63,6 +66,9 @@ yet firm so feedback is welcome to get something we can live with.
 * Use lower case identifiers with underscore separators, e.g. some_function()
   and my_var.
 
+* Do not start or end variable names with an underscore.  This has a good
+  chance of conflicting with macro and/or system definitions.
+
 * Use lower case filenames with underscores.
 
 === Comments
index a2eb4149c81a7d79166fe87e60e85e0db8b8ea4b..f5f1b020a8661dec3843c0b83504e4dae53e6ed9 100644 (file)
@@ -22,7 +22,6 @@
 #endif
 
 #include <string>
-using namespace std;
 
 #include "main/snort_types.h"
 #include "main/snort_debug.h"
@@ -35,6 +34,8 @@ using namespace std;
 #include "framework/module.h"
 #include "protocols/packet.h"
 
+using namespace std;
+
 #define s_name "http_header"
 
 static THREAD_LOCAL ProfileStats httpHeaderPerfStats;
index b5eaafcaf8689678cf9237ba9cf2c38eff12e229..8f6e6dfa3ed6567c146fbb461fa57417abdc73a7 100644 (file)
@@ -28,7 +28,6 @@
 
 #include <algorithm>
 #include <iostream>
-using namespace std;
 
 #include "main/snort_types.h"
 #include "framework/logger.h"
@@ -36,6 +35,8 @@ using namespace std;
 #include "protocols/packet.h"
 #include "detection/signature.h"
 
+using namespace std;
+
 static const char* s_name = "alert_ex";
 static const char* s_help = "output gid:sid:rev for alerts";
 
index 03d4df446ef363d0558ee71501d108d6ef1805fe..4dea4db776bf432795642355962264170fe5defc 100644 (file)
@@ -216,7 +216,7 @@ static void OpenAlertSock()
     if ( (us.socket = socket(AF_UNIX, SOCK_DGRAM, 0)) < 0 )
         FatalError("socket() call failed: %s", get_error(errno));
 
-#ifdef FREEBSD
+#ifdef __FreeBSD__
     int buflen=sizeof(us.alert);
 
     if ( setsockopt(us.socket, SOL_SOCKET, SO_SNDBUF, (char*)&buflen, sizeof(int)) < 0 )
index 679884960411de9b585086daab97c33e5f8feb83..cd2576d395edfec97272db30fa9ee5a7c62f9880 100644 (file)
@@ -58,15 +58,6 @@ bool PppEncap::decode(const RawData& raw, CodecData& codec, DecodeData&)
 
     DebugMessage(DEBUG_DECODE, "PPP Packet!\n");
 
-#ifdef WORDS_MUSTALIGN
-    DebugMessage(DEBUG_DECODE, "Packet with PPP header.  "
-        "PPP is only 1 or 2 bytes and will throw off "
-        "alignment on this architecture when decoding IP, "
-        "causing a bus error - stop decoding packet.\n");
-    return true;
-
-#endif  /* WORDS_MUSTALIGN */
-
     if (raw.len < 2)
         return false;
 
index 0f090a077ce6ada8aafc61f1371b7060614807c1..76c47cd220a349293fdd45ec35a7806c844ae5e1 100644 (file)
@@ -161,15 +161,6 @@ bool EthCodec::encode(const uint8_t* const raw_in, const uint16_t /*raw_len*/,
     // not raw ip -> encode layer 2
     bool raw = ( enc.flags & ENC_FLAG_RAW );
 
-    if ( !raw && (buf.size() == 0) )
-    {
-        // for alignment
-        if (!buf.allocate(SPARC_TWIDDLE))
-            return false;
-
-        buf.off = SPARC_TWIDDLE;
-    }
-
     if ( !raw || (buf.size() != 0) )
     {
         // we get here for outer-most layer when not raw ip
index 25148bbbd434ba9a2962e30200460fad27bb74cf..d4f02a7d1676ce51a542c8bcc9ae4d64a114a095 100644 (file)
@@ -31,7 +31,7 @@
 #include <CppUTest/CommandLineTestRunner.h>
 #include <CppUTest/TestHarness.h>
 
-#ifdef MACOS
+#if defined(__APPLE__)
 #define __THROW
 #define __SOCKADDR_ARG          struct sockaddr*
 #define __CONST_SOCKADDR_ARG    const struct sockaddr*
index d7f6a8f9226d495692ff6afde3b5fd692cbafe4c..91d3e8d995458f2ac5997ddb5a809cb64c284519 100644 (file)
@@ -291,7 +291,6 @@ uint32_t FlowKey::hash(SFHASHFCN*, unsigned char* d, int)
 
 int FlowKey::compare(const void* s1, const void* s2, size_t)
 {
-#ifndef SPARCV9 /* ie, everything else, use 64bit comparisons */
     uint64_t* a,* b;
 
     a = (uint64_t*)s1;
@@ -326,62 +325,6 @@ int FlowKey::compare(const void* s1, const void* s2, size_t)
     if (*a - *b)
         return 1;               /* Compares MPLS label, AddressSpace ID and 16bit pad */
 
-#else /* SPARCV9 */
-    uint32_t* a,* b;
-
-    a = (uint32_t*)s1;
-    b = (uint32_t*)s2;
-    if ((*a - *b) || (*(a+1) - *(b+1)))
-        return 1;                                       /* Compares IPv4 lo/hi */
-    /* Compares IPv6 low[0,1] */
-
-    a+=2;
-    b+=2;
-    if ((*a - *b) || (*(a+1) - *(b+1)))
-        return 1;                                       /* Compares port lo/hi, vlan, protocol,
-                                                          version */
-    /* Compares IPv6 low[2,3] */
-
-    a+=2;
-    b+=2;
-    if ((*a - *b) || (*(a+1) - *(b+1)))
-        return 1;                                       /* Compares IPv6 hi[0,1] */
-
-    a+=2;
-    b+=2;
-    if ((*a - *b) || (*(a+1) - *(b+1)))
-        return 1;                                       /* Compares IPv6 hi[2,3] */
-
-    a+=2;
-    b+=2;
-    if ((*a - *b) || (*(a+1) - *(b+1)))
-        return 1;                                       /* Compares port lo/hi, vlan, protocol,
-                                                          version */
-
-    a+=2;
-    b+=2;
-    {
-        uint32_t* x, * y;
-        x = (uint32_t*)a;
-        y = (uint32_t*)b;
-        // x++;
-        // y++;
-        if (*x - *y)
-            return 1;           /* Compares mpls label */
-    }
-    a++;
-    b++;
-    {
-        uint16_t* x, * y;
-        x = (uint16_t*)a;
-        y = (uint16_t*)b;
-        // x++;
-        // y++;
-        if (*x - *y)
-            return 1;           /* Compares addressSpaceID, no pad */
-    }
-#endif /* SPARCV9 */
-
     return 0;
 }
 
index 85928060c7b3cffe2b2f39e249d5c877b65aa503..356f1f2ed2a95463b62dd5168250135f29ac3aa7 100644 (file)
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 #endif
-using namespace std;
 
 #include "main/snort_debug.h"
 #include "main/snort_types.h"
 #include "profiler/profiler.h"
 
+using namespace std;
+
 // this is accumulated only for fast pattern
 // searches for the detection engine
 static THREAD_LOCAL uint64_t s_bcnt=0;
index 75f14b85226f79d2fc651db51ba99773c640f244..f48c5c007d9599845c4db43717617b4065871c57 100644 (file)
 #include <iomanip>
 #include <sstream>
 #include <vector>
-using namespace std;
 
 #include "value.h"
 #include "utils/dnet_header.h"
 
+using namespace std;
+
 static bool valid_bool(Value& v, const char*)
 {
     return v.get_type() == Value::VT_BOOL;
index d0ad2ea3f153fac07bf5bb78c1d438cbc328d2f7..6cfbbfffce8f2d82e078524d1bec15a57671c068 100644 (file)
 #include <string.h>
 
 #include <string>
-using namespace std;
 
 #ifdef UNIT_TEST
 #include "catch/catch.hpp"
 #endif
 
+using namespace std;
+
 //--------------------------------------------------------------------------
 // private parsing methods
 //--------------------------------------------------------------------------
index 0884a5fb3c4b43d571ab1549015ec3d0f02b70a4..c8b70ea2913e7cb95d4254473954e100393230e5 100644 (file)
 #include "sfip/sfip_t.h"
 #include "sfip/sf_ip.h"
 
-using namespace std;
-
 #ifdef UNIT_TEST
 #include "catch/catch.hpp"
 #endif
 
+using namespace std;
+
 Value::~Value()
 {
     if ( ss )
index bf349acb319ea717acf0f58833384787b5f997c9..6f8b5a1a4a6ad4c7d639bb11d5a4c46a43ca34b6 100644 (file)
@@ -221,12 +221,7 @@ SFXHASH* sfxhash_new(int nrows, int keysize, int datasize, unsigned long maxmem,
     h->usrfree  = usrfree;
     h->keysize  = keysize;
 
-#ifdef WORDS_MUSTALIGN
-    if ((h->keysize) & 7)
-        h->pad = (8 - ((h->keysize) & 7));
-#else
     h->pad = 0;
-#endif
     h->datasize = datasize;
     h->nrows    = nrows;
     h->max_nodes = 0;
index 20fcf1abdba835ee014d3cd0710fd0d0e7698971..c2a3ae0c8fd919453486884801831bbefb96129d 100644 (file)
@@ -36,7 +36,6 @@
 #endif
 
 #include <iostream>
-using namespace std;
 
 #include "main.h"
 #include "main/thread.h"
@@ -48,6 +47,8 @@ using namespace std;
 #include "helpers/ring.h"
 #include "parser/parser.h"
 
+using namespace std;
+
 #ifndef SIGNAL_SNORT_RELOAD
 #define SIGNAL_SNORT_RELOAD        SIGHUP
 #endif
@@ -223,16 +224,11 @@ static int add_signal(int sig, sighandler_t signal_handler, int check_needed)
 
 void init_signals()
 {
-#if defined(LINUX) || defined(FREEBSD) || defined(OPENBSD) || \
-    defined(SOLARIS) || defined(BSD) || defined(MACOS)
     sigset_t set;
 
     sigemptyset(&set);
     // FIXIT-L this is undefined for multithreaded apps
     sigprocmask(SIG_SETMASK, &set, NULL);
-#else
-    sigsetmask(0);
-#endif
 
     /* Make this prog behave nicely when signals come along.
      * Windows doesn't like all of these signals, and will
index f66054f4d6f89564037f880cf6aeb304cf83432c..30fd50e1e92e47137636ea2a5d60be9ce5d856ba 100644 (file)
 #include "framework/parameter.h"
 #include "framework/module.h"
 
+using namespace std;
+
 static THREAD_LOCAL ProfileStats byteJumpPerfStats;
 
 #define s_name "byte_jump"
-using namespace std;
 
 typedef struct _ByteJumpData
 {
index f1673aebd5d413c81d8d7d6909b2a202f4a628f5..508e3f14711e3739c0dd1f85c2058e66453cddc1 100644 (file)
@@ -92,7 +92,6 @@
 #include <errno.h>
 
 #include <string>
-using namespace std;
 
 #include "extract.h"
 #include "ips_byte_extract.h"
@@ -111,6 +110,8 @@ using namespace std;
 #include "framework/parameter.h"
 #include "framework/module.h"
 
+using namespace std;
+
 #define PARSELEN 10
 #define TEXTLEN  (PARSELEN + 2)
 
index 1cbe2c285125c97d12798458b88ca859127c2571..45fff509845eb2ccfcb658129c00eed310bdd870 100644 (file)
@@ -48,7 +48,6 @@
 
 #include <string>
 #include <forward_list>
-using namespace std;
 
 #include "main/snort_types.h"
 #include "main/snort_debug.h"
@@ -68,6 +67,8 @@ using namespace std;
 #include "framework/parameter.h"
 #include "framework/module.h"
 
+using namespace std;
+
 #define s_name "flowbits"
 
 static THREAD_LOCAL ProfileStats flowBitsPerfStats;
index fa4fb56062a2d6135eeacd8453a288fbb279ce5a..a66f5253f39fa268cfd809f0787a180f810155eb 100644 (file)
@@ -23,7 +23,6 @@
 
 #include <string>
 #include <vector>
-using namespace std;
 
 #include "main/snort_types.h"
 #include "main/snort_debug.h"
@@ -35,6 +34,8 @@ using namespace std;
 #include "parser/parse_conf.h"
 #include "parser/parser.h"
 
+using namespace std;
+
 #define s_name "metadata"
 
 //-------------------------------------------------------------------------
index 507b47b41aeda2b7f2e2a4753de13988fbc4c7f1..54f7c7ba5b2fe7e2090b807f8fb5cc6a3809a4dd 100644 (file)
@@ -24,7 +24,6 @@
 
 #include <assert.h>
 #include <string>
-using namespace std;
 
 #include "main/snort_config.h"
 #include "main/snort_types.h"
@@ -43,6 +42,8 @@ using namespace std;
 #include "hash/sfhashfcn.h"
 #include "profiler/profiler.h"
 
+using namespace std;
+
 static void replace_parse(const char* args, string& s)
 {
     bool negated;
index cc9ae1f8dd3d2abe6451506cbac2774bbe1acdc0..9cc900105b138a8013c4f402307d80a01b853c06 100644 (file)
@@ -24,7 +24,6 @@
 #endif
 
 #include <string>
-using namespace std;
 
 #include "framework/parameter.h"
 #include "framework/module.h"
@@ -35,6 +34,8 @@ using namespace std;
 #include "detection/treenodes.h"
 #include "profiler/profiler.h"
 
+using namespace std;
+
 #define s_name "so"
 
 static THREAD_LOCAL ProfileStats soPerfStats;
index d78bba0b19a6a0875361ad7428dcfc9becd4c56b..1662415146ca67e3aba15277e85c813cff92271c 100644 (file)
@@ -32,7 +32,6 @@
 
 #include <string>
 #include <mutex>
-using namespace std;
 
 #include "log_text.h"
 #include "main/snort_debug.h"
@@ -130,7 +129,7 @@ int RollAlertFile(const char* filearg)
 // default logger stuff
 //--------------------------------------------------------------------
 
-static mutex log_mutex;
+static std::mutex log_mutex;
 
 static TextLog* text_log = NULL;
 
index ff017226188930b66bd89c40593ce6417dc09860..69755e3961fa9a9fb2192050930546cb6726c965 100644 (file)
 #include <errno.h>
 #include <signal.h>
 
+extern "C" {
+#include <sfbpf_dlt.h>
+}
+
 #include "log.h"
 #include "text_log.h"
 #include "obfuscator.h"
index aa944e48fb20e9f95c87e5f0319b321b59664aa3..4fb0e3b5a06f0ed50ae65b047592fd94e788ebd5 100644 (file)
@@ -26,7 +26,7 @@
 #endif
 
 #include <sys/types.h>
-#ifdef LINUX
+#if defined(__linux__)
 #include <stdint.h>
 #endif
 #include <netinet/in.h>
index 431e9dc62e3d9632ac70ac518f27008df490cfe5..c2cbf464c16572e2369a230bbdb26a3ab2158e7a 100644 (file)
@@ -16,7 +16,7 @@ set (PLUGIN_LIST
     unified2.cc
 )
 
-if (LINUX)
+if("${CMAKE_SYSTEM_NAME}" MATCHES "Linux")
     set ( LOGGER_SOURCES
         ${LOGGER_SOURCES}
         alert_sf_socket.cc
index c6cfc2e6bbbac6a2ce4603c592bbfa29204c4cdd..6f6123bce1566dbe27c4122446b25e7d4f9639fe 100644 (file)
@@ -54,6 +54,8 @@
 #include "packet_io/active.h"
 #include "packet_io/sfdaq.h"
 
+using namespace std;
+
 #define LOG_BUFFER (4*K_BYTES)
 
 static THREAD_LOCAL TextLog* csv_log;
@@ -61,8 +63,6 @@ static THREAD_LOCAL TextLog* csv_log;
 #define S_NAME "alert_csv"
 #define F_NAME S_NAME ".txt"
 
-using namespace std;
-
 //-------------------------------------------------------------------------
 // field formatting functions
 //-------------------------------------------------------------------------
index bfa5e6991e58e9a3a71fe700b21d8ee79b10fb5f..e57735c073e0611cc7498ef62a315795505dd651 100644 (file)
@@ -58,6 +58,8 @@
 #include "packet_io/intf.h"
 #include "events/event.h"
 
+using namespace std;
+
 /* full buf was chosen to allow printing max size packets
  * in hex/ascii mode:
  * each byte => 2 nibbles + space + ascii + overhead
@@ -67,8 +69,6 @@
 
 static THREAD_LOCAL TextLog* fast_log = nullptr;
 
-using namespace std;
-
 #define S_NAME "alert_fast"
 #define F_NAME S_NAME ".txt"
 
index 55c1e102ca8823d455ed7bd6e4a51fa6326ea77b..cb2ab821a2c2963d12c12c06fb86eed8af7b785d 100644 (file)
 #include "packet_io/sfdaq.h"
 #include "packet_io/intf.h"
 
+using namespace std;
+
 static THREAD_LOCAL TextLog* full_log = nullptr;
 
 #define LOG_BUFFER (4*K_BYTES)
 
-using namespace std;
-
 #define S_NAME "alert_full"
 #define F_NAME S_NAME ".txt"
 
index 0886247698929a1d9eb7b1fce401938ebd7becd8..b07d1180b9c41b4184f7bd69f4c06cc284f14f49 100644 (file)
@@ -26,7 +26,7 @@
 #include "config.h"
 #endif
 
-#ifdef LINUX
+#if defined(__linux__)
 #include <sys/socket.h>
 #include <sys/un.h>
 
@@ -47,6 +47,8 @@
 #include "target_based/snort_protocols.h"
 #include "utils/util.h"
 
+using namespace std;
+
 struct SfSock
 {
     int connected;
@@ -62,7 +64,6 @@ struct RuleId
 
 static THREAD_LOCAL SfSock context;
 
-using namespace std;
 typedef vector<RuleId> RuleVector;
 
 #define s_name "alert_sfsocket"
@@ -415,5 +416,5 @@ static LogApi sf_sock_api
 
 const BaseApi* alert_sf_socket = &sf_sock_api.base;
 
-#endif   /* LINUX */
+#endif   /* __linux__ */
 
index 650669ee4767c24dbfffcdd489359f0bb6a73307..99430be059db5cb56fbb7235a6f9b8079c5ee16e 100644 (file)
 #include "packet_io/sfdaq.h"
 #include "packet_io/intf.h"
 
+using namespace std;
+
 #ifndef LOG_AUTHPRIV
 #define LOG_AUTHPRIV LOG_AUTH
 #endif
 
-using namespace std;
-
 #define s_name "alert_syslog"
 
 //-------------------------------------------------------------------------
@@ -112,8 +112,10 @@ static int get_options(const char* s)
     if ( strstr(s, "ndelay") )
         opts |= LOG_NDELAY;
 
+#ifdef LOG_PERROR
     if ( strstr(s, "perror") )
         opts |= LOG_PERROR;
+#endif
 
     if ( strstr(s, "pid") )
         opts |= LOG_PID;
index e179c63300de1c6583f98025f8e34c3b90f98c54..cd8c63b68f234074f3d08f039f76f8d613463d72 100644 (file)
@@ -28,7 +28,6 @@
 #include <algorithm>
 #include <iostream>
 #include <string>
-using namespace std;
 
 #include "main/snort_types.h"
 #include "framework/logger.h"
@@ -37,6 +36,8 @@ using namespace std;
 #include "log/text_log.h"
 #include "sfip/sf_ip.h"
 
+using namespace std;
+
 #define S_NAME "log_hext"
 #define F_NAME S_NAME ".txt"
 
index 89aab1acc4ba357d3cebbf74098018686afba50b..7165d63d3f276224b889b165a3d58333d53c265e 100644 (file)
@@ -48,6 +48,8 @@ extern "C" {
 #include "utils/util.h"
 #include "utils/stats.h"
 
+using namespace std;
+
 /*
  * <pcap file> ::= <pcap file hdr> [<pcap pkt hdr> <packet>]*
  * on 64 bit systems, some fields in the <pcap * hdr> are 8 bytes
@@ -59,8 +61,6 @@ extern "C" {
 #define PCAP_FILE_HDR_SZ (24)
 #define PCAP_PKT_HDR_SZ  (16)
 
-using namespace std;
-
 struct LtdConfig
 {
     string file;
index 549ac804afcd8674054b3eb2d2be7706b58bbf56..6deb62d5c998be2b3fc69168bd1e208ac4281d66 100644 (file)
@@ -28,7 +28,7 @@
 // to ensure PacketManager::log_protocols() is built into Snort++
 extern const BaseApi* log_codecs;
 
-#ifdef LINUX
+#if defined(__linux__)
 extern const BaseApi* alert_sf_socket;
 #endif
 
@@ -47,7 +47,7 @@ const BaseApi* loggers[] =
     // loggers
     log_codecs,
 
-#ifdef LINUX
+#if defined(__linux__)
     alert_sf_socket,
 #endif
 
index 6dec84bf51e6823c6dded0c625fc6d4bcd5351f7..bd418fc4ec2e165718b4cc34addb3da68c9d5fa4 100644 (file)
@@ -32,7 +32,7 @@ public:
     template<typename T>
     using ArgCallback = void (*)(lua_State*, int, T& ud);
 
-    Args(lua_State* _L) : L { _L }, count { lua_gettop(L) } { }
+    Args(lua_State* state) : L { state }, count { lua_gettop(L) } { }
 
 private:
     lua_State* L;
@@ -40,8 +40,8 @@ private:
     struct ArgRef
     {
     public:
-        ArgRef(lua_State* _L, int ct, int i) :
-            L { _L }, count { ct }, index { i } { }
+        ArgRef(lua_State* state, int ct, int i) :
+            L { state }, count { ct }, index { i } { }
 
         // We treat nil as !exists
         inline bool exists()
index 74dafa8fad7664bf93439001b8e6b59a76f7bade..bd7ebe6831c3b0ee18f1d8309b4c584d94e09f16 100644 (file)
@@ -39,7 +39,6 @@
 
 #include <string>
 #include <thread>
-using namespace std;
 
 #include "main/analyzer.h"
 #include "main/shell.h"
@@ -75,6 +74,8 @@ using namespace std;
 #include "piglet/piglet.h"
 #endif
 
+using namespace std;
+
 //-------------------------------------------------------------------------
 
 static Swapper* swapper = NULL;
index 85b5ede57f2c9cfc70709e90c3b4035a5f8107a1..98f67897695f87bc74716b41116e9879b80091c3 100644 (file)
@@ -22,7 +22,6 @@
 
 #include <chrono>
 #include <thread>
-using namespace std;
 
 #include "snort.h"
 #include "snort_debug.h"
@@ -32,6 +31,8 @@ using namespace std;
 #include "memory/memory_cap.h"
 #include "packet_io/sfdaq.h"
 
+using namespace std;
+
 typedef DAQ_Verdict
 (* PacketCallback)(void*, const DAQ_PktHdr_t*, const uint8_t*);
 
index b19236a661e5b763a8e1153a918c873203ea3950..17a2db05ec625b2bcd8619ddf51f9ce3a25d15a1 100644 (file)
@@ -26,7 +26,6 @@
 #include <syslog.h>
 #include <iostream>
 #include <string>
-using namespace std;
 
 #include "main.h"
 #include "main/snort_config.h"
@@ -46,6 +45,8 @@ using namespace std;
 #include "utils/util.h"
 #include "helpers/markup.h"
 
+using namespace std;
+
 #define snort_help \
     "\n" \
     "Snort has several options to get more help:\n" \
index b9f214452fb174807d9bfb6e6095998ff0846350..2b0613e419aa11416252e7890143d3e7478154d5 100644 (file)
@@ -28,7 +28,7 @@
 #include <stdio.h>
 
 extern "C" {
-#include <daq.h>
+#include <daq_common.h>
 }
 
 class Flow;
index 45e13ce093a5f17fa03d3d09dcc44d0348b8030d..651d57b8423ebd2a22262f452c484eeeae4e6468 100644 (file)
@@ -90,15 +90,14 @@ enum OutputFlag
     OUTPUT_FLAG__APP_DATA          = 0x00000008,      /* -d */
 
     OUTPUT_FLAG__SHOW_DATA_LINK    = 0x00000010,      /* -e */
-    OUTPUT_FLAG__SHOW_WIFI_MGMT    = 0x00000020,      /* -w */
-    OUTPUT_FLAG__USE_UTC           = 0x00000040,      /* -U */
-    OUTPUT_FLAG__INCLUDE_YEAR      = 0x00000080,      /* -y */
-
+    OUTPUT_FLAG__USE_UTC           = 0x00000020,      /* -U */
+    OUTPUT_FLAG__INCLUDE_YEAR      = 0x00000040,      /* -y */
     /* Note using this alters the packet - can't be used inline */
-    OUTPUT_FLAG__OBFUSCATE         = 0x00000100,      /* -B */
-    OUTPUT_FLAG__ALERT_IFACE       = 0x00000200,      /* -I */
-    OUTPUT_FLAG__NO_TIMESTAMP      = 0x00000400,      /* --nostamps */
-    OUTPUT_FLAG__ALERTS            = 0x00000800,      /* -A */
+    OUTPUT_FLAG__OBFUSCATE         = 0x00000080,      /* -B */
+
+    OUTPUT_FLAG__ALERT_IFACE       = 0x00000100,      /* -I */
+    OUTPUT_FLAG__NO_TIMESTAMP      = 0x00000200,      /* --nostamps */
+    OUTPUT_FLAG__ALERTS            = 0x00000400,      /* -A */
 };
 
 enum LoggingFlag
@@ -496,9 +495,6 @@ public:
     static bool line_buffered_logging()
     { return snort_conf->output_flags & OUTPUT_FLAG__LINE_BUFFER; }
 
-    static bool output_wifi_mgmt()
-    { return snort_conf->output_flags & OUTPUT_FLAG__SHOW_WIFI_MGMT; }
-
     // run flags
     static bool no_lock_pid_file()
     { return snort_conf->run_flags & RUN_FLAG__NO_LOCK_PID_FILE; }
index e322990869ee427c180a7fabb0d64750311c8a4c..baad5c562f510f93b3a17c103de186f82d6f16b1 100644 (file)
@@ -28,7 +28,6 @@
 #include <string.h>
 
 #include <string>
-using namespace std;
 
 #include "main.h"
 #include "snort_config.h"
@@ -53,6 +52,8 @@ using namespace std;
 #include "catch/unit_test.h"
 #endif
 
+using namespace std;
+
 //-------------------------------------------------------------------------
 // commands
 //-------------------------------------------------------------------------
@@ -235,11 +236,6 @@ static const Parameter s_params[] =
     { "-W", Parameter::PT_IMPLIED, nullptr, nullptr,
       "lists available interfaces" },
 
-#if defined(DLT_IEEE802_11)
-    { "-w", Parameter::PT_IMPLIED, nullptr, nullptr,
-      "dump 802.11 management and control frames" },
-#endif
-
     { "-X", Parameter::PT_IMPLIED, nullptr, nullptr,
       "dump the raw packet data starting at the link layer" },
 
@@ -646,11 +642,6 @@ bool SnortModule::set(const char*, Value& v, SnortConfig* sc)
     else if ( v.is("-W") )
         list_interfaces(sc);
 
-#if defined(DLT_IEEE802_11)
-    else if ( v.is("-w") )
-        sc->output_flags |= OUTPUT_FLAG__SHOW_WIFI_MGMT;
-#endif
-
     else if ( v.is("-X") )
         ConfigDumpPayloadVerbose(sc, v.get_string());
 
index 86c53fdcb6d3fff6f653884c5fd1c72a6b53a00b..9a94a95c2e6946801ab160a5cd2afe3e241cd0d8 100644 (file)
@@ -22,7 +22,6 @@
 #include <assert.h>
 
 #include <list>
-using namespace std;
 
 #include "main/snort_types.h"
 #include "main/snort_config.h"
@@ -35,6 +34,8 @@ using namespace std;
 #include "actions/act_replace.h"
 #include "packet_io/active.h"
 
+using namespace std;
+
 struct Actor
 {
     const ActionApi* api;
index 827bf4530b50edf7f7276e600e441b87b0a2bb7d..30cad90634dab58d713dbaf46a01d4424aacbe7b 100644 (file)
@@ -28,7 +28,6 @@
 #include <errno.h>
 
 #include <list>
-using namespace std;
 
 #include "plugin_manager.h"
 #include "module_manager.h"
@@ -43,6 +42,8 @@ using namespace std;
 #include "parser/parser.h"
 #include "log/messages.h"
 
+using namespace std;
+
 struct Output
 {
     const LogApi* api;
index c026b8bf02314e2fb2ce63e1d31ac2b97dfd736f..f564aa1dfe3a32b289d235d862f203415c6e8678 100644 (file)
@@ -30,7 +30,6 @@
 
 #include <list>
 #include <fstream>
-using namespace std;
 
 #include "plugin_manager.h"
 #include "main/snort_types.h"
@@ -46,6 +45,8 @@ using namespace std;
 #include "parser/parser.h"
 #include "log/messages.h"
 
+using namespace std;
+
 struct Option
 {
     const IpsApi* api;
index e37bb3aa5f26ba6ade9052bc882048993cbe1673..547ad8eb418b2987594d8960e637606e6ac77f79 100644 (file)
@@ -1242,7 +1242,7 @@ void ModuleManager::dump_stats(SnortConfig*, const char* skip)
 
 void ModuleManager::accumulate(SnortConfig*)
 {
-    static mutex stats_mutex;
+    static std::mutex stats_mutex;
     stats_mutex.lock();
 
     for ( auto p : s_modules )
index 8f57389237438a131246e6b9efe446d1122d8d64..398d28813005515315e81c8ff821c8f102590d74 100644 (file)
@@ -20,7 +20,6 @@
 #include "mpse_manager.h"
 
 #include <list>
-using namespace std;
 
 #include "module_manager.h"
 #include "main/snort_types.h"
@@ -32,6 +31,8 @@ using namespace std;
 #include "log/messages.h"
 #include "search_engines/search_common.h"
 
+using namespace std;
+
 typedef list<const MpseApi*> EngineList;
 static EngineList s_engines;
 
index d3f88b96bea3c2151d835680bbd374c2fe10ac7f..957561a2990dadd5e680f28d9ea4014e7ef58353 100644 (file)
@@ -30,7 +30,6 @@
 #include <map>
 #include <vector>
 #include <iostream>
-using namespace std;
 
 #include "action_manager.h"
 #include "event_manager.h"
@@ -73,7 +72,9 @@ using namespace std;
 #include "parser/parser.h"
 #include "file_api/file_service.h"
 
-#if defined(LINUX)
+using namespace std;
+
+#if defined(__linux__)
 #define lib_pattern "*.so"
 #else
 #define lib_pattern "*.dylib"
@@ -157,7 +158,7 @@ struct Plugin
     { source.clear(); key.clear(); api = nullptr; handle = nullptr; }
 };
 
-typedef map<string, Plugin> PlugMap;
+typedef std::map<string, Plugin> PlugMap;
 static PlugMap plug_map;
 
 struct RefCount
@@ -169,7 +170,7 @@ struct RefCount
     //~RefCount() { assert(!count); }; // FIXIT-L fails on fatal error
 };
 
-typedef map<void*, RefCount> RefMap;
+typedef std::map<void*, RefCount> RefMap;
 static RefMap ref_map;
 
 static void set_key(string& key, Symbol* sym, const char* name)
index eebff89dc88580196ad0e5394e56be6c3dd388b4..9446c903548f5046ee382ba9a1b8c1772b29303e 100644 (file)
@@ -40,6 +40,8 @@
 #include "piglet/piglet_manager.h"
 #endif
 
+using namespace std;
+
 // FIXIT-P this approach results in N * K lua states where
 // N ::= number of instances of script + args and
 // K ::= number of threads
@@ -48,7 +50,6 @@
 // ultimately should look into changing detection engine to
 // keep just one copy of rule option + args
 
-using namespace std;
 #define script_pattern "*.lua"
 
 //-------------------------------------------------------------------------
index 4a0e6094d931941301bdf220f318419311750ae9..3c298856232cc7aa44a06c91eb15ab41ea16e096 100644 (file)
@@ -36,7 +36,6 @@
 #include <iomanip>
 #include <iostream>
 #include <sstream>
-using namespace std;
 
 #include "plugin_manager.h"
 #include "main/snort_types.h"
@@ -48,6 +47,8 @@ using namespace std;
 #include "parser/parser.h"
 #include "log/messages.h"
 
+using namespace std;
+
 static list<const SoApi*> s_rules;
 
 //-------------------------------------------------------------------------
index 973b4ed0b7d95ea868f2bfa4bb8329fa38222eaa..38c91fe3052494f939565bfd2973a36c1d6a9d0b 100644 (file)
@@ -1449,7 +1449,7 @@ bool AppIdSession::do_service_discovery(IpProtocol protocol, int direction, AppI
                     && dsession && dsession->host)
             {
                 size_t size = dsession->host_len;
-                dns_host_scan_hostname((const u_int8_t*) (dsession->host), size, &ClientAppId, &payloadAppId,
+                dns_host_scan_hostname((const uint8_t*) (dsession->host), size, &ClientAppId, &payloadAppId,
                         &pConfig->serviceDnsConfig);
                 set_client_app_id_data(ClientAppId, nullptr);
             }
@@ -1898,7 +1898,7 @@ void AppIdSession::do_application_discovery(Packet* p)
             session->dsession && session->dsession->host )
         {
             size_t size = session->dsession->host_len;
-            dns_host_scan_hostname((const u_int8_t*)session->dsession->host, size, &ClientAppId,
+            dns_host_scan_hostname((const uint8_t*)session->dsession->host, size, &ClientAppId,
                 &payloadAppId, &pConfig->serviceDnsConfig);
             session->set_client_app_id_data(ClientAppId, nullptr);
         }
@@ -2498,7 +2498,7 @@ void AppIdSession::examine_ssl_metadata(Packet* p, AppIdConfig* pConfig)
     if ((scan_flags & SCAN_SSL_HOST_FLAG) && tsession->tls_host)
     {
         size = strlen(tsession->tls_host);
-        if ((ret = ssl_scan_hostname((const u_int8_t*)tsession->tls_host, size,
+        if ((ret = ssl_scan_hostname((const uint8_t*)tsession->tls_host, size,
                 &clientAppId, &payload_app_id, &pConfig->serviceSslConfig)))
         {
             set_client_app_id_data(clientAppId, nullptr);
@@ -2510,7 +2510,7 @@ void AppIdSession::examine_ssl_metadata(Packet* p, AppIdConfig* pConfig)
     if (tsession->tls_cname)
     {
         size = strlen(tsession->tls_cname);
-        if ((ret = ssl_scan_cname((const u_int8_t*)tsession->tls_cname, size,
+        if ((ret = ssl_scan_cname((const uint8_t*)tsession->tls_cname, size,
                 &clientAppId, &payload_app_id, &pConfig->serviceSslConfig)))
         {
             set_client_app_id_data(clientAppId, nullptr);
@@ -2523,7 +2523,7 @@ void AppIdSession::examine_ssl_metadata(Packet* p, AppIdConfig* pConfig)
     if (tsession->tls_orgUnit)
     {
         size = strlen(tsession->tls_orgUnit);
-        if ((ret = ssl_scan_cname((const u_int8_t*)tsession->tls_orgUnit, size,
+        if ((ret = ssl_scan_cname((const uint8_t*)tsession->tls_orgUnit, size,
                 &clientAppId, &payload_app_id, &pConfig->serviceSslConfig)))
         {
             set_client_app_id_data(clientAppId, nullptr);
index f69b01ff6722851673372c6b1d69811ab5540670..8b0be2d644e92be0dc780cc7d6cccc2e3ae711af 100644 (file)
@@ -298,7 +298,7 @@ static void dumpTreesRecursively(tMlmpTree* rootNode)
                 ddPatternNode->partNum,
                 ddPatternNode->partTotal,
                 (char*)ddPatternNode->pattern.pattern,
-                (u_int32_t)ddPatternNode->pattern.patternSize);
+                (uint32_t)ddPatternNode->pattern.patternSize);
         }
 
         if (primaryPatternNode->nextLevelMatcher)
@@ -344,7 +344,7 @@ static tPatternNode* patternSelector(const tMatchedPatternList* patternMatchList
                 "\t\tid %d, Pattern %s, size %u, partNum %u, partTotal %u, userData %p\n",
                 ddPatternNode->patternId,
                 ddPatternNode->pattern.pattern,
-                (u_int32_t)ddPatternNode->pattern.patternSize,
+                (uint32_t)ddPatternNode->pattern.patternSize,
                 ddPatternNode->partNum,
                 ddPatternNode->partTotal,
                 ddPatternNode->userData);
@@ -402,7 +402,7 @@ static tPatternNode* patternSelector(const tMatchedPatternList* patternMatchList
                 "\t\tSELECTED Id %d, pattern %s, size %u, partNum %u, partTotal %u, userData %p\n",
                 ddPatternNode->patternId,
                 ddPatternNode->pattern.pattern,
-                (u_int32_t)ddPatternNode->pattern.patternSize,
+                (uint32_t)ddPatternNode->pattern.patternSize,
                 ddPatternNode->partNum,
                 ddPatternNode->partTotal,
                 ddPatternNode->userData);
@@ -441,7 +441,7 @@ static int patternMatcherCallback(void* id, void*, int index, void* data, void*)
         "\tCallback id %d, Pattern %s, size %u, partNum %u, partTotal %u, userData %p\n",
         target->patternId,
         target->pattern.pattern,
-        (u_int32_t)target->pattern.patternSize,
+        (uint32_t)target->pattern.patternSize,
         target->partNum,
         target->partTotal,
         target->userData);
index 23620ad8608dcae71613e46b7ce186902de0f4d6..db6b75c45599389b82c31c9d9fe23acad6967be8 100644 (file)
@@ -245,7 +245,7 @@ static void dumpTreesRecursively(void* root, int level)
     {
         printf("%sPattern %s, size %u, userData %p\n", offset,
             (char*)patternNode->pattern.pattern,
-            (u_int32_t)patternNode->pattern.patternSize,
+            (uint32_t)patternNode->pattern.patternSize,
             patternNode->userData);
 
         /*recursion into next lower level */
index c79710534eb19aa4b526e2f7a37e78ab4a98c67a..f02ec54466f2a3b90ac9f8102edf5f3201e60cfb 100644 (file)
@@ -94,7 +94,7 @@ SO_PUBLIC RNAClientAppModule bit_client_mod =
 
 struct Client_App_Pattern
 {
-    const u_int8_t* pattern;
+    const uint8_t* pattern;
     unsigned length;
     int index;
     unsigned appId;
index 50384cbbb1f4fab594a9eff7175d0eb72ae399f9..4327736fdb08f198a4e46ba4472b3d83d5829917 100644 (file)
@@ -92,7 +92,7 @@ SO_PUBLIC RNAClientAppModule bit_tracker_client_mod =
 
 struct Client_App_Pattern
 {
-    const u_int8_t* pattern;
+    const uint8_t* pattern;
     unsigned length;
     int index;
     unsigned appId;
index 18afbb96927731adcf95804dc3066378932f88da..de17a8f67515f66dd1b30132cfe481a1d2bf3a5d 100644 (file)
@@ -115,10 +115,10 @@ static CLIENT_APP_RETCODE msn_init(const IniClientAppAPI* const init_api, SF_LIS
 static CLIENT_APP_RETCODE msn_validate(const uint8_t* data, uint16_t size, const int dir,
     AppIdSession* flowp, Packet* pkt, struct Detector*, const AppIdConfig*)
 {
-    const u_int8_t* end;
-    u_int8_t version[MAX_VERSION_SIZE];
-    u_int8_t* v;
-    u_int8_t* v_end;
+    const uint8_t* end;
+    uint8_t version[MAX_VERSION_SIZE];
+    uint8_t* v;
+    uint8_t* v_end;
     uint32_t product_id;
 
     product_id = APP_ID_MSN_MESSENGER;
index b707663f27d2ff6de1a09b289332ab28e4c8dc3b..445ef45a8e6655be4d513de891ae65d1e770507a 100644 (file)
@@ -103,7 +103,7 @@ SO_PUBLIC RNAClientAppModule rtp_client_mod =
 
 struct Client_App_Pattern
 {
-    const u_int8_t* pattern;
+    const uint8_t* pattern;
     unsigned length;
     int index;
     unsigned appId;
index dff6228454b0ec72eb1053199e84942f4c9551c0..7cb159cc5ec7f9b8c9cf6862c0b529d46c69c180 100644 (file)
@@ -113,7 +113,7 @@ SO_PUBLIC RNAClientAppModule smtp_client_mod =
 
 struct Client_App_Pattern
 {
-    const u_int8_t* pattern;
+    const uint8_t* pattern;
     unsigned length;
     int index;
     unsigned appId;
@@ -245,9 +245,9 @@ static int extract_version_and_add_client_app(ApplicationId clientId,
     ClientSMTPData* const client_data, AppIdSession* flowp, 
     AppId appId, PegCount *stat_counter)
 {
-    const u_int8_t* p;
-    u_int8_t* v;
-    u_int8_t* v_end;
+    const uint8_t* p;
+    uint8_t* v;
+    uint8_t* v_end;
 
     v_end = client_data->version;
     v_end += MAX_VERSION_SIZE - 1;
@@ -276,9 +276,9 @@ static int extract_version_and_add_client_app(ApplicationId clientId,
 static int IdentifyClientVersion(ClientSMTPData* const fd, const uint8_t* product,
     const uint8_t* data_end, AppIdSession* flowp, Packet*)
 {
-    const u_int8_t* p;
-    u_int8_t* v;
-    u_int8_t* v_end;
+    const uint8_t* p;
+    uint8_t* v;
+    uint8_t* v_end;
     unsigned len;
     unsigned sublen;
     AppId appId = (fd->flags & CLIENT_FLAG_SMTPS) ?  APP_ID_SMTPS : APP_ID_SMTP;
index 9da0adcfa68df190a70c6f27f77179c56f2a021a..a5b2ebafb156f3459b149b11f7a10a6ca4440bcc 100644 (file)
@@ -176,7 +176,7 @@ SO_PUBLIC RNAClientAppModule ssh_client_mod =
 
 struct Client_App_Pattern
 {
-    const u_int8_t* pattern;
+    const uint8_t* pattern;
     unsigned length;
     int index;
     unsigned appId;
index 622ba9b938fa6694474dc49075761e787ff529a5..11165a53c033f266a95af5037602bfed9096ca4e 100644 (file)
@@ -90,7 +90,7 @@ SO_PUBLIC RNAClientAppModule timbuktu_client_mod =
 
 struct Client_App_Pattern
 {
-    const u_int8_t* pattern;
+    const uint8_t* pattern;
     unsigned length;
     int index;
     unsigned appId;
index 0a4467f2c5732c0e27db61f8acef7a20235e6439..a1f0e998bf86425152e6a35933cc0de987980ca7 100644 (file)
@@ -150,7 +150,7 @@ SO_PUBLIC RNAClientAppModule tns_client_mod =
 
 struct Client_App_Pattern
 {
-    const u_int8_t* pattern;
+    const uint8_t* pattern;
     unsigned length;
     int index;
     unsigned appId;
index a54a37dabee104170eb72af19c0df53812c3defd..f3cc2a59b0afa769ccac1b7ba2f8ddb8c6d44a97 100644 (file)
@@ -77,7 +77,7 @@ SO_PUBLIC RNAClientAppModule vnc_client_mod =
 
 struct Client_App_Pattern
 {
-    const u_int8_t* pattern;
+    const uint8_t* pattern;
     unsigned length;
     int index;
     unsigned appId;
index 51d26f7460c7d90367bd1346f3978113b4c3e3bc..f46c8bd51e62e4a4f68fd107fb570ec8e8b5c2a2 100644 (file)
@@ -60,7 +60,7 @@ RNAClientAppModule ym_client_mod =
 
 struct Client_App_Pattern
 {
-    const u_int8_t* pattern;
+    const uint8_t* pattern;
     unsigned length;
     int index;
     unsigned appId;
index 7bf157ee53ff63773b3752ef71d96683c09df49f..e5f472444cfdfc78f4a2c6cafe299ba4cd668360 100644 (file)
@@ -778,7 +778,7 @@ inprocess:
     return SERVICE_INPROCESS;
 }
 
-static int dns_host_scan_patterns(SearchTool* matcher, const u_int8_t* pattern, size_t size,
+static int dns_host_scan_patterns(SearchTool* matcher, const uint8_t* pattern, size_t size,
     AppId* ClientAppId, AppId* payloadId)
 {
     MatchedDNSPatterns* mp = nullptr;
@@ -826,7 +826,7 @@ static int dns_host_scan_patterns(SearchTool* matcher, const u_int8_t* pattern,
     return 1;
 }
 
-int dns_host_scan_hostname(const u_int8_t* pattern, size_t size, AppId* ClientAppId,
+int dns_host_scan_hostname(const uint8_t* pattern, size_t size, AppId* ClientAppId,
     AppId* payloadId, const ServiceDnsConfig* pDnsConfig)
 {
     return dns_host_scan_patterns(pDnsConfig->dns_host_host_matcher, pattern, size, ClientAppId,
index 5cc24c8efe6a7d557446fd39f1b51462997f9d79..b262de8ebd5ac72bf6b0c96939bdda2ff3577991 100644 (file)
@@ -32,7 +32,7 @@ extern struct RNAServiceValidationModule dns_service_mod;
 extern struct RNAClientAppModule dns_udp_client_mod;
 extern struct RNAClientAppModule dns_tcp_client_mod;
 
-int dns_host_scan_hostname(const u_int8_t*, size_t, AppId*, AppId*, const ServiceDnsConfig*);
+int dns_host_scan_hostname(const uint8_t*, size_t, AppId*, AppId*, const ServiceDnsConfig*);
 void service_dns_host_clean(ServiceDnsConfig* pConfig);
 int dns_host_detector_process_patterns(ServiceDnsConfig* pConfig);
 int dns_add_host_pattern(uint8_t*, size_t, uint8_t, AppId, ServiceDnsConfig*);
index 066f4b50c6e59d593186e64fc8e803783c691467..135cd7155b2caa7a5d6ebac4cb6816da69fe5004 100644 (file)
@@ -129,7 +129,7 @@ struct HeaderMatchedPatterns
 
 
 
-int geAppidByViaPattern(const u_int8_t*, unsigned, char**, const DetectorHttpConfig*);
+int geAppidByViaPattern(const uint8_t*, unsigned, char**, const DetectorHttpConfig*);
 int getHTTPHeaderLocation(const uint8_t*, unsigned, HttpId, int*, int*, HeaderMatchedPatterns*,
         const DetectorHttpConfig*);
 inline void FreeMatchedCHPActions(MatchedCHPAction* ma)
@@ -152,7 +152,7 @@ AppId getAppIdFromUrl(char*, char*, char**, char*, AppId*, AppId*, AppId*, AppId
         const DetectorHttpConfig*);
 AppId geAppidByContentType(const uint8_t*, int, const DetectorHttpConfig*);
 AppId scan_header_x_working_with(const uint8_t*, uint32_t, char**);
-void identifyUserAgent(const u_int8_t*, int, AppId*, AppId*, char**, const DetectorHttpConfig*);
+void identifyUserAgent(const uint8_t*, int, AppId*, AppId*, char**, const DetectorHttpConfig*);
 void getServerVendorVersion(const uint8_t*, int, char**, char**, RNAServiceSubtype**);
 int webdav_found(HeaderMatchedPatterns*);
 int http_detector_finalize(AppIdConfig*);
index 3a880f13e63bd625d21af270f08b0a8e38763346..69aa4e72cc571299cc1c696bce048b0234c4ce3f 100644 (file)
@@ -39,7 +39,7 @@ int matchQueryElements(tMlpPattern* packetData,
     char* appVersion,
     size_t appVersionSize);
 
-uint32_t parseMultipleHTTPPatterns(const char* pattern, tMlmpPattern* parts, u_int32_t
+uint32_t parseMultipleHTTPPatterns(const char* pattern, tMlmpPattern* parts, uint32_t
     numPartLimit, int level);
 void destroyHosUrlPatternList(HosUrlPatternsList** pHosUrlPatternsList);
 
index 52dd5d84b0eec992964680cc7b34d1572f3280e2..6928f42b88564f51fd17cc093128af7c4436f541 100644 (file)
 void dump_appid_stats()
 {
     LogMessage("Application Identification Preprocessor:\n");
-    LogMessage("   Total packets received : %lu\n", appid_stats.packets);
-    LogMessage("  Total packets processed : %lu\n", appid_stats.processed_packets);
+    LogMessage("   Total packets received : %" PRIu64 "\n", appid_stats.packets);
+    LogMessage("  Total packets processed : %" PRIu64 "\n", appid_stats.processed_packets);
     if (thirdparty_appid_module)
         thirdparty_appid_module->print_stats();
-    LogMessage("    Total packets ignored : %lu\n", appid_stats.ignored_packets);
+    LogMessage("    Total packets ignored : %" PRIu64 "\n", appid_stats.ignored_packets);
     AppIdServiceStateDumpStats();
     RNAPndDumpLuaStats();
 }
index b6ae7f6dc87e79da224f02e1238cf1315d3ed474..b79a08cf05327ec312d09c7c2ab9f2930445a2ab 100644 (file)
@@ -1985,8 +1985,8 @@ static int Detector_portOnlyService(lua_State* L)
     }
 
     AppId appId = lua_tointeger(L, index++);
-    u_int16_t port = lua_tointeger(L, index++);
-    u_int8_t protocol = lua_tointeger(L, index++);
+    uint16_t port = lua_tointeger(L, index++);
+    uint8_t protocol = lua_tointeger(L, index++);
 
     if (port == 0)
         ud->pAppidNewConfig->ip_protocol[protocol] = appId;
@@ -2163,11 +2163,11 @@ static int Detector_addAppUrl(lua_State* L)
         return 0;
     }
 
-    u_int32_t service_id      = lua_tointeger(L, index++);
-    u_int32_t client_app      = lua_tointeger(L, index++);
-    /*u_int32_t client_app_type =*/ lua_tointeger(L, index++);
-    u_int32_t payload         = lua_tointeger(L, index++);
-    /*u_int32_t payload_type    =*/ lua_tointeger(L, index++);
+    uint32_t service_id      = lua_tointeger(L, index++);
+    uint32_t client_app      = lua_tointeger(L, index++);
+    /*uint32_t client_app_type =*/ lua_tointeger(L, index++);
+    uint32_t payload         = lua_tointeger(L, index++);
+    /*uint32_t payload_type    =*/ lua_tointeger(L, index++);
 
     if (ud->validateParams.pkt)
     {
@@ -2179,7 +2179,7 @@ static int Detector_addAppUrl(lua_State* L)
 
     /* Verify that host pattern is a valid string */
     size_t hostPatternSize = 0;
-    u_int8_t* hostPattern = nullptr;
+    uint8_t* hostPattern = nullptr;
     tmpString = lua_tolstring(L, index++, &hostPatternSize);
     if (!tmpString || !hostPatternSize)
     {
@@ -2187,11 +2187,11 @@ static int Detector_addAppUrl(lua_State* L)
         return 0;
     }
     else
-        hostPattern = (u_int8_t*)snort_strdup(tmpString);
+        hostPattern = (uint8_t*)snort_strdup(tmpString);
 
     /* Verify that path pattern is a valid string */
     size_t pathPatternSize = 0;
-    u_int8_t* pathPattern = nullptr;
+    uint8_t* pathPattern = nullptr;
     tmpString = lua_tolstring(L, index++, &pathPatternSize);
     if (!tmpString || !pathPatternSize )
     {
@@ -2200,11 +2200,11 @@ static int Detector_addAppUrl(lua_State* L)
         return 0;
     }
     else
-        pathPattern = (u_int8_t*)snort_strdup(tmpString);
+        pathPattern = (uint8_t*)snort_strdup(tmpString);
 
     /* Verify that scheme pattern is a valid string */
     size_t schemePatternSize;
-    u_int8_t* schemePattern = nullptr;
+    uint8_t* schemePattern = nullptr;
     tmpString = lua_tolstring(L, index++, &schemePatternSize);
     if (!tmpString || !schemePatternSize )
     {
@@ -2214,16 +2214,16 @@ static int Detector_addAppUrl(lua_State* L)
         return 0;
     }
     else
-        schemePattern = (u_int8_t*)snort_strdup(tmpString);
+        schemePattern = (uint8_t*)snort_strdup(tmpString);
 
     /* Verify that query pattern is a valid string */
     size_t queryPatternSize;
-    u_int8_t* queryPattern = nullptr;
+    uint8_t* queryPattern = nullptr;
     tmpString = lua_tolstring(L, index++, &queryPatternSize);
     if (tmpString && queryPatternSize)
-        queryPattern = (u_int8_t*)snort_strdup(tmpString);
+        queryPattern = (uint8_t*)snort_strdup(tmpString);
 
-    u_int32_t appId = lua_tointeger(L, index++);
+    uint32_t appId = lua_tointeger(L, index++);
 
     /* Allocate memory for data structures */
     DetectorAppUrlPattern* pattern =
@@ -2287,11 +2287,11 @@ static int Detector_addRTMPUrl(lua_State* L)
         return 0;
     }
 
-    u_int32_t service_id      = lua_tointeger(L, index++);
-    u_int32_t client_app      = lua_tointeger(L, index++);
-    /*u_int32_t client_app_type =*/ lua_tointeger(L, index++);
-    u_int32_t payload         = lua_tointeger(L, index++);
-    /*u_int32_t payload_type    =*/ lua_tointeger(L, index++);
+    uint32_t service_id      = lua_tointeger(L, index++);
+    uint32_t client_app      = lua_tointeger(L, index++);
+    /*uint32_t client_app_type =*/ lua_tointeger(L, index++);
+    uint32_t payload         = lua_tointeger(L, index++);
+    /*uint32_t payload_type    =*/ lua_tointeger(L, index++);
 
     if (ud->validateParams.pkt)
     {
@@ -2303,10 +2303,10 @@ static int Detector_addRTMPUrl(lua_State* L)
 
     /* Verify that host pattern is a valid string */
     size_t hostPatternSize = 0;
-    u_int8_t* hostPattern = nullptr;
+    uint8_t* hostPattern = nullptr;
     tmpString = lua_tolstring(L, index++, &hostPatternSize);
     // FIXIT-L: recode all this to something elegant since snort_strdup can't fail (just like Rudy)
-    if (!tmpString || !hostPatternSize || !(hostPattern = (u_int8_t*)snort_strdup(tmpString)))
+    if (!tmpString || !hostPatternSize || !(hostPattern = (uint8_t*)snort_strdup(tmpString)))
     {
         ErrorMessage("Invalid host pattern string.");
         return 0;
@@ -2314,10 +2314,10 @@ static int Detector_addRTMPUrl(lua_State* L)
 
     /* Verify that path pattern is a valid string */
     size_t pathPatternSize = 0;
-    u_int8_t* pathPattern = nullptr;
+    uint8_t* pathPattern = nullptr;
     tmpString = lua_tolstring(L, index++, &pathPatternSize);
     // FIXIT-L: recode all this to something elegant since snort_strdup can't fail (just like Rudy)
-    if (!tmpString || !pathPatternSize || !(pathPattern = (u_int8_t*)snort_strdup(tmpString)))
+    if (!tmpString || !pathPatternSize || !(pathPattern = (uint8_t*)snort_strdup(tmpString)))
     {
         ErrorMessage("Invalid path pattern string.");
         snort_free(hostPattern);
@@ -2326,10 +2326,10 @@ static int Detector_addRTMPUrl(lua_State* L)
 
     /* Verify that scheme pattern is a valid string */
     size_t schemePatternSize;
-    u_int8_t* schemePattern = nullptr;
+    uint8_t* schemePattern = nullptr;
     tmpString = lua_tolstring(L, index++, &schemePatternSize);
     // FIXIT-L: recode all this to something elegant since snort_strdup can't fail (just like Rudy)
-    if (!tmpString || !schemePatternSize || !(schemePattern = (u_int8_t*)snort_strdup(tmpString)))
+    if (!tmpString || !schemePatternSize || !(schemePattern = (uint8_t*)snort_strdup(tmpString)))
     {
         ErrorMessage("Invalid scheme pattern string.");
         snort_free(pathPattern);
@@ -2339,12 +2339,12 @@ static int Detector_addRTMPUrl(lua_State* L)
 
     /* Verify that query pattern is a valid string */
     size_t queryPatternSize;
-    u_int8_t* queryPattern = nullptr;
+    uint8_t* queryPattern = nullptr;
     tmpString = lua_tolstring(L, index++, &queryPatternSize);
     if (tmpString  && queryPatternSize)
-        queryPattern = (u_int8_t*)snort_strdup(tmpString);
+        queryPattern = (uint8_t*)snort_strdup(tmpString);
 
-    u_int32_t appId           = lua_tointeger(L, index++);
+    uint32_t appId           = lua_tointeger(L, index++);
 
     /* Allocate memory for data structures */
     DetectorAppUrlPattern* pattern = (DetectorAppUrlPattern*)snort_calloc(
@@ -2404,7 +2404,7 @@ static int Detector_addSipUserAgent(lua_State* L)
     /* Verify detector user data and that we are not in packet context */
     auto& ud = *UserData<Detector>::check(L, DETECTOR, index++);
 
-    u_int32_t client_app      = lua_tointeger(L, index++);
+    uint32_t client_app      = lua_tointeger(L, index++);
     const char* clientVersion       = lua_tostring(L, index++);
     if (!clientVersion )
     {
@@ -2656,9 +2656,9 @@ static int openAddUrlPattern(lua_State* L)
     }
 
     AppIdConfig* pConfig = ud->pAppidNewConfig;
-    u_int32_t serviceAppId      = lua_tointeger(L, index++);
-    u_int32_t clienAppId      = lua_tointeger(L, index++);
-    u_int32_t payloadAppId         = lua_tointeger(L, index++);
+    uint32_t serviceAppId      = lua_tointeger(L, index++);
+    uint32_t clienAppId      = lua_tointeger(L, index++);
+    uint32_t payloadAppId         = lua_tointeger(L, index++);
 
     if (ud->validateParams.pkt)
     {
@@ -2670,9 +2670,9 @@ static int openAddUrlPattern(lua_State* L)
 
     /* Verify that host pattern is a valid string */
     size_t hostPatternSize = 0;
-    u_int8_t* hostPattern = nullptr;
+    uint8_t* hostPattern = nullptr;
     tmpString = lua_tolstring(L, index++, &hostPatternSize);
-    if (!tmpString || !hostPatternSize || !(hostPattern = (u_int8_t* )snort_strdup(tmpString)))
+    if (!tmpString || !hostPatternSize || !(hostPattern = (uint8_t* )snort_strdup(tmpString)))
     {
         ErrorMessage("Invalid host pattern string.");
         return 0;
@@ -2680,9 +2680,9 @@ static int openAddUrlPattern(lua_State* L)
 
     /* Verify that path pattern is a valid string */
     size_t pathPatternSize = 0;
-    u_int8_t* pathPattern = nullptr;
+    uint8_t* pathPattern = nullptr;
     tmpString = lua_tolstring(L, index++, &pathPatternSize);
-    if (!tmpString || !pathPatternSize || !(pathPattern = (u_int8_t*)snort_strdup(tmpString)))
+    if (!tmpString || !pathPatternSize || !(pathPattern = (uint8_t*)snort_strdup(tmpString)))
     {
         ErrorMessage("Invalid path pattern string.");
         snort_free(hostPattern);
@@ -2691,9 +2691,9 @@ static int openAddUrlPattern(lua_State* L)
 
     /* Verify that scheme pattern is a valid string */
     size_t schemePatternSize;
-    u_int8_t* schemePattern = nullptr;
+    uint8_t* schemePattern = nullptr;
     tmpString = lua_tolstring(L, index++, &schemePatternSize);
-    if (!tmpString || !schemePatternSize || !(schemePattern = (u_int8_t*)snort_strdup(tmpString)))
+    if (!tmpString || !schemePatternSize || !(schemePattern = (uint8_t*)snort_strdup(tmpString)))
     {
         ErrorMessage("Invalid scheme pattern string.");
         snort_free(pathPattern);
@@ -2960,7 +2960,7 @@ static int Detector_addSipServer(lua_State* L)
     /* Verify detector user data and that we are not in packet context */
     auto& ud = *UserData<Detector>::check(L, DETECTOR, index++);
 
-    u_int32_t client_app      = lua_tointeger(L, index++);
+    uint32_t client_app      = lua_tointeger(L, index++);
     const char* clientVersion       = lua_tostring(L, index++);
     if (!clientVersion )
     {
index fcd05f30e5521768ea1c97d43d6f7b6e56404e29..24053a2a35e2a99087c4158acd3343179d0ec0f7 100644 (file)
@@ -498,9 +498,9 @@ void LuaDetectorModuleManager::luaModuleInit()
 #define LUA_TRACKERS_MAX  10000
 #define LUA_TRACKER_AVG_MEM_BYTES  740
 
-static inline uint32_t calculateLuaTrackerSize(u_int64_t rnaMemory, uint32_t numDetectors)
+static inline uint32_t calculateLuaTrackerSize(uint64_t rnaMemory, uint32_t numDetectors)
 {
-    u_int64_t detectorMemory = (rnaMemory/8);
+    uint64_t detectorMemory = (rnaMemory/8);
     unsigned numTrackers;
     if (!numDetectors)
         numDetectors = 1;
index 310bc0eca1fd4e7fc4eadb5cf075b553c6c7fac0..fe7d4dc8f381bc247cd65957b299b30ed8659093 100644 (file)
 
 #include <netdb.h>
 
-#if defined(FREEBSD) || defined(OPENBSD)
+#if defined(__FreeBSD__) || defined(__OpenBSD__)
 #include <rpc/rpc.h>
+#elif defined(__sun)
+#include <rpc/rpcent.h>
 #endif
 
 #include "service_api.h"
index 7db3eca1fd852729aa938e5ce2279a065450199a..10354c4daf457a130ba02714d40483ad5e63e0cb 100644 (file)
@@ -1003,7 +1003,7 @@ bool isSslServiceAppId(AppId appId)
     return false;
 }
 
-static int ssl_scan_patterns(SearchTool* matcher, const u_int8_t* pattern, size_t size,
+static int ssl_scan_patterns(SearchTool* matcher, const uint8_t* pattern, size_t size,
     AppId* ClientAppId, AppId* payloadId)
 {
     MatchedSSLPatterns* mp = nullptr;
@@ -1057,13 +1057,13 @@ static int ssl_scan_patterns(SearchTool* matcher, const u_int8_t* pattern, size_
     return 1;
 }
 
-int ssl_scan_hostname(const u_int8_t* pattern, size_t size, AppId* ClientAppId, AppId* payloadId,
+int ssl_scan_hostname(const uint8_t* pattern, size_t size, AppId* ClientAppId, AppId* payloadId,
     ServiceSslConfig* pSslConfig)
 {
     return ssl_scan_patterns(pSslConfig->ssl_host_matcher, pattern, size, ClientAppId, payloadId);
 }
 
-int ssl_scan_cname(const u_int8_t* pattern, size_t size, AppId* ClientAppId, AppId* payloadId,
+int ssl_scan_cname(const uint8_t* pattern, size_t size, AppId* ClientAppId, AppId* payloadId,
     ServiceSslConfig* pSslConfig)
 {
     return ssl_scan_patterns(pSslConfig->ssl_cname_matcher, pattern, size, ClientAppId, payloadId);
index 83aa62ba48f04e92bc110f0d9e403877d83cd457..1b8c45c89ea3e8a54280834f45494204cba913d3 100644 (file)
@@ -30,8 +30,8 @@ AppId getSslServiceAppId(short srcPort);
 bool isSslServiceAppId(AppId);
 void service_ssl_clean(ServiceSslConfig*);
 int ssl_detector_process_patterns(ServiceSslConfig*);
-int ssl_scan_hostname(const u_int8_t*, size_t, AppId*, AppId*, ServiceSslConfig*);
-int ssl_scan_cname(const u_int8_t*, size_t, AppId*, AppId*, ServiceSslConfig*);
+int ssl_scan_hostname(const uint8_t*, size_t, AppId*, AppId*, ServiceSslConfig*);
+int ssl_scan_cname(const uint8_t*, size_t, AppId*, AppId*, ServiceSslConfig*);
 int ssl_add_cert_pattern(uint8_t*, size_t, uint8_t, AppId, ServiceSslConfig*);
 int ssl_add_cname_pattern(uint8_t*, size_t, uint8_t, AppId, ServiceSslConfig*);
 void ssl_detector_free_patterns(ServiceSslConfig*);
index 10fedd7f777e13fcebeaff476d3b912202bdd0fb..8a2efccd74f27103ecfc5365236b453be830a1f8 100644 (file)
@@ -101,7 +101,7 @@ static const AppRegistryEntry appIdRegistry[] =
 static int timbuktu_init(const IniServiceAPI* const init_api)
 {
     init_api->RegisterPattern(&timbuktu_validate, IpProtocol::TCP, (const
-        u_int8_t*)TIMBUKTU_BANNER,
+        uint8_t*)TIMBUKTU_BANNER,
         sizeof(TIMBUKTU_BANNER)-1, 0, svc_name, init_api->pAppidConfig);
     for (unsigned i=0; i < sizeof(appIdRegistry)/sizeof(*appIdRegistry); i++)
     {
index 5d2a7d36405d13fb5a215bcbf0fa771861baf360..4981a5f057f2d01f85d18bd777404f00456f0ddd 100644 (file)
@@ -119,7 +119,7 @@ static void PrintIPMacEntryList(IPMacEntryList& ipmel)
         return;
 
     LogMessage("Arpspoof IPMacEntry List");
-    LogMessage("  Size: %ld\n", ipmel.size());
+    LogMessage("  Size: %zu\n", ipmel.size());
 
     for ( auto p : ipmel )
     {
index 77924686b70fbda9f2037a07bc3baf5e15c1a882..591b44e6f0f5c90a2ebbbd3e918ae1abe885126c 100644 (file)
@@ -24,7 +24,6 @@
 #include <string.h>
 
 #include <string>
-using namespace std;
 
 #include "binding.h"
 #include "protocols/packet.h"
@@ -35,6 +34,8 @@ using namespace std;
 #include "managers/module_manager.h"
 #include "parser/parser.h"
 
+using namespace std;
+
 #define FILE_KEY ".file"
 
 THREAD_LOCAL BindStats bstats;
index 06685b034cb041ad470759884b7cf461116fe8a3..31ab2899b4c9b60dde83700f8e602cad1d41b7e4 100644 (file)
@@ -20,7 +20,6 @@
 #include "binder.h"
 
 #include <vector>
-using namespace std;
 
 #include "binding.h"
 #include "bind_module.h"
@@ -44,6 +43,8 @@ using namespace std;
 #include "target_based/sftarget_reader.h"
 #include "packet_io/active.h"
 
+using namespace std;
+
 THREAD_LOCAL ProfileStats bindPerfStats;
 
 // FIXIT-P these lookups should be optimized when the dust settles
index 23b05868045f7aad87900325ed10cbefcb945c9d..0eadb954f218eae27c991afcbc1560e0eb632004 100644 (file)
@@ -24,7 +24,7 @@
 
 #include "packet_capture.h"
 
-#include <pcap/pcap.h>
+#include <pcap.h>
 #include <sfbpf.h>
 #include <string>
 
 #include "catch/catch.hpp"
 #endif
 
+using namespace std;
+
 #define FILE_NAME "packet_capture.pcap"
 #define SNAP_LEN 65535
 
-using namespace std;
-
 static CaptureConfig config;
 
 static THREAD_LOCAL pcap_t* pcap = nullptr;
index e2149e47813568e48c82557915e4318ea02b061d..8aefd9e0c2c6dfade362b57081838c98321291f5 100644 (file)
 #include "utils/util.h"
 #endif
 
-#define BASE_FILE (PERF_NAME ".csv")
-
 using namespace std;
 
+#define BASE_FILE (PERF_NAME ".csv")
+
 BaseTracker::BaseTracker(PerfConfig* perf) : PerfTracker(perf,
     perf->output == PERF_FILE ? BASE_FILE : nullptr)
 {
index 72594d7540f61c7f0ba9f4a82ab31a7ecc09a60b..da4e77e29c9a81957232cffbd6e9bd66a1ee99bc 100644 (file)
@@ -67,7 +67,11 @@ void CPUTracker::get_clocks(struct timeval& user_time,
     sys_time.tv_usec = thi->system_time.microseconds;
 #else
     struct rusage usage;
+#ifdef RUSAGE_LWP
+    getrusage(RUSAGE_LWP, &usage);
+#else
     getrusage(RUSAGE_THREAD, &usage);
+#endif
     user_time = usage.ru_utime;
     sys_time = usage.ru_stime;
 #endif
index 3f7a3a61abd17626273641af9dceb8a50e1d4520..1c00e682b8038747ea73de4b0fb0d039d08d0ec7 100644 (file)
@@ -419,7 +419,7 @@ bool SFDAQInstance::can_whitelist()
 bool SFDAQInstance::set_filter(const char* bpf)
 {
     int err = 0;
-    static mutex bpf_gate;
+    static std::mutex bpf_gate;
 
     // doesn't look like the bpf flex scanner is reentrant
     bpf_gate.lock();
index ee0e8d77fc3e225938c74af7145a1a7f356c84b7..7bee63cea5331b9ebf2f6d9d73349ea17b3f4a3f 100644 (file)
@@ -23,7 +23,7 @@
 #define SFDAQ_H
 
 extern "C" {
-#include <daq.h>
+#include <daq_common.h>
 }
 
 #include <string>
index c8a97508614cc50a009fc3154fb65efc16cbb67c..b0a8f11e5ea441544ec99d704e3b9e4f18fb8108 100644 (file)
@@ -24,7 +24,6 @@
 #endif
 
 #include <string>
-using namespace std;
 
 #include "main/help.h"
 #include "main/snort_module.h"
@@ -36,6 +35,8 @@ using namespace std;
 #include "parser/parser.h"
 #include "utils/util.h"
 
+using namespace std;
+
 //-------------------------------------------------------------------------
 
 static void check_flags(SnortConfig* sc)
index 55ed4b66865494f984fa29638f3efd44d308c47d..1e1d0497ce600de4179255847fdaa6c5aeebd578 100644 (file)
@@ -26,7 +26,6 @@
 #include <istream>
 #include <sstream>
 #include <string>
-using namespace std;
 
 #include "parser.h"
 #include "parse_conf.h"
@@ -35,6 +34,8 @@ using namespace std;
 #include "log/messages.h"
 #include "managers/ips_manager.h"
 
+using namespace std;
+
 static unsigned chars = 0, tokens = 0;
 static unsigned lines = 1, comments = 0;
 static unsigned keys = 0, rules = 0;
index b78c2dba93f9449a8bdaec8041fb5afd281bc219..1a1532e46d7566051ee3f49e7c7f02bb388cdd23 100644 (file)
@@ -43,7 +43,7 @@ using namespace std;
 // Manager State
 // -----------------------------------------------------------------------------
 
-map<PlugType, Api*> plugins;
+std::map<PlugType, Api*> plugins;
 vector<Chunk> chunks;
 
 // -----------------------------------------------------------------------------
index bb07d5b5a049005cb374885263c0714887fc926a..0c3b5d4844303f36d61f08f7141a1f62b1cadab2 100644 (file)
@@ -80,7 +80,7 @@ namespace Piglet
 const struct Output unit_test_output =
 {
     [](const std::vector<Chunk>& chunks) -> void
-    { printf("Running suite: piglet (%lu tests)\n", chunks.size()); },
+    { printf("Running suite: piglet (%zu tests)\n", chunks.size()); },
 
     [](const Summary& sum) -> void
     {
@@ -179,7 +179,7 @@ const struct Output verbose_output =
         if ( chunks.size() == 1 )
             printf("=== PIGLET (1 test)\n");
         else
-            printf("=== PIGLET (%lu tests)\n", chunks.size());
+            printf("=== PIGLET (%zu tests)\n", chunks.size());
     },
 
     [](const Summary& sum) -> void
index 7964ccbb37ef382597a65cb4cd52ef7b3adc8168..94993f96034d4d68ca2faa9171e07abb2c8b4eed 100644 (file)
@@ -27,7 +27,7 @@
 #include <lua.hpp>
 
 extern "C" {
-#include <daq.h>
+#include <daq_common.h>
 }
 
 #include "lua/lua_arg.h"
index 936d12ed8ebf8189e07d10b3dcc44b19a5f055d1..7a127f5684abadd12e5b0e1c2923d270e5eee143 100644 (file)
@@ -39,10 +39,9 @@ Packet::Packet(bool packet_data)
     }
     else
     {
-        uint8_t* b = new uint8_t[sizeof(*pkth) + Codec::PKT_MAX + SPARC_TWIDDLE];
+        uint8_t* b = new uint8_t[sizeof(*pkth) + Codec::PKT_MAX];
         pkth = (DAQ_PktHdr_t*)b;
         b += sizeof(*pkth);
-        b += SPARC_TWIDDLE;
         pkt = b;
     }
 
index ef51234467e02a582df006c09f8f1c2ecec4c583..43516ec39a4df45056e78e210bf5395b3646deef 100644 (file)
@@ -31,8 +31,7 @@
 #include <net/if.h>
 
 extern "C" {
-#include <daq.h>
-#include <sfbpf_dlt.h>
+#include <daq_common.h>
 }
 
 #include "main/snort_types.h"
@@ -100,16 +99,6 @@ enum PseudoPacketType
     PSEUDO_PKT_MAX
 };
 
-/* We must twiddle to align the offset the ethernet header and align
- * the IP header on solaris -- maybe this will work on HPUX too.
- */
-#if defined (SOLARIS) || defined (SUNOS) || defined (__sparc__) || defined(__sparc64__) || \
-    defined (HPUX)
-#define SPARC_TWIDDLE       2
-#else
-#define SPARC_TWIDDLE       0
-#endif
-
 /* default mpls flags */
 #define DEFAULT_MPLS_PAYLOADTYPE      MPLS_PAYLOADTYPE_IPV4
 #define DEFAULT_LABELCHAIN_LENGTH    -1
@@ -295,21 +284,6 @@ inline void SetExtraData(Packet* p, const uint32_t xid)
 inline uint16_t extract_16bits(const uint8_t* const p)
 { return ntohs(*(uint16_t*)(p)); }
 
-#ifdef WORDS_MUSTALIGN
-
-#ifdef __GNUC__
-/* force word-aligned ntohl parameter */
-inline uint32_t extract_32bits(const uint8_t* p)
-{
-    uint32_t tmp;
-    memmove(&tmp, p, sizeof(uint32_t));
-    return ntohl(tmp);
-}
-#endif
-
-#else
-
-/* allows unaligned ntohl parameter - dies w/SIGBUS on SPARCs */
 inline uint32_t extract_32bits(const uint8_t* p)
 {
     assert(p);
@@ -317,8 +291,6 @@ inline uint32_t extract_32bits(const uint8_t* p)
     return ntohl(*(uint32_t*)p);
 }
 
-#endif
-
 inline uint16_t alignedNtohs(const uint16_t* ptr)
 {
     uint16_t value;
@@ -326,11 +298,7 @@ inline uint16_t alignedNtohs(const uint16_t* ptr)
     if (ptr == nullptr)
         return 0;
 
-#ifdef WORDS_MUSTALIGN
-    value = *((uint8_t*)ptr) << 8 | *((uint8_t*)ptr + 1);
-#else
     value = *ptr;
-#endif
 
 #ifdef WORDS_BIGENDIAN
     return ((value & 0xff00) >> 8) | ((value & 0x00ff) << 8);
@@ -346,12 +314,7 @@ inline uint32_t alignedNtohl(const uint32_t* ptr)
     if (ptr == nullptr)
         return 0;
 
-#ifdef WORDS_MUSTALIGN
-    value = *((uint8_t*)ptr) << 24 | *((uint8_t*)ptr + 1) << 16 |
-        *((uint8_t*)ptr + 2) << 8  | *((uint8_t*)ptr + 3);
-#else
     value = *ptr;
-#endif
 
 #ifdef WORDS_BIGENDIAN
     return ((value & 0xff000000) >> 24) | ((value & 0x00ff0000) >> 8)  |
@@ -368,14 +331,7 @@ inline uint64_t alignedNtohq(const uint64_t* ptr)
     if (ptr == NULL)
         return 0;
 
-#ifdef WORDS_MUSTALIGN
-    value = *((uint8_t*)ptr) << 56 | *((uint8_t*)ptr + 1) << 48 |
-        *((uint8_t*)ptr + 2) << 40 | *((uint8_t*)ptr + 3) << 32 |
-        *((uint8_t*)ptr + 4) << 24 | *((uint8_t*)ptr + 5) << 16 |
-        *((uint8_t*)ptr + 6) << 8  | *((uint8_t*)ptr + 7);
-#else
     value = *ptr;
-#endif
 
 #ifdef WORDS_BIGENDIAN
     return ((value & 0xff00000000000000) >> 56) | ((value & 0x00ff000000000000) >> 40) |
index bb562d40dbd0b566047730cbf9b4b587afe3ec2c..5a6e26d94c6fc3091564061afa6e7b55dbe33497 100644 (file)
@@ -311,7 +311,6 @@ void PacketManager::decode(
 // - don't include original options
 // - inner layer differs from original (eg tcp data segment becomes rst)
 // - must ensure proper ttl/hop limit for reverse direction
-// - sparc twiddle must be factored in packet start for transmission
 //
 // iterate over decoded layers and encode the response packet.  actually
 // make nested calls.  on the way in we setup invariant stuff and as we
index 980d1324294364f09713ef1a709766907100f42d..098f766128cd06c77fa0c61ce486b51d8c0cad5a 100644 (file)
@@ -379,7 +379,7 @@ static void DCE2_Smb2CreateResponse(DCE2_SmbSsnData* ssd, const Smb2Hdr*,
     if (smb_create_hdr->end_of_file)
     {
         file_size = alignedNtohq((const uint64_t*)(&(smb_create_hdr->end_of_file)));
-        DebugFormat(DEBUG_DCE_SMB, "Get file size %lu!\n", file_size);
+        DebugFormat(DEBUG_DCE_SMB, "Get file size %" PRIu64 "!\n", file_size);
         ssd->ftracker.tracker.file.file_size = file_size;
     }
 
@@ -498,7 +498,7 @@ static void DCE2_Smb2SetInfo(DCE2_SmbSsnData* ssd, const Smb2Hdr*,
         if (smb_set_info_hdr->file_info_class == SMB2_FILE_ENDOFFILE_INFO)
         {
             uint64_t file_size = alignedNtohq((const uint64_t*)file_data);
-            DebugFormat(DEBUG_DCE_SMB, "Get file size %lu!\n", file_size);
+            DebugFormat(DEBUG_DCE_SMB, "Get file size %" PRIu64 "!\n", file_size);
             ssd->ftracker.tracker.file.file_size = file_size;
             uint64_t fileId_persistent = alignedNtohq(&(smb_set_info_hdr->fileId_persistent));
             FileContext* file = get_file_context(ssd, fileId_persistent);
index e4bd70e35199e4eb096588b58a348d86010ee7e8..d2145ba5485e04269abc6ddf724e52329f881000 100644 (file)
@@ -1795,7 +1795,7 @@ void DCE2_SmbProcessFileData(DCE2_SmbSsnData* ssd,
     Profile profile(dce2_smb_pstat_smb_file);
 
     DebugFormat(DEBUG_DCE_SMB,
-        "File size: %lu, File offset: %lu, Bytes processed: %lu, "
+        "File size: %" PRIu64 ", File offset: %" PRIu64 ", Bytes processed: %" PRIu64 ", "
         "Data len: %u\n", ftracker->ff_file_size, ftracker->ff_file_offset,
         ftracker->ff_bytes_processed, data_len);
 
@@ -1875,8 +1875,8 @@ void DCE2_SmbProcessFileData(DCE2_SmbSsnData* ssd,
             }
             else if (ftracker->ff_file_offset < ftracker->ff_bytes_processed)
             {
-                DebugFormat(DEBUG_DCE_SMB, "File offset %lu is "
-                    "less than bytes processed %lu - aborting.\n",
+                DebugFormat(DEBUG_DCE_SMB, "File offset %" PRIu64 " is "
+                    "less than bytes processed %" PRIu64 " - aborting.\n",
                     ftracker->ff_file_offset, ftracker->ff_bytes_processed);
 
                 DCE2_SmbAbortFileAPI(ssd);
@@ -1918,8 +1918,8 @@ void DCE2_SmbProcessFileData(DCE2_SmbSsnData* ssd,
             || ((file_data_depth != 0)
             && (ftracker->ff_bytes_processed >= (uint64_t)file_data_depth)))
         {
-            DebugFormat(DEBUG_DCE_SMB, "Bytes processed %lu "
-                "is at or beyond file data depth %lu - finished.\n",
+            DebugFormat(DEBUG_DCE_SMB, "Bytes processed %" PRIu64
+                "is at or beyond file data depth %" PRIi64 " - finished.\n",
                 ftracker->ff_bytes_processed, file_data_depth);
             DCE2_SmbRemoveFileTracker(ssd, ftracker);
 
index e47d7513601aa0a8d1d97314cddb9c838858dcca..e821c23f58803485833dc9c44293fe3076563335 100644 (file)
@@ -293,11 +293,7 @@ inline uint16_t DceRpcNtohs(const uint16_t* ptr, const DceRpcBoFlag bo_flag)
     if (ptr == nullptr)
         return 0;
 
-#ifdef WORDS_MUSTALIGN
-    value = *((uint8_t*)ptr) << 8 | *((uint8_t*)ptr + 1);
-#else
     value = *ptr;
-#endif  /* WORDS_MUSTALIGN */
 
     if (bo_flag == DCERPC_BO_FLAG__NONE)
         return value;
@@ -324,12 +320,7 @@ inline uint32_t DceRpcNtohl(const uint32_t* ptr, const DceRpcBoFlag bo_flag)
     if (ptr == nullptr)
         return 0;
 
-#ifdef WORDS_MUSTALIGN
-    value = *((uint8_t*)ptr) << 24 | *((uint8_t*)ptr + 1) << 16 |
-        *((uint8_t*)ptr + 2) << 8  | *((uint8_t*)ptr + 3);
-#else
     value = *ptr;
-#endif  /* WORDS_MUSTALIGN */
 
     if (bo_flag == DCERPC_BO_FLAG__NONE)
         return value;
index 110c7daf7c48e6bc9cc651a6b8ca073fdbd580e3..0d03ed6380a022707413d1a0a82688b39e3510eb 100644 (file)
 
 #include "rpc_module.h"
 
+using namespace std;
+
 #define RPC_MAX_BUF_SIZE   256
 #define RPC_FRAG_HDR_SIZE  sizeof(uint32_t)
 #define RPC_FRAG_LEN(ptr)  (ntohl(*((uint32_t*)ptr)) & 0x7FFFFFFF)
 
 static THREAD_LOCAL DataBuffer DecodeBuffer;
 
-using namespace std;
-
 struct RpcDecodeConfig
 {
     int dummy;
index aa496f088605b6c9b594362bebe06d0df2b3ecb0..e1abe93c6461a22d3af492953ecaa0d4ffabe43e 100644 (file)
@@ -898,7 +898,7 @@ static int sip_parse_cseq(SIPMsg* msg, const char* start, const char* end, SIP_P
         msg->cseqNameLen = end - msg->cseqName;
         method = SIP_FindMethod (config->methods, msg->cseqName, msg->cseqNameLen);
     }
-    DebugFormat(DEBUG_SIP, "CSeq number: %lu, CSeqName: %.*s\n",
+    DebugFormat(DEBUG_SIP, "CSeq number: %" PRIu64 ", CSeqName: %.*s\n",
         msg->cseqnum, msg->cseqNameLen, msg->cseqName);
 
     if (NULL == method)
index b03130b02022bbe80d3b604d8e948f4cc1bea659..413df4a633e09b071e6a91550cd67c3997a4525c 100644 (file)
 #include <string.h>
 
 #include <string>
-using namespace std;
 
 #include "magic.h"
 
+using namespace std;
+
 //-------------------------------------------------------------------------
 // wizard module
 //-------------------------------------------------------------------------
index 23d22d1fbd41c5a9c79f93a3d7298993ce99e357..43b972db591cd5ea431f7a2fdd5e7129461e56b7 100644 (file)
@@ -18,7 +18,6 @@
 // wizard.cc author Russ Combs <rucombs@cisco.com>
 
 #include <vector>
-using namespace std;
 
 #include "flow/flow.h"
 #include "framework/inspector.h"
@@ -33,6 +32,8 @@ using namespace std;
 #include "magic.h"
 #include "wiz_module.h"
 
+using namespace std;
+
 THREAD_LOCAL ProfileStats wizPerfStats;
 
 struct WizStats
index 7a3e694d0f041a1538c7332d23f4de5c130e3e98..cd56fcba4442b3557e9d39e4eaa8558c4efee1a9 100644 (file)
@@ -102,7 +102,7 @@ inline unsigned int sfip_size(const sfip_t* ipt)
 {
     if ( ipt->family == AF_INET6 )
         return sizeof(*ipt);
-    return (unsigned int)((ipt->ip8+4) - (u_int8_t*)ipt);
+    return (unsigned int)((ipt->ip8+4) - (uint8_t*)ipt);
 }
 
 /* Member-access *******************************************************/
@@ -209,10 +209,10 @@ inline int sfip_is_loopback(const sfip_t* ip)
 int sfip_ismapped(const sfip_t* ip);
 
 /* Support function for sfip_compare */
-inline SFIP_RET _ip4_cmp(u_int32_t ip1, u_int32_t ip2)
+inline SFIP_RET _ip4_cmp(uint32_t ip1, uint32_t ip2)
 {
-    u_int32_t hip1 = htonl(ip1);
-    u_int32_t hip2 = htonl(ip2);
+    uint32_t hip1 = htonl(ip1);
+    uint32_t hip2 = htonl(ip2);
     if (hip1 < hip2)
         return SFIP_LESSER;
     if (hip1 > hip2)
@@ -224,7 +224,7 @@ inline SFIP_RET _ip4_cmp(u_int32_t ip1, u_int32_t ip2)
 inline SFIP_RET _ip6_cmp(const sfip_t* ip1, const sfip_t* ip2)
 {
     SFIP_RET ret;
-    const u_int32_t* p1, * p2;
+    const uint32_t* p1, * p2;
 
     /* XXX
      * Argument are assumed trusted!
@@ -363,7 +363,7 @@ inline int sfip_fast_eq4(const sfip_t* const ip1, const sfip_t* const ip2)
 
 inline int sfip_fast_lt6(const sfip_t* const ip1, const sfip_t* const ip2)
 {
-    const u_int32_t* p1, * p2;
+    const uint32_t* p1, * p2;
 
     p1 = ip1->ip32;
     p2 = ip2->ip32;
@@ -393,7 +393,7 @@ inline int sfip_fast_lt6(const sfip_t* const ip1, const sfip_t* const ip2)
 
 inline int sfip_fast_gt6(const sfip_t* const ip1, const sfip_t* const ip2)
 {
-    const u_int32_t* p1, * p2;
+    const uint32_t* p1, * p2;
 
     p1 = ip1->ip32;
     p2 = ip2->ip32;
@@ -423,7 +423,7 @@ inline int sfip_fast_gt6(const sfip_t* const ip1, const sfip_t* const ip2)
 
 inline int sfip_fast_eq6(const sfip_t* ip1, const sfip_t* ip2)
 {
-    const u_int32_t* p1, * p2;
+    const uint32_t* p1, * p2;
 
     p1 = ip1->ip32;
     p2 = ip2->ip32;
@@ -443,8 +443,8 @@ inline int sfip_fast_eq6(const sfip_t* ip1, const sfip_t* ip2)
 /* Checks if ip2 is equal to ip1 or contained within the CIDR ip1 */
 inline bool sfip_fast_cont4(const sfip_t* ip1, const sfip_t* ip2)
 {
-    u_int32_t shift = 32 - sfip_bits(ip1);
-    u_int32_t ip = ntohl(*ip2->ip32);
+    uint32_t shift = 32 - sfip_bits(ip1);
+    uint32_t ip = ntohl(*ip2->ip32);
 
     ip >>= shift;
     ip <<= shift;
@@ -455,7 +455,7 @@ inline bool sfip_fast_cont4(const sfip_t* ip1, const sfip_t* ip2)
 /* Checks if ip2 is equal to ip1 or contained within the CIDR ip1 */
 inline int sfip_fast_cont6(const sfip_t* ip1, const sfip_t* ip2)
 {
-    u_int32_t ip;
+    uint32_t ip;
     int i, bits = sfip_bits(ip1);
     int words = bits / 32;
     bits = 32 - (bits % 32);
index f55b240614559ce95762f6bd35415b5859c164a4..9de2ba204d3b50170ae2497557b005134d8b8775 100644 (file)
 #include "file_module.h"
 
 #include <string>
-using namespace std;
 
 #include "stream_file.h"
 #include "main/snort_config.h"
 
+using namespace std;
+
 //-------------------------------------------------------------------------
 // stream_file module
 //-------------------------------------------------------------------------
index 9d9205e0b5df8479f2bdb4639455606c30d3f045..a470b23aab6177622a1b942d60fa00af9b78be5b 100644 (file)
 #include "icmp_module.h"
 
 #include <string>
-using namespace std;
 
 #include "stream_icmp.h"
 
+using namespace std;
+
 //-------------------------------------------------------------------------
 // stream_icmp module
 //-------------------------------------------------------------------------
index 01a04b493079b782c9e83b6ea0e5adc22344e54c..f115786a108cfa489a2e0398fcbb683ae0af313b 100644 (file)
@@ -209,7 +209,7 @@ static void FragPrintEngineConfig(FragEngine* engine)
     LogMessage("    Min fragment Length:     %d\n",
         engine->min_fragment_length);
 #ifdef REG_TEST
-    LogMessage("    FragTracker Size: %lu\n",sizeof(FragTracker));
+    LogMessage("    FragTracker Size: %zu\n", sizeof(FragTracker));
 #endif
 }
 
index 352d63abd5b86af77796b3d98a68fc9ffede0a1e..fc1096c2925101485d6c2742d7f1f618789aaebc 100644 (file)
 #include "ip_module.h"
 
 #include <string>
-using namespace std;
 
 #include "stream_ip.h"
 #include "ip_defrag.h"
 #include "stream/stream.h"
 
+using namespace std;
+
 #define DEFRAG_IPOPTIONS_STR \
     "inconsistent IP options on fragmented packets"
 
index 64ef7b2e43fbb25d7e8152a1913f6980e894a3d4..63be0961aed07be384ff27091f93f93233116c62 100644 (file)
@@ -20,7 +20,6 @@
 // Created on: Jun 24, 2015
 
 #include <iostream>
-using namespace std;
 
 #include "main/snort_debug.h"
 
@@ -32,6 +31,8 @@ using namespace std;
 #include "stream_tcp_unit_test.h"
 #endif
 
+using namespace std;
+
 TcpStateHandler::TcpStateHandler(TcpStreamTracker::TcpState state, TcpStateMachine& tsm)
     : tsm(&tsm), tcp_state(state)
 {
index 96eb85f0f813056e4244d03751de27618cf98b12..15d17df5d1e2c93f92263cc4c890350e80ca92b7 100644 (file)
@@ -20,7 +20,6 @@
 // Created on: Aug 5, 2015
 
 #include <iostream>
-using namespace std;
 
 #include "tcp_module.h"
 #include "tcp_tracker.h"
@@ -32,6 +31,8 @@ using namespace std;
 #include "catch/catch.hpp"
 #endif
 
+using namespace std;
+
 TcpStateCloseWait::TcpStateCloseWait(TcpStateMachine& tsm) :
     TcpStateHandler(TcpStreamTracker::TCP_CLOSE_WAIT, tsm)
 {
index ab8020a9416198951d1a280664fdb2737b7fb977..9a86024cc91e10105d430e42986d33168d096258 100644 (file)
@@ -20,7 +20,6 @@
 // Created on: Aug 5, 2015
 
 #include <iostream>
-using namespace std;
 
 #include "tcp_module.h"
 #include "tcp_tracker.h"
@@ -32,6 +31,8 @@ using namespace std;
 #include "catch/catch.hpp"
 #endif
 
+using namespace std;
+
 TcpStateClosing::TcpStateClosing(TcpStateMachine& tsm) :
     TcpStateHandler(TcpStreamTracker::TCP_CLOSING, tsm)
 {
index eb4d1f4e91480955119055beb0549719cc6101a6..e40665e8ce6a59974c988857a95f66ef287decc9 100644 (file)
@@ -20,7 +20,6 @@
 // Created on: Aug 5, 2015
 
 #include <iostream>
-using namespace std;
 
 #include "tcp_module.h"
 #include "tcp_tracker.h"
@@ -32,6 +31,8 @@ using namespace std;
 #include "catch/catch.hpp"
 #endif
 
+using namespace std;
+
 TcpStateFinWait1::TcpStateFinWait1(TcpStateMachine& tsm) :
     TcpStateHandler(TcpStreamTracker::TCP_FIN_WAIT1, tsm)
 {
index cb75a85c26d7ed9ddb4e16008dd454976ac4dd06..a9e4415a2723d3485d457c131eb784942af54e0a 100644 (file)
@@ -20,7 +20,6 @@
 // Created on: Aug 5, 2015
 
 #include <iostream>
-using namespace std;
 
 #include "tcp_module.h"
 #include "tcp_tracker.h"
@@ -32,6 +31,8 @@ using namespace std;
 #include "catch/catch.hpp"
 #endif
 
+using namespace std;
+
 TcpStateFinWait2::TcpStateFinWait2(TcpStateMachine& tsm) :
     TcpStateHandler(TcpStreamTracker::TCP_FIN_WAIT2, tsm)
 {
index e047ae168964c3bd44ae24ce1ed04d923ca716ea..59559ed20429e6b358c56f38b3cdbb814d22d003 100644 (file)
@@ -20,7 +20,6 @@
 // Created on: Aug 5, 2015
 
 #include <iostream>
-using namespace std;
 
 #include "tcp_module.h"
 #include "tcp_tracker.h"
@@ -32,6 +31,8 @@ using namespace std;
 #include "catch/catch.hpp"
 #endif
 
+using namespace std;
+
 TcpStateLastAck::TcpStateLastAck(TcpStateMachine& tsm) :
     TcpStateHandler(TcpStreamTracker::TCP_LAST_ACK, tsm)
 {
index badae22d15f4977bfd12738dcc743c1b4af91455..8480d7c713222d099297348115d9d2494db146c0 100644 (file)
@@ -20,7 +20,6 @@
 // Created on: Aug 5, 2015
 
 #include <iostream>
-using namespace std;
 
 #include "tcp_module.h"
 #include "tcp_tracker.h"
@@ -28,6 +27,8 @@ using namespace std;
 #include "tcp_normalizer.h"
 #include "tcp_state_syn_recv.h"
 
+using namespace std;
+
 TcpStateSynRecv::TcpStateSynRecv(TcpStateMachine& tsm) :
     TcpStateHandler(TcpStreamTracker::TCP_SYN_RECV, tsm)
 {
index 7e1c754123342a679cceb8c88681261320bec6b2..881e8b0e30b2214b50cb9af32799ebc8850aecbd 100644 (file)
@@ -20,7 +20,6 @@
 // Created on: Aug 5, 2015
 
 #include <iostream>
-using namespace std;
 
 #include "tcp_module.h"
 #include "tcp_tracker.h"
@@ -32,6 +31,8 @@ using namespace std;
 #include "catch/catch.hpp"
 #endif
 
+using namespace std;
+
 TcpStateSynSent::TcpStateSynSent(TcpStateMachine& tsm) :
     TcpStateHandler(TcpStreamTracker::TCP_SYN_SENT, tsm)
 {
index 02b10538df0a632cd6e551fab227c41c8518d150..0900b7fe07c6d45fdbecc6d4452f7920c40d7fd0 100644 (file)
@@ -20,7 +20,6 @@
 // Created on: Aug 5, 2015
 
 #include <iostream>
-using namespace std;
 
 #include "tcp_module.h"
 #include "tcp_tracker.h"
@@ -32,6 +31,8 @@ using namespace std;
 #include "catch/catch.hpp"
 #endif
 
+using namespace std;
+
 TcpStateTimeWait::TcpStateTimeWait(TcpStateMachine& tsm) :
     TcpStateHandler(TcpStreamTracker::TCP_TIME_WAIT, tsm)
 {
index e2757ff769d828e497c0a2c2fae23a92ef4aaeeb..0020bef19474d7a657a666d32406637399f4e765 100644 (file)
@@ -48,7 +48,7 @@ static void udp_show(StreamUdpConfig* pc)
     LogMessage("    Ignore Any -> Any Rules: %s\n", opt);
 
 #ifdef REG_TEST
-    LogMessage("    UDP Session Size: %lu\n",sizeof(UdpSession));
+    LogMessage("    UDP Session Size: %zu\n", sizeof(UdpSession));
 #endif
 }
 
index f8062ad71cc8f4df6dd397ad3f68fe9ab7ed30a6..939fb0281690ef5e57a17ba737e704e93805c370 100644 (file)
 #include "udp_module.h"
 
 #include <string>
-using namespace std;
 
 #include "stream_udp.h"
 
+using namespace std;
+
 //-------------------------------------------------------------------------
 // stream_udp module
 //-------------------------------------------------------------------------
index a2afce61d8b50d9213352cbdeb20ef75c20413ee..6726df9ea94f92e64e4b4969685869e77f3d1ee4 100644 (file)
 #include "user_module.h"
 
 #include <string>
-using namespace std;
 
 #include "stream_user.h"
 #include "main/snort_config.h"
 
+using namespace std;
+
 //-------------------------------------------------------------------------
 // stream_user module
 //-------------------------------------------------------------------------
index 9bdde5a6bc0650fc04dac2eddddd5891cad7693b..1a7b1cb04bfb9085e9c4546db982a4ee4d32bccb 100644 (file)
@@ -24,7 +24,6 @@
 #include <algorithm>
 #include <string>
 #include <vector>
-using namespace std;
 
 #include "hash/sfghash.h"
 #include "main/snort_debug.h"
@@ -35,6 +34,8 @@ using namespace std;
 #include "sftarget_hostentry.h"
 #include "sftarget_data.h"
 
+using namespace std;
+
 struct SFTargetProtocolReference
 {
     char name[SFAT_BUFSZ];
index c0c5d8bb9e40afd1100f4e483da9b92e6f20fad5..10265c471d489f6ad042911271632b9615e21e06 100644 (file)
@@ -40,7 +40,7 @@
 #include <fstream>
 #include <sstream>
 
-#ifdef LINUX
+#if defined(__linux__)
 #include <sys/syscall.h>
 #endif
 
@@ -211,7 +211,7 @@ inline int SnortStrToU32(const char* buffer, char** endptr,
 
 inline pid_t gettid()
 {
-#if defined(LINUX) && defined(SYS_gettid)
+#if defined(__linux__) && defined(SYS_gettid)
     return syscall(SYS_gettid);
 #else
     return getpid();