]> git.ipfire.org Git - thirdparty/snort3.git/commitdiff
Merge pull request #667 in SNORT/snort3 from os-fixups to master
authorRuss Combs (rucombs) <rucombs@cisco.com>
Fri, 7 Oct 2016 21:54:35 +0000 (17:54 -0400)
committerRuss Combs (rucombs) <rucombs@cisco.com>
Fri, 7 Oct 2016 21:54:35 +0000 (17:54 -0400)
Squashed commit of the following:

commit d7283265f940cf51d95d472fc674fbd8753027aa
Author: Michael Altizer <mialtize@cisco.com>
Date:   Fri Oct 7 16:43:14 2016 -0400

    cd_eth: Depend on LibSFBPF's DLT definitions

commit 4302574a641bd85ebbd96d70e3881ed94b566a34
Author: Michael Altizer <mialtize@cisco.com>
Date:   Fri Oct 7 16:38:13 2016 -0400

    extra: Make all codecs depend on LibSFBPF's DLT definitions

commit f1b9c436deb19d441262c6f6cf25b02ab7d8df3f
Author: Michael Altizer <mialtize@cisco.com>
Date:   Fri Oct 7 16:37:44 2016 -0400

    extra: Kill off i4l_rawip decoder

    This DLT doesn't actually exist anywhere and the decoder was a NOP.

commit ec9dd64ebe5d69fd0f39fe3dbae27851610be372
Author: Michael Altizer <mialtize@cisco.com>
Date:   Fri Oct 7 15:23:13 2016 -0400

    build: OpenSolaris build fixes

18 files changed:
extra/configure.ac
extra/src/codecs/CMakeLists.txt
extra/src/codecs/Makefile.am
extra/src/codecs/cd_i4l_rawip/CMakeLists.txt [deleted file]
extra/src/codecs/cd_i4l_rawip/Makefile.am [deleted file]
extra/src/codecs/cd_i4l_rawip/cd_i4l_rawip.cc [deleted file]
extra/src/codecs/cd_linux_sll/cd_linux_sll.cc
extra/src/codecs/cd_null/cd_null.cc
extra/src/codecs/cd_pflog/cd_pflog.cc
extra/src/codecs/cd_ppp/cd_ppp.cc
extra/src/codecs/cd_raw4/cd_raw4.cc
extra/src/codecs/cd_raw6/cd_raw6.cc
extra/src/codecs/cd_slip/cd_slip.cc
extra/src/codecs/cd_token_ring/cd_token_ring.cc
extra/src/codecs/cd_wlan/cd_wlan.cc
src/codecs/root/cd_eth.cc
src/network_inspectors/appid/lua_detector_api.cc
src/utils/util.cc

index 021b8e5a989c5d04baaeafebe76f4f582d8cb41c..614ad5ee9c704c7a24aa9d60aa97febb5e86019d 100644 (file)
@@ -26,7 +26,6 @@ Makefile \
 src/Makefile \
 src/codecs/Makefile \
 src/codecs/cd_eapol/Makefile \
-src/codecs/cd_i4l_rawip/Makefile \
 src/codecs/cd_linux_sll/Makefile \
 src/codecs/cd_null/Makefile \
 src/codecs/cd_pflog/Makefile \
index 4f6ad10978a1e34054f60f601eb65f0e4f5a6e83..ff68c12d5735ce419c7f4d494b6db1a98a418895 100644 (file)
@@ -1,5 +1,4 @@
 add_subdirectory ( cd_eapol )
-add_subdirectory ( cd_i4l_rawip )
 add_subdirectory ( cd_linux_sll )
 add_subdirectory ( cd_null )
 add_subdirectory ( cd_pflog )
index dfcc7d5d9939a7884e89229daf94ee4292367dcf..f29c095f56bc2a35db40df16010f3f15281d5fb1 100644 (file)
@@ -1,6 +1,5 @@
 SUBDIRS = \
 cd_eapol \
-cd_i4l_rawip \
 cd_linux_sll \
 cd_null \
 cd_pflog \
