]> git.ipfire.org Git - thirdparty/snort3.git/commitdiff
Merge pull request #225 in SNORT/snort3 from ~MIALTIZE/snort3:for-russ to master
authorRuss Combs (rucombs) <rucombs@cisco.com>
Wed, 3 Feb 2016 13:39:00 +0000 (08:39 -0500)
committerRuss Combs (rucombs) <rucombs@cisco.com>
Wed, 3 Feb 2016 13:39:00 +0000 (08:39 -0500)
Squashed commit of the following:

commit 65ec53744d1f200275a4aed1b021fecfe45edf90
Author: Michael Altizer <mialtize@cisco.com>
Date:   Tue Feb 2 17:12:23 2016 -0500

    extra: Use pkg-config to retrieve Snort includes dir, remove explicit option

commit af06110d9e32bab85b443c72ee290005cbc95899
Author: Michael Altizer <mialtize@cisco.com>
Date:   Tue Feb 2 17:11:00 2016 -0500

    snort.pc: Only export CPPFLAGS as Cflags (should be further pruned/controlled)

commit d6ecbb16ba40638a120c11c0d0baf11bb85ba257
Author: Michael Altizer <mialtize@cisco.com>
Date:   Tue Feb 2 11:21:12 2016 -0500

    extra: Prefer clang compiler like Snort does.

commit 8539fc0f7e4fee80ee4e90b07a0fbd14a1416b3d
Author: Michael Altizer <mialtize@cisco.com>
Date:   Tue Feb 2 11:19:23 2016 -0500

    snort.pc: Add Snort install dir to CPPFLAGS includes

    Note: This is sort of an ugly subversion of pkg-config, but I'm just
    following suit.

commit 6f1795ad3db90b468d3c6ae2d4e7e47c97806e64
Author: Michael Altizer <mialtize@cisco.com>
Date:   Mon Feb 1 16:00:47 2016 -0500

    sfdaq: Conditionally support new-style daq_modify_flow()

commit 3ca33d0ad7839e3583e2630a949c94284e15ce68
Author: Michael Altizer <mialtize@cisco.com>
Date:   Tue Jan 19 13:47:10 2016 -0500

    Remove DAQ_GetAddressSpaceID.  We don't support LibDAQ versions without address space ID anymore.

commit 88707f0f4cfb74ef108c7880a710b0345d8d040f
Author: Michael Altizer <mialtize@cisco.com>
Date:   Mon Jan 4 15:38:02 2016 -0500

    autoconf: Prefer clang over gcc for CC to match CXX

configure.ac
extra/README
extra/configure.ac
extra/configure_cmake.sh
snort.pc.in
src/flow/flow_control.cc
src/packet_io/sfdaq.cc
src/packet_io/sfdaq.h
src/stream/stream_api.cc

index c6aa7c83ba59fd1dd2082d5c410b767c89900cc3..322f14e2060f5d45f9b128ceffbf8ebb1df93c86 100644 (file)
@@ -33,8 +33,7 @@ AC_CONFIG_HEADERS([config.h src/framework/api_options.h])
 AM_INIT_AUTOMAKE(foreign nostdinc)
 AM_SILENT_RULES([yes])
 
-LT_INIT
-
+AC_PROG_CC([clang gcc])
 AC_PROG_CXX([clang++ g++])
 AC_PROG_AWK
 AC_PROG_CC
@@ -61,6 +60,8 @@ if test "x$CXX" = "xg++"; then
     fi
 fi
 
+LT_INIT
+
 PKG_PROG_PKG_CONFIG
 
 #--------------------------------------------------------------------------
index 679da98a061a77d5d373f0875bc30b3bc45f6bbe..97ec5f0d08338ed02f9455d8ce66a296062efcf0 100644 (file)
@@ -58,13 +58,13 @@ Follow these steps:
 
 * To build with autotools, simply do the usual from the top level directory:
 
-    ./configure --prefix=$my_path --with-snort-includes=$my_path/include/snort
+    ./configure --prefix=$my_path
     make -j 8 install
 
-* To build with cmake, do the following:
+* To build with cmake and make, run configure_cmake.sh.  It will automatically create and populate a new subdirectory named 'build'.
 
-    mkdir build && cd build
-    cmake ..
+    ./configure_cmake.sh --prefix=$my_path
+    cd build
     make -j 8 install
 
 Note:
index 00e77d8249920530bc48cf916e85106b56edae7f..fe80100c19b40a8f3f5526ede0e11e08847f8e04 100644 (file)
@@ -12,29 +12,21 @@ AC_CONFIG_HEADERS([config.h])
 AM_INIT_AUTOMAKE(foreign)
 AM_SILENT_RULES([yes])
 
-LT_INIT
-
 # Checks for programs.
-AC_PROG_CXX
+AC_PROG_CC([clang gcc])
+AC_PROG_CXX([clang++ g++])
 AC_PROG_LIBTOOL
 
+LT_INIT
+
 # Use the same defines Snort used
 # (absolutely critical to ensure struct definitions match)
-CFLAGS=`pkg-config --cflags snort`
-CXXFLAGS=`pkg-config --variable=cxxflags snort`
-CPPFLAGS=`pkg-config --variable=cppflags snort`
+CPPFLAGS="$CPPFLAGS `pkg-config --cflags snort`"
 
-CPPFLAGS+=" -DBUILDING_SO"
+CPPFLAGS="$CPPFLAGS -DBUILDING_SO"
 
 AX_CXX_COMPILE_STDCXX_11
 
-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
-    CPPFLAGS="${CPPFLAGS} -I${with_snort_includes}"
-fi
 
 #--------------------------------------------------------------------------
 # visibility foo
