add_subdirectory (tools)
add_subdirectory (lua)
add_subdirectory (doc)
+add_subdirectory (daqs)
# Miscelaneous stuff. Does NOT directly effect snort's building environment
include (cmake/packaging_data.cmake)
lua \
tools \
doc \
+daqs \
m4
AM_CXXFLAGS = @AM_CXXFLAGS@
# header, you must also add that symbol to CPPFLAGS. This ensures that
# external modules like those in examples can use pkg-config to get the
# same symbols Snort did. See PERF_PROFILING for an example.
-#
-# those should be going to AM_CPPFLAGS but adding the include paths breaks
-# with both += and x='$x ...' forms.
#--------------------------------------------------------------------------
# initialization
#--------------------------------------------------------------------------
AC_C_BIGENDIAN
AC_C_INLINE
-AM_CXXFLAGS="-std=c++11"
+CFLAGS="$CFLAGS -std=c99"
+CXXFLAGS="$CXXFLAGS -std=c++11"
+
AX_CXX_COMPILE_STDCXX_11
# g++ 4.7 passes the c++11 check but is not sufficient
[
AC_REQUIRE([AC_PROG_CC])
AC_MSG_CHECKING([for visibility support])
+ gl_save_CFLAGS="$CFLAGS"
+
AC_CACHE_VAL(gl_cv_cc_visibility, [
- gl_save_CFLAGS="$CFLAGS"
# Add -Werror flag since some compilers, e.g. icc 7.1, don't support it,
# but only warn about it instead of compilation failing
CFLAGS="$CFLAGS -Werror -fvisibility=hidden"
AC_MSG_RESULT([$gl_cv_cc_visibility])
CFLAGS="$gl_save_CFLAGS"
if test "x$gl_cv_cc_visibility" = "xyes"; then
- AM_CXXFLAGS="$AM_CXXFLAGS -fvisibility=hidden"
+ CFLAGS="$CFLAGS -fvisibility=hidden"
+ CXXFLAGS="$CXXFLAGS -fvisibility=hidden"
AC_DEFINE([HAVE_VISIBILITY],[1],
[Define if the compiler supports visibility declarations.])
fi
if test "x$enable_debug" = "xyes"; then
CFLAGS="$CFLAGS -g"
+ CXXFLAGS="$CXXFLAGS -g"
CPPFLAGS="$CPPFLAGS -DDEBUG"
AC_DEFINE(DEBUG, [1], [enable debug build])
else
if test "x$enable_gdb" = "xyes"; then
CFLAGS="$CFLAGS -g -ggdb"
+ CXXFLAGS="$CXXFLAGS -g -ggdb"
fi
AC_ARG_ENABLE(gprof-profile,
if test "x$enable_gprof_profile" = "xyes"; then
if test -n "$GCC"; then
CFLAGS="$CFLAGS -pg"
+ CXXFLAGS="$CXXFLAGS -pg"
fi
AC_DEFINE(PROFILE, [1], [enable gprof profiling])
fi
if test "x$with_libpcre_includes" != "xno"; then
CPPFLAGS="${CPPFLAGS} -I${with_libpcre_includes}"
- ICONFIGFLAGS="${ICONFIGFLAGS} -I${with_libpcre_includes}"
else
CPPFLAGS="${CPPFLAGS} `pcre-config --cflags`"
fi
if test "x$with_daq_includes" != "xno"; then
CPPFLAGS="${CPPFLAGS} -I${with_daq_includes}"
- ICONFIGFLAGS="${ICONFIGFLAGS} -I${with_daq_includes}"
fi
AC_ARG_WITH(daq_libraries,
AX_PTHREAD
LIBS="$PTHREAD_LIBS $LIBS"
-CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
+CXXFLAGS="$CXXFLAGS $PTHREAD_CFLAGS"
LDFLAGS="$LDFLAGS $PTHREAD_LDFLAGS"
#--------------------------------------------------------------------------
if test "x$with_openssl_includes" != "xno"; then
CPPFLAGS="${CPPFLAGS} -I${with_openssl_includes}"
- ICONFIGFLAGS="${ICONFIGFLAGS} -I${with_openssl_includes}"
fi
AC_ARG_WITH(openssl_libraries,
AC_DEFINE_UNQUOTED([API_OPTIONS], ["$API_OPTIONS"], [plugin api related build options])
-# :(
-# FIXIT should be using AM_* flavors instead
-CFLAGS="${CFLAGS} ${CCONFIGFLAGS}"
-CFLAGS=`echo $CFLAGS | sed -e 's/-I\/usr\/include //g'`
-CPPFLAGS="${CPPFLAGS} ${CONFIGFLAGS}"
-CPPFLAGS=`echo $CPPFLAGS | sed -e 's/-I\/usr\/include //g'`
-
-CXXFLAGS="$CFLAGS"
-echo "$AM_CFLAGS $CFLAGS" > cflags.out
-echo "$AM_CPPFLAGS $CPPFLAGS" > cppflags.out
+# hmmm, why are we doing this again?
+#CFLAGS=`echo $CFLAGS | sed -e 's/-I\/usr\/include //g'`
+#CXXFLAGS=`echo $CXXFLAGS | sed -e 's/-I\/usr\/include //g'`
+#CPPFLAGS=`echo $CPPFLAGS | sed -e 's/-I\/usr\/include //g'`
AM_CPPFLAGS='-I$(top_builddir) -I$(top_srcdir)/src -I$(top_srcdir)/src/network_inspectors'
snort2lua_CPPFLAGS='-I$(top_builddir) -I$(top_srcdir)/tools/snort2lua'
AC_SUBST(AM_CPPFLAGS)
-AC_SUBST(AM_CXXFLAGS)
-AC_SUBST(CONFIGFLAGS)
-AC_SUBST(CCONFIGFLAGS)
-AC_SUBST(ICONFIGFLAGS)
AC_SUBST(snort2lua_CPPFLAGS)
+AC_SUBST(AM_CFLAGS)
+AC_SUBST(AM_CXXFLAGS)
+
AC_CONFIG_FILES([ \
snort.pc \
Makefile \
src/utils/Makefile \
lua/Makefile \
doc/Makefile \
+daqs/Makefile \
m4/Makefile \
tools/Makefile \
tools/u2boat/Makefile \
includedir: ${includedir}
compiler: ${CC}
+ compiler++: ${CXX}
cflags: ${CFLAGS}
+ cxxflags: ${CXXFLAGS}
cppflags: ${CPPFLAGS}
ldflags: ${LDFLAGS}
libs: ${LIBS}
--- /dev/null
+
+set(EXTERNAL_INCLUDES
+ ${DAQ_INCLUDE_DIR}
+ ${PCAP_INCLUDE_DIR}
+ ${DNET_INCLUDE_DIR}
+ CACHE INTERNAL "external INCLUDES" FORCE
+)
+
+include_directories(AFTER ${EXTERNAL_INCLUDES})
+
+add_shared_library(daq_socket daqs daq_socket.c daq_socket.h)
+add_shared_library(daq_file daqs daq_file.c daq_socket.h)
+add_shared_library(daq_hext daqs daq_hext.c daq_socket.h)
+
daq_hext_la_LDFLAGS = -module -export-dynamic -avoid-version -shared
daq_hext_la_SOURCES = daq_hext.c daq_socket.h
-AM_CFLAGS = @AM_CFLAGS@
-
# Use the same defines Snort used
# (absolutely critical to ensure struct definitions match)
-CXXFLAGS=`pkg-config --cflags snort`
CFLAGS=`pkg-config --cflags snort`
-AM_CPPFLAGS=`pkg-config --cflags-only-I snort`
+CXXFLAGS=`pkg-config --variable=cxxflags snort`
+CPPFLAGS=`pkg-config --variable=cppflags snort`
-CFLAGS="$CFLAGS -std=c99"
-AM_CFLAGS="-std=c99"
-AM_CXXFLAGS="-std=c++11"
AX_CXX_COMPILE_STDCXX_11
-# not sure why this is borked
-#AC_ENABLE_VISIBILITY()
-#
-# so we do like snort:
-# modified from gnulib/m4/visibility.m4
-AC_DEFUN([CC_VISIBILITY],
-[
- AC_REQUIRE([AC_PROG_CC])
- AC_MSG_CHECKING([for visibility support])
- AC_CACHE_VAL(gl_cv_cc_visibility, [
- gl_save_CFLAGS="$CFLAGS"
- # Add -Werror flag since some compilers, e.g. icc 7.1, don't support it,
- # but only warn about it instead of compilation failing
- CFLAGS="$CFLAGS -Werror -fvisibility=hidden"
- AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
- extern __attribute__((__visibility__("hidden"))) int hiddenvar;
- extern __attribute__((__visibility__("default"))) int exportedvar;
- extern __attribute__((__visibility__("hidden"))) int hiddenfunc (void);
- extern __attribute__((__visibility__("default"))) int exportedfunc (void);]],
- [[]])],
- [gl_cv_cc_visibility="yes"],
- [gl_cv_cc_visibility="no"])
- ])
- AC_MSG_RESULT([$gl_cv_cc_visibility])
- CFLAGS="$gl_save_CFLAGS"
- if test "x$gl_cv_cc_visibility" = "xyes"; then
- AM_CXXFLAGS="$AM_CXXFLAGS -fvisibility=hidden"
- AC_DEFINE([HAVE_VISIBILITY],[1],
- [Define if the compiler supports visibility declarations.])
- fi
-])
-CC_VISIBILITY()
-
AC_ARG_WITH(snort-includes,
AC_HELP_STRING([--with-snort-includes=DIR],[snort include directory]),
[with_snort_includes="$withval"],[with_snort_includes="no"])
if test "x$with_snort_includes" != "xno"; then
- AM_CPPFLAGS="${AM_CPPFLAGS} -I${with_snort_includes}"
+ CPPFLAGS="${CPPFLAGS} -I${with_snort_includes}"
fi
AC_SUBST(AM_CXXFLAGS)
-AC_SUBST(AM_CPPFLAGS)
-AC_SUBST(AM_CFLAGS)
AC_CONFIG_FILES([ \
Makefile \
src/Makefile \
src/codecs/Makefile \
- src/daqs/Makefile \
src/inspectors/Makefile \
src/ips_options/Makefile \
src/loggers/Makefile \
add_subdirectory (codecs)
-add_subdirectory (daqs)
add_subdirectory (inspectors)
add_subdirectory (ips_options)
add_subdirectory (loggers)
SUBDIRS = \
codecs \
-daqs \
inspectors \
ips_options \
loggers \
-
add_example_library(pim codecs pim.cc)
-add_example_library(socket codecs socket.cc)
add_example_library(token_ring codecs token_ring.cc)
+
libtoken_ring_la_LDFLAGS = -export-dynamic -shared
libtoken_ring_la_SOURCES = token_ring.cc
-cdlib_LTLIBRARIES += libsocket.la
-libsocket_la_CXXFLAGS = $(AM_CXXFLAGS)
-libsocket_la_LDFLAGS = -export-dynamic -shared
-libsocket_la_SOURCES = socket.cc
-
AM_CXXFLAGS = @AM_CXXFLAGS@
+++ /dev/null
-
-
-add_example_library(daq_socket daqs daq_socket.c daq_socket.h)
-add_example_library(daq_file daqs daq_file.c daq_socket.h)
-add_example_library(daq_hext daqs daq_hext.c daq_socket.h)
-
datadir=@datadir@
mandir=@infodir@
infodir=@infodir@
+cppflags=@CPPFLAGS@
+cxxflags=@CXXFLAGS@
-Name: Snort
-Description: Snort dynamic plugins/detection/rules
+Name: Snort++
+Description: Snort 3.0 Project
URL: www.snort.org
Version: @VERSION@
Libs: -L${libdir} -lcurl @LDFLAGS@ @LIBS@
-Cflags: @CFLAGS@ @CPPFLAGS@
+Cflags: @CFLAGS@
#include "framework/codec.h"
-// root codecs
-
-// ip codecs
extern const BaseApi* cd_ipv4; // static due to dependence on fpdetect
extern const BaseApi* cd_hopopts; // static to ensure the symbols CheckIPV6HopOptions
// and CheckIPv6ExtensionOrder the final executuable.
extern const BaseApi* cd_tcp; // static because only file that specific functions
// (symbols will be removed from final executabel)
-// link codecs
-
#ifdef STATIC_CODECS
extern const BaseApi* cd_ah;
extern const BaseApi* cd_arp;
extern const BaseApi* cd_dstopts;
+extern const BaseApi* cd_eapol;
extern const BaseApi* cd_erspan2;
extern const BaseApi* cd_erspan3;
extern const BaseApi* cd_esp;
+extern const BaseApi* cd_eth;
extern const BaseApi* cd_fabricpath;
extern const BaseApi* cd_frag;
extern const BaseApi* cd_gre;
extern const BaseApi* cd_gtp;
+extern const BaseApi* cd_i4l_rawip;
extern const BaseApi* cd_icmp4;
extern const BaseApi* cd_icmp4_ip;
extern const BaseApi* cd_icmp6;
extern const BaseApi* cd_icmp6_ip;
extern const BaseApi* cd_ipv6;
extern const BaseApi* cd_igmp;
+extern const BaseApi* cd_linux_sll;
extern const BaseApi* cd_llc;
extern const BaseApi* cd_mobility;
extern const BaseApi* cd_mpls;
extern const BaseApi* cd_no_next;
+extern const BaseApi* cd_null;
+extern const BaseApi* cd_pflog;
extern const BaseApi* cd_pgm;
+extern const BaseApi* cd_ppp;
extern const BaseApi* cd_pppencap;
extern const BaseApi* cd_pppoepkt_disc;
extern const BaseApi* cd_pppoepkt_sess;
+extern const BaseApi* cd_raw4;
+extern const BaseApi* cd_raw6;
extern const BaseApi* cd_routing;
+extern const BaseApi* cd_socket;
extern const BaseApi* cd_sun_nd;
extern const BaseApi* cd_swipe;
extern const BaseApi* cd_teredo;
extern const BaseApi* cd_transbridge;
extern const BaseApi* cd_udp;
extern const BaseApi* cd_vlan;
-
-// Root codecs
-extern const BaseApi* cd_eapol;
-extern const BaseApi* cd_eth;
-extern const BaseApi* cd_i4l_rawip;
-extern const BaseApi* cd_linux_sll;
-extern const BaseApi* cd_null;
-extern const BaseApi* cd_pflog;
-extern const BaseApi* cd_ppp;
-extern const BaseApi* cd_raw4;
-extern const BaseApi* cd_raw6;
extern const BaseApi* cd_wlan;
-
#endif
const BaseApi* codecs[] =
{
- // non root codecs
cd_ipv4,
cd_tcp,
cd_hopopts,
cd_ah,
cd_arp,
cd_dstopts,
+ cd_eapol,
cd_erspan2,
cd_erspan3,
cd_esp,
+ cd_eth,
cd_fabricpath,
cd_frag,
cd_gre,
cd_gtp,
+ cd_i4l_rawip,
cd_icmp4,
cd_icmp4_ip,
cd_icmp6,
cd_icmp6_ip,
cd_ipv6,
cd_igmp,
+ cd_linux_sll,
cd_llc,
cd_mobility,
cd_mpls,
cd_no_next,
+ cd_null,
+ cd_pflog,
cd_pgm,
+ cd_ppp,
cd_pppencap,
cd_pppoepkt_disc,
cd_pppoepkt_sess,
+ cd_raw4,
+ cd_raw6,
cd_routing,
+ cd_socket,
cd_sun_nd,
cd_swipe,
cd_teredo,
cd_transbridge,
cd_udp,
cd_vlan,
-
- /* root codecs */
- cd_eapol,
- cd_eth,
- cd_i4l_rawip,
- cd_linux_sll,
- cd_null,
- cd_pflog,
- cd_ppp,
- cd_raw4,
- cd_raw6,
cd_wlan,
#endif
bool PppEncap::decode(const RawData& raw, CodecData& codec, DecodeData&)
{
- static THREAD_LOCAL bool had_vj = false;
uint16_t protocol;
DebugMessage(DEBUG_DECODE, "PPP Packet!\n");
switch (protocol)
{
case PPP_VJ_COMP:
- had_vj = true;
return false;
case PPP_VJ_UCOMP:
cd_icmp4_ip.cc
cd_icmp6_ip.cc
cd_llc.cc
+ cd_socket.cc
cd_teredo.cc
)
add_shared_library(cd_icmp4_ip codecs cd_icmp4_ip.cc)
add_shared_library(cd_icmp6_ip codecs cd_icmp6_ip.cc)
add_shared_library(cd_llc codecs cd_llc.cc)
+ add_shared_library(cd_socket codecs cd_socket.cc)
add_shared_library(cd_teredo codecs cd_teredo.cc)
endif(STATIC_CODECS)
cd_icmp4_ip.cc \
cd_icmp6_ip.cc \
cd_llc.cc \
+cd_socket.cc \
cd_teredo.cc
if STATIC_CODECS
libcd_llc_la_LDFLAGS = -export-dynamic -shared
libcd_llc_la_SOURCES = cd_llc.cc
+cdlib_LTLIBRARIES += libcd_socket.la
+libcd_socket_la_CXXFLAGS = $(AM_CXXFLAGS) -DBUILDING_SO
+libcd_socket_la_LDFLAGS = -export-dynamic -shared
+libcd_socket_la_SOURCES = cd_socket.cc
+
cdlib_LTLIBRARIES += libcd_teredo.la
libcd_teredo_la_CXXFLAGS = $(AM_CXXFLAGS) -DBUILDING_SO
libcd_teredo_la_LDFLAGS = -export-dynamic -shared
dtor
};
+#ifdef BUILDING_SO
SO_PUBLIC const BaseApi* snort_plugins[] =
{
&socket_api.base,
nullptr
};
+#else
+const BaseApi* cd_socket = &socket_api.base;
+#endif
data/libdata.a \
data/data_types/libdata_types.a
-snort2lua_CFLAGS = @CFLAGS@ $(AM_CFLAGS)
-snort2lua_CPPFLAGS = @snort2lua_CPPFLAGS@
-
SUBDIRS = \
helpers \
data \