diff --git a/extra/src/codecs/cd_i4l_rawip/CMakeLists.txt b/extra/src/codecs/cd_i4l_rawip/CMakeLists.txt
deleted file mode 100644 (file)
index 1a6c599..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-cmake_minimum_required ( VERSION 2.8.11 )
-project ( cd_i4l_rawip CXX )
-
-if ( APPLE )
-    set ( CMAKE_MACOSX_RPATH OFF )
-    set (
-        CMAKE_SHARED_LINKER_FLAGS
-        "${CMAKE_SHARED_LINKER_FLAGS} -undefined dynamic_lookup"
-    )
-endif ( APPLE )
-
-include ( FindPkgConfig )
-pkg_search_module ( SNORT3 REQUIRED snort>=3 )
-
-add_library (
-    cd_i4l_rawip SHARED
-    cd_i4l_rawip.cc
-)
-
-set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11" )
-
-target_include_directories (
-    cd_i4l_rawip PUBLIC
-    ${SNORT3_INCLUDE_DIRS}
-)
-
-install (
-    TARGETS cd_i4l_rawip
-    LIBRARY DESTINATION "lib/${CMAKE_PROJECT_NAME}/codecs"
-)
diff --git a/extra/src/codecs/cd_i4l_rawip/Makefile.am b/extra/src/codecs/cd_i4l_rawip/Makefile.am
deleted file mode 100644 (file)
index 85b68ca..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-cd_i4l_rawiplibdir = $(pkglibdir)/codecs
-
-AM_CXXFLAGS = @SNORT3_CFLAGS@ -std=c++11
-
-cd_i4l_rawiplib_LTLIBRARIES = libcd_i4l_rawip.la
-libcd_i4l_rawip_la_CXXFLAGS = $(AM_CXXFLAGS)
-libcd_i4l_rawip_la_LDFLAGS  = -export-dynamic -shared -avoid-version
-libcd_i4l_rawip_la_SOURCES  = cd_i4l_rawip.cc
diff --git a/extra/src/codecs/cd_i4l_rawip/cd_i4l_rawip.cc b/extra/src/codecs/cd_i4l_rawip/cd_i4l_rawip.cc
deleted file mode 100644 (file)
index 903ca31..0000000
+++ /dev/null
@@ -1,104 +0,0 @@
-//--------------------------------------------------------------------------
-// Copyright (C) 2014-2016 Cisco and/or its affiliates. All rights reserved.
-//
-// This program is free software; you can redistribute it and/or modify it
-// under the terms of the GNU General Public License Version 2 as published
-// by the Free Software Foundation.  You may not use, modify or distribute
-// this program under any other version of the GNU General Public License.
-//
-// This program is distributed in the hope that it will be useful, but
-// WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-// General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License along
-// with this program; if not, write to the Free Software Foundation, Inc.,
-// 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
-//--------------------------------------------------------------------------
-// cd_i4l_rawip.cc author Josh Rosenbaum <jrosenba@cisco.com>
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <pcap.h>
-#include "framework/codec.h"
-
-#define I4L_RAWIP_NAME "i4l_rawip"
-#define I4L_RAWIP_HELP_STR "support for I4L IP"
-
-#ifdef DLT_I4L_RAWIP
-#define I4L_RAWIP_HELP ADD_DLT(I4L_RAWIP_HELP_STR, DLT_I4L_RAWIP)
-#else
-#define I4L_RAWIP_HELP I4L_RAWIP_HELP_STR
-#endif
-
-namespace
-{
-class I4LRawIpCodec : public Codec
-{
-public:
-    I4LRawIpCodec() : Codec(I4L_RAWIP_NAME) { }
-    ~I4LRawIpCodec() { }
-
-    void get_data_link_type(std::vector<int>&) override;
-    bool decode(const RawData&, CodecData&, DecodeData&) override;
-};
-} // namespace
-
-void I4LRawIpCodec::get_data_link_type(std::vector<int>& v)
-{
-#ifdef DLT_I4L_RAWIP
-    v.push_back(DLT_I4L_RAWIP);
-#else
-    UNUSED(v);
-#endif
-}
-
-bool I4LRawIpCodec::decode(const RawData& raw, CodecData& codec, DecodeData&)
-{
-    if (raw.len < 2)
-        return false;
-
-    codec.lyr_len = 2;
-    codec.next_prot_id = ProtocolId::ETHERTYPE_IPV4;
-    return true;
-}
-
-//-------------------------------------------------------------------------
-// api
-//-------------------------------------------------------------------------
-
-static Codec* ctor(Module*)
-{ return new I4LRawIpCodec(); }
-
-static void dtor(Codec* cd)
-{ delete cd; }
-
-static const CodecApi i4l_rawip_api =
-{
-    {
-        PT_CODEC,
-        sizeof(CodecApi),
-        CDAPI_VERSION,
-        0,
-        API_RESERVED,
-        API_OPTIONS,
-        I4L_RAWIP_NAME,
-        I4L_RAWIP_HELP,
-        nullptr, // mod_ctor
-        nullptr  // mod_dtor
-    },
-    nullptr, // ginit
-    nullptr, // gterm
-    nullptr, // tinit
-    nullptr, // tterm
-    ctor,
-    dtor,
-};
-
-SO_PUBLIC const BaseApi* snort_plugins[] =
-{
-    &i4l_rawip_api.base,
-    nullptr
-};
index e1db8c24d82feb0e460c3a118a167669b5897003..5b823885d1388d673dc4e6eadf5873edf45ae5c4 100644 (file)
 #include "config.h"
 #endif
 