@@ -92,3 +84,20 @@ AC_CONFIG_FILES([ \
 
 AC_OUTPUT
 
+AC_MSG_RESULT([
+    $PACKAGE $VERSION
+    ========
+
+    prefix:         ${prefix}
+    sysconfdir:     ${sysconfdir}
+    libdir:         ${libdir}
+    includedir:     ${includedir}
+
+    compiler:       ${CC}
+    compiler++:     ${CXX}
+    cflags:         ${CFLAGS}
+    cxxflags:       ${CXXFLAGS}
+    cppflags:       ${CPPFLAGS}
+    ldflags:        ${LDFLAGS}
+    libs:           ${LIBS}
+])
index 640a8fe34fcb71b28c87fd3ad571f8d73b430ab2..0cb488e317ea91067c48c51278e338dab09696be 100755 (executable)
@@ -21,7 +21,6 @@ Usage: $0 [OPTION]... [VAR=VALUE]...
         --prefix=     Snort++ installation prefix
 
     Optional Packages:
-    --with-snort-includes=DIR    snort include directory
     --with-daq-includes=DIR        DAQ include directory
     --with-daq-libraries=DIR       DAQ library directory
     --with-luajit-includes=DIR    luajit include directory
@@ -82,12 +81,6 @@ while [ $# -ne 0 ]; do
             prefix=$optarg
             append_cache_entry CMAKE_INSTALL_PREFIX PATH $optarg
             ;;
-        --with-snort-includes=*)
-            append_cache_entry SNORT_INCLUDE_DIR PATH $optarg
-            ;;
-        --with-snort-executable=*)
-            append_cache_entry SNORT_EXECUTABLE FILEPATH $optarg
-            ;;
         --with-luajit-includes=*)
             append_cache_entry LUAJIT_INCLUDE_DIR PATH $optarg
             ;;
index bcb1519bdff11a5597d5e12330d1721f19a43600..02ed931cc204d1c52dbe817fc7faafc889e70d10 100644 (file)
@@ -7,13 +7,11 @@ datarootdir=@datarootdir@
 datadir=@datadir@
 mandir=@infodir@
 infodir=@infodir@
-cppflags=@CPPFLAGS@
-cxxflags=@CXXFLAGS@
 
 Name: Snort++
 Description: Snort 3.0 Project
 URL: www.snort.org
 Version: @VERSION@
 Libs: -L${libdir} -lcurl @LDFLAGS@ @LIBS@
-Cflags: @CFLAGS@
+Cflags: @CPPFLAGS@ -I${includedir}/snort
 
index a2fd4dd4e64fd1a93badb14c33eed10509278215..68f2ca14656c3e8e70da64d841effde2cacc0445 100644 (file)
@@ -286,7 +286,7 @@ void FlowControl::set_key(FlowKey* key, Packet* p)
     else
         mplsId = 0;
 
-    addressSpaceId = DAQ_GetAddressSpaceID(p->pkth);
+    addressSpaceId = p->pkth->address_space_id;
 
     if ( (p->ptrs.decode_flags & DECODE_FRAG) )
     {
index 160e34b3cb9e60aea6db483667b1b77a92451453..c2b1bdbe920e795eee49efb69debcd023774cad5 100644 (file)
@@ -590,12 +590,19 @@ const DAQ_Stats_t* DAQ_GetStats(void)
 
 //--------------------------------------------------------------------
 
-int DAQ_ModifyFlow(const void* h, uint32_t id)
+int DAQ_ModifyFlowOpaque(const void* h, uint32_t opaque)
 {
     const DAQ_PktHdr_t* hdr = (DAQ_PktHdr_t*)h;
     DAQ_ModFlow_t mod;
 
-    mod.opaque = id;
+#ifdef DAQ_MODFLOW_TYPE_OPAQUE
+    mod.type = DAQ_MODFLOW_TYPE_OPAQUE;
+    mod.length = sizeof(opaque);
+    mod.value = &opaque;
+#else
+    mod.opaque = opaque;
+#endif
+
     return daq_modify_flow(daq_mod, daq_hand, hdr, &mod);
 }
 
index 7eae8d156088f7460af5d673da5d4cc8f314b572..79abcc64c072b3e34c89ab22c536a7afef974043 100644 (file)
@@ -78,12 +78,7 @@ int DAQ_BreakLoop(int error, void* handle = nullptr);
 void DAQ_Set_MetaCallback(DAQ_Meta_Func_t meta_callback);
 SO_PUBLIC DAQ_Mode DAQ_GetInterfaceMode(const DAQ_PktHdr_t* h);
 
-int DAQ_ModifyFlow(const void* h, uint32_t id);
-
-static inline uint16_t DAQ_GetAddressSpaceID(const DAQ_PktHdr_t* h)
-{
-    return h->address_space_id;
-}
+int DAQ_ModifyFlowOpaque(const void* h, uint32_t opaque);
 
 // returns total stats if no daq else current stats
 // returns statically allocated stats - don't free
index 7079005512d80c9165b27056d12d7cc815d1f098..f2b503570f35b857fe8a0fe5906618a4293bc248 100644 (file)
@@ -122,7 +122,7 @@ void Stream::populate_session_key(Packet* p, FlowKey* key)
         // if the vlan protocol bit is defined, vlan layer gauranteed to exist
         (p->proto_bits & PROTO_BIT__VLAN) ? layer::get_vlan_layer(p)->vid() : 0,
         (p->proto_bits & PROTO_BIT__MPLS) ? p->ptrs.mplsHdr.label : 0,
-        DAQ_GetAddressSpaceID(p->pkth));
+        p->pkth->address_space_id);
 }
 
 FlowKey* Stream::get_session_key(Packet* p)