From: Josh Date: Mon, 18 Aug 2014 19:03:41 +0000 (-0400) Subject: updating CMake. Fixing plugins. X-Git-Tag: 3.0.0-233~1422^2^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=7d865aa308e7df0a348898e72c2ff89709633cf2;p=thirdparty%2Fsnort3.git updating CMake. Fixing plugins. --- diff --git a/cmake/macros.cmake b/cmake/macros.cmake index 7f158d99c..fde550982 100644 --- a/cmake/macros.cmake +++ b/cmake/macros.cmake @@ -55,8 +55,8 @@ macro (add_shared_library libname install_path) COMPILE_FLAGS "-DBUILDING_SO" LINK_FLAGS "-export-dynamic -shared" ) - #INSTALL INTO STATIC LIBRARY - + + #install into given library install (TARGETS ${libname} LIBRARY DESTINATION "lib/${CMAKE_PROJECT_NAME}/${install_path}" ) diff --git a/cmake/platforms.cmake b/cmake/platforms.cmake index aab68a314..a5fdf9d18 100644 --- a/cmake/platforms.cmake +++ b/cmake/platforms.cmake @@ -58,6 +58,7 @@ endif () # APPLE is defined by Cmake if (APPLE) set(MACOS 1) + set(CMAKE_MACOSX_RPATH OFF) endif() @@ -66,6 +67,7 @@ endif() if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++") + set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -undefined dynamic_lookup") find_library(CLANG_CXX_LIBRARY NAMES c++ diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 96f465d41..afbcaf254 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -60,6 +60,7 @@ endif() if (STATIC_CODECS) set (STATIC_CODEC_LIBRARIES link_codecs + root_codecs ) endif() @@ -115,7 +116,6 @@ target_link_libraries( snort ips_actions managers codecs - root_codecs ip_codecs misc_codecs ${STATIC_CODEC_LIBRARIES} diff --git a/src/Makefile.am b/src/Makefile.am index 3c06e181b..8bd6c0fe2 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -17,6 +17,12 @@ service_inspectors/rpc_decode/librpc_decode.a \ service_inspectors/wizard/libwizard.a endif +if STATIC_CODECS +codec_list = \ +codecs/root/libroot_codecs.a \ +codecs/link/liblink_codecs.a +endif + # order libs to avoid undefined symbols # from gnu linker snort_LDADD = \ @@ -26,9 +32,8 @@ main/libmain.a \ loggers/libloggers.a \ codecs/libcodecs.a \ codecs/ip/libip_codecs.a \ -codecs/link/liblink_codecs.a \ codecs/misc/libmisc_codecs.a \ -codecs/root/libroot_codecs.a \ +${codec_list} \ codecs/libcodec_utils.a \ network_inspectors/libnetwork_inspectors.a \ network_inspectors/binder/libbinder.a \ diff --git a/src/codecs/CMakeLists.txt b/src/codecs/CMakeLists.txt index c5690651a..4742a83d4 100644 --- a/src/codecs/CMakeLists.txt +++ b/src/codecs/CMakeLists.txt @@ -23,12 +23,12 @@ add_library( codecs STATIC if (STATIC_CODECS) set (CODEC_PLUGIN_LIBRARIES link_codecs + root_codecs ) endif(STATIC_CODECS) target_link_libraries( codecs ${CODEC_PLUGIN_LIBRARIES} - root_codecs ip_codecs misc_codecs protocols diff --git a/src/codecs/ip/cd_ipv4.cc b/src/codecs/ip/cd_ipv4.cc index a1f19b59d..4608764f2 100644 --- a/src/codecs/ip/cd_ipv4.cc +++ b/src/codecs/ip/cd_ipv4.cc @@ -17,6 +17,7 @@ ** along with this program; if not, write to the Free Software ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ +// cd_ipv4.cc author Josh Rosenbaum diff --git a/src/codecs/ip/cd_ipv6.cc b/src/codecs/ip/cd_ipv6.cc index cb41c6718..d73d0c5ed 100644 --- a/src/codecs/ip/cd_ipv6.cc +++ b/src/codecs/ip/cd_ipv6.cc @@ -17,6 +17,7 @@ ** along with this program; if not, write to the Free Software ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ +// cd_ipv6.cc author Josh Rosenbaum diff --git a/src/codecs/link/CMakeLists.txt b/src/codecs/link/CMakeLists.txt index 38e44dcd7..56ce83e72 100644 --- a/src/codecs/link/CMakeLists.txt +++ b/src/codecs/link/CMakeLists.txt @@ -46,4 +46,3 @@ if(STATIC_CODECS) ) endif(STATIC_CODECS) - diff --git a/src/codecs/link/Makefile.am b/src/codecs/link/Makefile.am index f746cf83a..3025395c2 100644 --- a/src/codecs/link/Makefile.am +++ b/src/codecs/link/Makefile.am @@ -1,9 +1,10 @@ AUTOMAKE_OPTIONS=foreign no-dependencies -noinst_LIBRARIES = liblink_codecs.a +if STATIC_CODECS +noinst_LIBRARIES = liblink_codecs.a -plugin_list = \ +liblink_codecs_a_SOURCES = \ cd_arp.cc \ cd_eapol.cc \ cd_erspan2.cc \ @@ -14,10 +15,6 @@ cd_pppoe.cc \ cd_trans_bridge.cc \ cd_vlan.cc - -if STATIC_CODECS -liblink_codecs_a_SOURCES = $(plugin_list) - else ehlibdir = $(pkglibdir)/codecs diff --git a/src/codecs/root/CMakeLists.txt b/src/codecs/root/CMakeLists.txt index 546763500..104ab8b45 100644 --- a/src/codecs/root/CMakeLists.txt +++ b/src/codecs/root/CMakeLists.txt @@ -1,10 +1,10 @@ -include_directories(${PCAP_INCLUDE_DIR}) +include_directories (${PCAP_INCLUDE_DIR}) if (STATIC_CODECS) - set( PLUGIN_LIST + set (PLUGIN_LIST cd_eth.cc cd_raw4.cc cd_raw6.cc @@ -26,25 +26,22 @@ if (STATIC_CODECS) ) -else(STATIC_CODECS) - add_shared_library(cd_eth codecs cd_eth.cc) - add_shared_library(cd_linux_sll codecs cd_linux_sll.cc) - add_shared_library(cd_ppp codecs cd_ppp.cc) - add_shared_library(cd_raw4 codecs cd_raw4.cc) - add_shared_library(cd_raw6 codecs cd_raw6.cc) - add_shared_library(cd_null codecs cd_null.cc) - add_shared_library(cd_wlan codecs cd_wlan.cc) +else (STATIC_CODECS) + add_shared_library (cd_eth codecs cd_eth.cc) + add_shared_library (cd_linux_sll codecs cd_linux_sll.cc) + add_shared_library (cd_ppp codecs cd_ppp.cc) + add_shared_library (cd_raw4 codecs cd_raw4.cc) + add_shared_library (cd_raw6 codecs cd_raw6.cc) + add_shared_library (cd_null codecs cd_null.cc) + add_shared_library (cd_wlan codecs cd_wlan.cc) -endif(STATIC_CODECS) +endif (STATIC_CODECS) -add_library(root_codecs STATIC - ${PLUGIN_LIST} - ${PCAP_INCLUDE_DIR}/pcap.h # rebuild if a new libpcap is installed -) +if (STATIC_CODECS) + add_library(root_codecs STATIC + ${PLUGIN_LIST} + ${PCAP_INCLUDE_DIR}/pcap.h # rebuild if a new libpcap is installed + ) -target_link_libraries(root_codecs - protocols - managers - ${PCAP_LIBRARIES} -) +endif (STATIC_CODECS) diff --git a/src/codecs/root/Makefile.am b/src/codecs/root/Makefile.am index 04477adfb..5ffcf14ba 100644 --- a/src/codecs/root/Makefile.am +++ b/src/codecs/root/Makefile.am @@ -1,10 +1,7 @@ AUTOMAKE_OPTIONS=foreign no-dependencies -noinst_LIBRARIES = libroot_codecs.a - - - if STATIC_CODECS +noinst_LIBRARIES = libroot_codecs.a libroot_codecs_a_SOURCES = \ cd_eth.cc \ @@ -26,7 +23,6 @@ cd_wlan.cc #root_i4lciscoip.cc - else ehlibdir = $(pkglibdir)/codecs diff --git a/src/codecs/root/cd_linux_sll.cc b/src/codecs/root/cd_linux_sll.cc index 45af0b755..3f670123e 100644 --- a/src/codecs/root/cd_linux_sll.cc +++ b/src/codecs/root/cd_linux_sll.cc @@ -17,6 +17,7 @@ ** along with this program; if not, write to the Free Software ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ +// cd_linux_sll.cc author Josh Rosenbaum @@ -47,15 +48,6 @@ public: Packet *, uint16_t &lyr_len, uint16_t &next_prot_id); }; -// Create your own Hdr Struct for this layer! -struct NameHdr -{ - uint8_t ver; - uint8_t next_protocol; - uint16_t len; - // additional or different data -}; - } // namespace @@ -72,11 +64,14 @@ bool LinuxSllCodec::decode(const uint8_t *raw_pkt, const uint32_t &raw_len, /* do a little validation */ if(raw_len < linux_sll::SLL_HDR_LEN) { + #if 0 + // How do we log from a plugin?? if (ScLogVerbose()) { ErrorMessage("Captured data length < SLL header length (your " "libpcap is broken?)! (%d bytes)\n", raw_len); } + #endif return false; } /* lay the ethernet structure over the packet data */ @@ -95,14 +90,10 @@ bool LinuxSllCodec::decode(const uint8_t *raw_pkt, const uint32_t &raw_len, //------------------------------------------------------------------------- static Codec* ctor(Module*) -{ - return new LinuxSllCodec(); -} +{ return new LinuxSllCodec(); } static void dtor(Codec *cd) -{ - delete cd; -} +{ delete cd; } static const CodecApi linux_ssl_api = diff --git a/src/protocols/arp.h b/src/protocols/arp.h index fb4615b79..6775ee410 100644 --- a/src/protocols/arp.h +++ b/src/protocols/arp.h @@ -17,6 +17,7 @@ ** along with this program; if not, write to the Free Software ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ +// arp.h author Josh Rosenbaum #ifndef PROTOCOLS_ARP_H diff --git a/src/protocols/eapol.h b/src/protocols/eapol.h index 2bccde0b0..b47e62db0 100644 --- a/src/protocols/eapol.h +++ b/src/protocols/eapol.h @@ -17,6 +17,7 @@ ** along with this program; if not, write to the Free Software ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ +// eapol.h author Josh Rosenbaum #ifndef PROTOCOLS_EAPOL_H diff --git a/src/protocols/eth.h b/src/protocols/eth.h index 6e051f90a..3ad53c183 100644 --- a/src/protocols/eth.h +++ b/src/protocols/eth.h @@ -17,6 +17,7 @@ ** along with this program; if not, write to the Free Software ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ +// eth.h author Josh Rosenbaum #ifndef PROTOCOLS_ETH_H diff --git a/src/protocols/gre.h b/src/protocols/gre.h index 6911482ee..ed7e201a2 100644 --- a/src/protocols/gre.h +++ b/src/protocols/gre.h @@ -17,6 +17,7 @@ ** along with this program; if not, write to the Free Software ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ +// gre.h author Josh Rosenbaum #ifndef PROTOCOLS_GRE_H diff --git a/src/protocols/icmp4.h b/src/protocols/icmp4.h index 71216889c..5d4148267 100644 --- a/src/protocols/icmp4.h +++ b/src/protocols/icmp4.h @@ -17,6 +17,7 @@ ** along with this program; if not, write to the Free Software ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ +// icmp4.h author Josh Rosenbaum #ifndef PROTOCOLS_ICMP4_H diff --git a/src/protocols/icmp6.h b/src/protocols/icmp6.h index c2428f473..96c2f6e0f 100644 --- a/src/protocols/icmp6.h +++ b/src/protocols/icmp6.h @@ -17,6 +17,7 @@ ** along with this program; if not, write to the Free Software ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ +// icmp6.h author Josh Rosenbaum #ifndef PROTOCOLS_ICMP6_H diff --git a/src/protocols/ipv4.h b/src/protocols/ipv4.h index f58bc1e33..3fa7a08f7 100644 --- a/src/protocols/ipv4.h +++ b/src/protocols/ipv4.h @@ -17,6 +17,7 @@ ** along with this program; if not, write to the Free Software ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ +// ipv4.h author Josh Rosenbaum #ifndef PROTOCOLS_IPV4_H #define PROTOCOLS_IPV4_H diff --git a/src/protocols/ipv6.h b/src/protocols/ipv6.h index 97d30d78d..091a6d163 100644 --- a/src/protocols/ipv6.h +++ b/src/protocols/ipv6.h @@ -17,6 +17,7 @@ ** along with this program; if not, write to the Free Software ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ +// ipv6.h author Josh Rosenbaum #ifndef PROTOCOLS_IPV6_H diff --git a/src/protocols/layer.h b/src/protocols/layer.h index 8c0c854e1..b917ee25b 100644 --- a/src/protocols/layer.h +++ b/src/protocols/layer.h @@ -17,6 +17,7 @@ ** along with this program; if not, write to the Free Software ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ +// layer.h author Josh Rosenbaum #ifndef PROTOCOLS_LAYER_H #define PROTOCOLS_LAYER_H diff --git a/src/protocols/linux_sll.h b/src/protocols/linux_sll.h index b1692bce0..42732a230 100644 --- a/src/protocols/linux_sll.h +++ b/src/protocols/linux_sll.h @@ -17,6 +17,7 @@ ** along with this program; if not, write to the Free Software ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ +// linux_sll.h author Josh Rosenbaum #ifndef PROTOCOLS_LINUX_SLL_H diff --git a/src/protocols/mpls.h b/src/protocols/mpls.h index 110ddc739..a1394cadf 100644 --- a/src/protocols/mpls.h +++ b/src/protocols/mpls.h @@ -17,6 +17,7 @@ ** along with this program; if not, write to the Free Software ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ +// mpls.h author Josh Rosenbaum #ifndef PROTOCOLS_MPLS_H diff --git a/src/protocols/protocol_ids.h b/src/protocols/protocol_ids.h index 482f02815..5ffa025b9 100644 --- a/src/protocols/protocol_ids.h +++ b/src/protocols/protocol_ids.h @@ -17,6 +17,7 @@ ** along with this program; if not, write to the Free Software ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ +// protocol_ids.h author Josh Rosenbaum #ifndef PROTOCOLS_PROTOCOL_IDS_H diff --git a/src/protocols/tcp.h b/src/protocols/tcp.h index dd20580f7..c8d314d6f 100644 --- a/src/protocols/tcp.h +++ b/src/protocols/tcp.h @@ -16,6 +16,7 @@ ** along with this program; if not, write to the Free Software ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ +// tcp.h author Josh Rosenbaum #ifndef PROTOCOLS_TCP_H diff --git a/src/protocols/teredo.h b/src/protocols/teredo.h index 106bd79e6..9a33a80dc 100644 --- a/src/protocols/teredo.h +++ b/src/protocols/teredo.h @@ -17,6 +17,7 @@ ** along with this program; if not, write to the Free Software ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ +// teredo.h author Josh Rosenbaum #ifndef PROTOCOLS_TEREDO_H diff --git a/src/protocols/token_ring.h b/src/protocols/token_ring.h index 59779b55e..e94161823 100644 --- a/src/protocols/token_ring.h +++ b/src/protocols/token_ring.h @@ -17,6 +17,7 @@ ** along with this program; if not, write to the Free Software ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ +// token_ring.h author Josh Rosenbaum #ifndef PROTOCOLS_TOKEN_RING_H diff --git a/src/protocols/udp.h b/src/protocols/udp.h index e991536a5..c6e45b57b 100644 --- a/src/protocols/udp.h +++ b/src/protocols/udp.h @@ -17,6 +17,7 @@ ** along with this program; if not, write to the Free Software ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ +// udp.h author Josh Rosenbaum #ifndef PROTOCOLS_UDP_H diff --git a/src/protocols/vlan.h b/src/protocols/vlan.h index b2c371a0c..7cfb9ff4a 100644 --- a/src/protocols/vlan.h +++ b/src/protocols/vlan.h @@ -17,6 +17,7 @@ ** along with this program; if not, write to the Free Software ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ +// vlan.h author Josh Rosenbaum #ifndef PROTOCOLS_VLAN_H diff --git a/src/protocols/wlan.h b/src/protocols/wlan.h index d22795172..afe50c34b 100644 --- a/src/protocols/wlan.h +++ b/src/protocols/wlan.h @@ -17,6 +17,7 @@ ** along with this program; if not, write to the Free Software ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ +// wlan.h author Josh Rosenbaum #ifndef PROTOCOLS_WLAN_H