-#include <pcap.h>
+extern "C" {
+#include <sfbpf_dlt.h>
+}
+
 #include "framework/codec.h"
 #include "protocols/linux_sll.h"
 
@@ -44,9 +47,7 @@ public:
 
 void LinuxSllCodec::get_data_link_type(std::vector<int>& v)
 {
-#ifdef DLT_LINUX_SLL
     v.push_back(DLT_LINUX_SLL);
-#endif
 }
 
 bool LinuxSllCodec::decode(const RawData& raw, CodecData& data, DecodeData&)
index c9d2bd77e0766e3a7da843117da3e92bc2c41351..71d65a0f9afdcaed27f55a4a4efd5db5052dd26a 100644 (file)
@@ -21,7 +21,9 @@
 #include "config.h"
 #endif
 
-#include <pcap.h>
+extern "C" {
+#include <sfbpf_dlt.h>
+}
 
 #include "framework/codec.h"
 #include "protocols/protocol_ids.h"
index db7760ddd7723c7846dc12c4eec6ed5c9dc4cd13..f2b9ae8324f7cd270de43595cc12f4feefd30fd8 100644 (file)
 #include "config.h"
 #endif
 
-#include <pcap.h>
-#include "framework/codec.h"
+extern "C" {
+#include <sfbpf_dlt.h>
+}
 
-#ifndef DLT_PFLOG
-#define DLT_PFLOG 117
-#endif
+#include "framework/codec.h"
 
 #define PFLOG_NAME "pflog"
 #define PFLOG_HELP_STR "support for OpenBSD PF log"
index 6fc6f35399a23d3442044d3583e90b0dccb155d3..2812a0bb2867faa876bc61b9b888e1e285ab251d 100644 (file)
 #include "config.h"
 #endif
 
-#include <cstdint>
+#include <stdint.h>
+
+extern "C" {
+#include <sfbpf_dlt.h>
+}
+
 #include "framework/codec.h"
 
 #define PPP_NAME "ppp"
@@ -41,10 +46,6 @@ public:
 };
 } // namespace
 
-#ifndef DLT_PPP
-static constexpr int DLT_PPP = 9;
-#endif
-
 static constexpr uint8_t CHDLC_ADDR_BROADCAST = 0xff;
 static constexpr uint8_t CHDLC_CTRL_UNNUMBERED = 0x03;
 
index 795cd8c4747e6630211e669f6a769df0cf7d861a..b906fc551905684d277929215935af86b96ac311 100644 (file)
@@ -21,7 +21,9 @@
 #include "config.h"
 #endif
 
-#include <pcap.h>
+extern "C" {
+#include <sfbpf_dlt.h>
+}
 
 #include "framework/codec.h"
 #include "protocols/protocol_ids.h"
