From: Russ Combs (rucombs) Date: Fri, 7 Oct 2016 21:54:35 +0000 (-0400) Subject: Merge pull request #667 in SNORT/snort3 from os-fixups to master X-Git-Tag: 3.0.0-233~230 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8b0bdd2f1513fdcfa5c595d32e12bf70f1f50768;p=thirdparty%2Fsnort3.git Merge pull request #667 in SNORT/snort3 from os-fixups to master Squashed commit of the following: commit d7283265f940cf51d95d472fc674fbd8753027aa Author: Michael Altizer Date: Fri Oct 7 16:43:14 2016 -0400 cd_eth: Depend on LibSFBPF's DLT definitions commit 4302574a641bd85ebbd96d70e3881ed94b566a34 Author: Michael Altizer Date: Fri Oct 7 16:38:13 2016 -0400 extra: Make all codecs depend on LibSFBPF's DLT definitions commit f1b9c436deb19d441262c6f6cf25b02ab7d8df3f Author: Michael Altizer 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 Date: Fri Oct 7 15:23:13 2016 -0400 build: OpenSolaris build fixes --- diff --git a/extra/configure.ac b/extra/configure.ac index 021b8e5a9..614ad5ee9 100644 --- a/extra/configure.ac +++ b/extra/configure.ac @@ -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 \ diff --git a/extra/src/codecs/CMakeLists.txt b/extra/src/codecs/CMakeLists.txt index 4f6ad1097..ff68c12d5 100644 --- a/extra/src/codecs/CMakeLists.txt +++ b/extra/src/codecs/CMakeLists.txt @@ -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 ) diff --git a/extra/src/codecs/Makefile.am b/extra/src/codecs/Makefile.am index dfcc7d5d9..f29c095f5 100644 --- a/extra/src/codecs/Makefile.am +++ b/extra/src/codecs/Makefile.am @@ -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 index 1a6c5994d..000000000 --- a/extra/src/codecs/cd_i4l_rawip/CMakeLists.txt +++ /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 index 85b68cad5..000000000 --- a/extra/src/codecs/cd_i4l_rawip/Makefile.am +++ /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 index 903ca310b..000000000 --- a/extra/src/codecs/cd_i4l_rawip/cd_i4l_rawip.cc +++ /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 - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include -#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&) override; - bool decode(const RawData&, CodecData&, DecodeData&) override; -}; -} // namespace - -void I4LRawIpCodec::get_data_link_type(std::vector& 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 -}; diff --git a/extra/src/codecs/cd_linux_sll/cd_linux_sll.cc b/extra/src/codecs/cd_linux_sll/cd_linux_sll.cc index e1db8c24d..5b823885d 100644 --- a/extra/src/codecs/cd_linux_sll/cd_linux_sll.cc +++ b/extra/src/codecs/cd_linux_sll/cd_linux_sll.cc @@ -21,7 +21,10 @@ #include "config.h" #endif -#include +extern "C" { +#include +} + #include "framework/codec.h" #include "protocols/linux_sll.h" @@ -44,9 +47,7 @@ public: void LinuxSllCodec::get_data_link_type(std::vector& v) { -#ifdef DLT_LINUX_SLL v.push_back(DLT_LINUX_SLL); -#endif } bool LinuxSllCodec::decode(const RawData& raw, CodecData& data, DecodeData&) diff --git a/extra/src/codecs/cd_null/cd_null.cc b/extra/src/codecs/cd_null/cd_null.cc index c9d2bd77e..71d65a0f9 100644 --- a/extra/src/codecs/cd_null/cd_null.cc +++ b/extra/src/codecs/cd_null/cd_null.cc @@ -21,7 +21,9 @@ #include "config.h" #endif -#include +extern "C" { +#include +} #include "framework/codec.h" #include "protocols/protocol_ids.h" diff --git a/extra/src/codecs/cd_pflog/cd_pflog.cc b/extra/src/codecs/cd_pflog/cd_pflog.cc index db7760ddd..f2b9ae832 100644 --- a/extra/src/codecs/cd_pflog/cd_pflog.cc +++ b/extra/src/codecs/cd_pflog/cd_pflog.cc @@ -21,12 +21,11 @@ #include "config.h" #endif -#include -#include "framework/codec.h" +extern "C" { +#include +} -#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" diff --git a/extra/src/codecs/cd_ppp/cd_ppp.cc b/extra/src/codecs/cd_ppp/cd_ppp.cc index 6fc6f3539..2812a0bb2 100644 --- a/extra/src/codecs/cd_ppp/cd_ppp.cc +++ b/extra/src/codecs/cd_ppp/cd_ppp.cc @@ -21,7 +21,12 @@ #include "config.h" #endif -#include +#include + +extern "C" { +#include +} + #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; diff --git a/extra/src/codecs/cd_raw4/cd_raw4.cc b/extra/src/codecs/cd_raw4/cd_raw4.cc index 795cd8c47..b906fc551 100644 --- a/extra/src/codecs/cd_raw4/cd_raw4.cc +++ b/extra/src/codecs/cd_raw4/cd_raw4.cc @@ -21,7 +21,9 @@ #include "config.h" #endif -#include +extern "C" { +#include +} #include "framework/codec.h" #include "protocols/protocol_ids.h" diff --git a/extra/src/codecs/cd_raw6/cd_raw6.cc b/extra/src/codecs/cd_raw6/cd_raw6.cc index 2175bc645..9cbc5fe0e 100644 --- a/extra/src/codecs/cd_raw6/cd_raw6.cc +++ b/extra/src/codecs/cd_raw6/cd_raw6.cc @@ -21,7 +21,9 @@ #include "config.h" #endif -#include +extern "C" { +#include +} #include "framework/codec.h" #include "protocols/protocol_ids.h" diff --git a/extra/src/codecs/cd_slip/cd_slip.cc b/extra/src/codecs/cd_slip/cd_slip.cc index 16e28c2b6..4701f4ec4 100644 --- a/extra/src/codecs/cd_slip/cd_slip.cc +++ b/extra/src/codecs/cd_slip/cd_slip.cc @@ -17,8 +17,12 @@ //-------------------------------------------------------------------------- // cd_sip.cc author Josh Rosenbaum -#include -#include +#include + +extern "C" { +#include +} + #include "framework/codec.h" #include "protocols/protocol_ids.h" @@ -43,9 +47,7 @@ public: void SlipCodec::get_data_link_type(std::vector& v) { -#if DLT_SLIP v.push_back(DLT_SLIP); -#endif } bool SlipCodec::decode(const RawData& raw, CodecData& codec, DecodeData&) diff --git a/extra/src/codecs/cd_token_ring/cd_token_ring.cc b/extra/src/codecs/cd_token_ring/cd_token_ring.cc index f18cd02f9..cfcdc6905 100644 --- a/extra/src/codecs/cd_token_ring/cd_token_ring.cc +++ b/extra/src/codecs/cd_token_ring/cd_token_ring.cc @@ -23,13 +23,14 @@ #include "config.h" #endif -#include +extern "C" { +#include +} + #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 - diff --git a/extra/src/codecs/cd_wlan/cd_wlan.cc b/extra/src/codecs/cd_wlan/cd_wlan.cc index 2eb378d70..561778bee 100644 --- a/extra/src/codecs/cd_wlan/cd_wlan.cc +++ b/extra/src/codecs/cd_wlan/cd_wlan.cc @@ -22,17 +22,16 @@ #include "config.h" #endif -#include +extern "C" { +#include +} + #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) diff --git a/src/codecs/root/cd_eth.cc b/src/codecs/root/cd_eth.cc index 76c47cd22..cdee74e2d 100644 --- a/src/codecs/root/cd_eth.cc +++ b/src/codecs/root/cd_eth.cc @@ -22,7 +22,10 @@ #include "config.h" #endif -#include +extern "C" { +#include +} + #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& v) { v.push_back(DLT_PPP_ETHER); diff --git a/src/network_inspectors/appid/lua_detector_api.cc b/src/network_inspectors/appid/lua_detector_api.cc index 1c4a14f23..9fbf4e237 100644 --- a/src/network_inspectors/appid/lua_detector_api.cc +++ b/src/network_inspectors/appid/lua_detector_api.cc @@ -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) { diff --git a/src/utils/util.cc b/src/utils/util.cc index a13361fb7..2e817ab4b 100644 --- a/src/utils/util.cc +++ b/src/utils/util.cc @@ -24,6 +24,7 @@ #include "config.h" #endif +#include #include #include #include