index 2175bc645d1737b5db0058ce0afe2adc45151864..9cbc5fe0e6e8dc3d8f773b5f9175b24889537863 100644 (file)
@@ -21,7 +21,9 @@
 #include "config.h"
 #endif
 
-#include <pcap.h>
+extern "C" {
+#include <sfbpf_dlt.h>
+}
 
 #include "framework/codec.h"
 #include "protocols/protocol_ids.h"
index 16e28c2b615ceaabde6e8461805877101f3c58f6..4701f4ec40b479eb0cd88e9ac4becf9edb6e71db 100644 (file)
 //--------------------------------------------------------------------------
 // cd_sip.cc author Josh Rosenbaum <jrosenba@cisco.com>
 
-#include <pcap.h>
-#include <cstdint>
+#include <stdint.h>
+
+extern "C" {
+#include <sfbpf_dlt.h>
+}
+
 #include "framework/codec.h"
 #include "protocols/protocol_ids.h"
 
@@ -43,9 +47,7 @@ public:
 
 void SlipCodec::get_data_link_type(std::vector<int>& v)
 {
-#if DLT_SLIP
     v.push_back(DLT_SLIP);
-#endif
 }
 
 bool SlipCodec::decode(const RawData& raw, CodecData& codec, DecodeData&)
index f18cd02f99608ade6fe847184ccc3b9d13192a21..cfcdc6905106333922612ebff548f004ba93b92c 100644 (file)
 #include "config.h"
 #endif
 
-#include <pcap.h>
+extern "C" {
+#include <sfbpf_dlt.h>
+}
+
 #include "protocols/token_ring.h"
 #include "framework/codec.h"
 #include "codecs/codec_module.h"
 
-#ifdef DLT_IEEE802
-
 namespace
 {
 #define TR_NAME "token_ring"
@@ -226,5 +227,3 @@ SO_PUBLIC const BaseApi* snort_plugins[] =
     nullptr
 };
 
-#endif
-
index 2eb378d7004ebb111de7dc2b9b5329bb48441885..561778beeb9becf3135c1ae0e42e46e85288d6f5 100644 (file)
 #include "config.h"
 #endif
 
-#include <pcap.h>
+extern "C" {
+#include <sfbpf_dlt.h>
+}
+
 #include "protocols/wlan.h"
 #include "framework/codec.h"
 #include "codecs/codec_module.h"
 #include "protocols/protocol_ids.h"
 #include "log/text_log.h"
 
-#ifndef DLT_IEEE802_11
-#define DLT_IEEE802_11 105
-#endif
-
 #define CD_WLAN_NAME "wlan"
 #define CD_WLAN_HELP_STR "support for wireless local area network protocol"
 #define CD_WLAN_HELP ADD_DLT(CD_WLAN_HELP_STR, DLT_IEEE802_11)
index 76c47cd220a349293fdd45ec35a7806c844ae5e1..cdee74e2d7c1ef5772857a882118498359603842 100644 (file)
 #include "config.h"
 #endif
 
-#include <pcap.h>
+extern "C" {
+#include <sfbpf_dlt.h>
+}
+
 #include "codecs/codec_module.h"
 #include "framework/codec.h"
 #include "protocols/packet.h"
@@ -69,11 +72,6 @@ public:
 };
 } // namespace
 
-#ifndef DLT_PPP_ETHER
-// For PPP over Eth, the first layer is ethernet.
-constexpr int DLT_PPP_ETHER = 51;
-#endif
-
 void EthCodec::get_data_link_type(std::vector<int>& v)
 {
     v.push_back(DLT_PPP_ETHER);
index 1c4a14f23f91bfa8c9c8a1ba2f368dea2a02a304..9fbf4e237eae57d8141e5107943bb4ffa3a9e2cb 100644 (file)
@@ -2516,9 +2516,9 @@ static int openAddUrlPattern(lua_State* L)
         return 0;
     }
 
-    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)
     {
index a13361fb76f70f1c456b925580565c1af462199f..2e817ab4ba9d0bf02e162093d8b52218676b2988 100644 (file)
@@ -24,6 +24,7 @@
 #include "config.h"
 #endif
 
+#include <fcntl.h>
 #include <grp.h>
 #include <luajit.h>
 #include <netdb.h>