Changes in / [ea911b7:9b9c279]


Ignore:
Files:
1 added
8 edited

Legend:

Unmodified
Added
Removed
  • configure.in

    r32a3ec5 rf72e13d  
    424424fi
    425425
     426# Check for PF_RING
     427AC_ARG_WITH(pfring,
     428            AS_HELP_STRING(--with-pfring,include PF_RING live capture support (if PF_RING libraries are available)),
     429[
     430        if test "$withval" = no
     431        then
     432            want_pfring=no
     433        else
     434            want_pfring=ifpresent
     435        fi
     436],[
     437        want_pfring=ifpresent
     438])
     439
     440
     441
     442libtrace_pfring=false
     443if test "$want_pfring" != no; then
     444        # bit annoying that we have to include extra libs to account for
     445        # optional pfring modules that depend on these libs
     446        AC_SEARCH_LIBS(pfring_recv, pfring, pfring_found=1, pfring_found=0,[-ldag -lpcap])
     447        if test "$pfring_found" = 1; then
     448                ADD_LIBS="$ADD_LIBS -lpfring"
     449                LIBTRACE_LIBS="$LIBTRACE_LIBS -lpfring"
     450                AC_DEFINE(HAVE_PFRING,1,[conditional for building with DAG live capture support])
     451                libtrace_pfring=true
     452        fi     
     453fi
     454
    426455# Check for PACKET_FANOUT (borrowed from Suricata)
    427456AC_CHECK_DECL([PACKET_FANOUT],
     
    589618AM_CONDITIONAL([HAVE_BPF_CAPTURE], [test "$ac_cv_have_decl_BIOCSETIF" = yes ])
    590619AM_CONDITIONAL([HAVE_DAG], [test "$libtrace_dag" = true])
     620AM_CONDITIONAL([HAVE_PFRING], [test "$libtrace_pfring" = true])
    591621AM_CONDITIONAL([HAVE_DPDK], [test "$libtrace_dpdk" = true])
    592622AM_CONDITIONAL([DAG2_4], [test "$libtrace_dag_version" = 24])
     
    670700        AC_MSG_NOTICE([Note: Requires DPDK v1.5 or newer])
    671701fi
     702
     703if test x"$libtrace_pfring" = xtrue; then
     704        AC_MSG_NOTICE([Compiled with PF_RING live capture support: Yes])
     705else
     706        AC_MSG_NOTICE([Compiled with PF_RING live capture support: No])
     707fi
     708
    672709reportopt "Compiled with LLVM BPF JIT support" $JIT
    673710reportopt "Building man pages/documentation" $libtrace_doxygen
  • lib/Makefile.am

    re63d80d rf72e13d  
    5050endif
    5151
     52if HAVE_PFRING
     53NATIVEFORMATS += format_pfring.c
     54endif
     55
    5256libtrace_la_SOURCES = trace.c trace_parallel.c common.h \
    5357                format_erf.c format_pcap.c format_legacy.c \
  • lib/format_helper.c

    rd8b05b7 r274770a  
    4646#include <time.h>
    4747#include "format_helper.h"
     48#include <unistd.h>
     49#ifndef _SC_NPROCESSORS_ONLN
     50#include <sys/param.h>
     51#include <sys/sysctl.h>
     52#endif
    4853
    4954#include <assert.h>
     
    331336        va_end(va);
    332337}
     338
     339uint32_t trace_get_number_of_cores(void) {
     340
     341        uint32_t t = 0;
     342#ifdef _SC_NPROCESSORS_ONLN
     343        t = sysconf(_SC_NPROCESSORS_ONLN);
     344        if (t < 1 || t > ((uint32_t)1 << 31))
     345                t = sysconf(_SC_NPROCESSORS_CONF);
     346#else
     347        int nm[2];
     348        size_t len = 4;
     349       
     350        nm[0] = CTL_HW; nm[1] = HW_AVAILCPU;
     351        sysctl(nm, 2, &t, &len, NULL, 0);
     352       
     353        if (t < 1) {
     354                nm[1] = HW_NCPU;
     355                sysctl(nm, 2, &t, &len, NULL, 0);
     356        }
     357#endif
     358        if (t < 1 || t > ((uint32_t)1 << 31))
     359                t = 4;
     360        return t;
     361}
  • lib/format_helper.h

    rd8b05b7 r274770a  
    9595                int level,
    9696                int filemode);
     97
     98/** Determines the number of cores available on the host.
     99 *
     100 * @return The number of cores detected by this function.
     101 */
     102uint32_t trace_get_number_of_cores(void);
    97103#endif /* FORMAT_HELPER_H */
  • lib/format_rt.c

    rd8b05b7 rd8b05b7  
    159159                return -1;
    160160        }
     161
     162        if (ntohl(connect_msg.type) == TRACE_RT_HELLO) {
     163
     164                if (connect_msg.length != sizeof(rt_hello_t)) {
     165                        trace_set_err(libtrace,
     166                                        TRACE_ERR_INIT_FAILED,
     167                                        "RT version mismatch: we are version 3, server is >= 4");
     168                        return -1;
     169                }
     170        }
     171
     172        if (ntohl(connect_msg.type) == TRACE_RT_DENY_CONN) {
     173
     174                if (connect_msg.length != sizeof(rt_deny_conn_t)) {
     175                        trace_set_err(libtrace,
     176                                        TRACE_ERR_INIT_FAILED,
     177                                        "RT version mismatch: we are version 3, server is >= 4");
     178                        return -1;
     179                }
     180        }
     181
    161182       
    162183        if (connect_msg.magic != LIBTRACE_RT_MAGIC) {
  • lib/libtrace.h.in

    rd391ce0 rf72e13d  
    392392        TRACE_FORMAT_RAWERF       =16,  /**< Special format for reading uncompressed ERF traces without checking for compression */
    393393    TRACE_FORMAT_DPDK     =17, /**< The Intel Data Plane Development Kit format */
     394        TRACE_FORMAT_PFRING       =18,
    394395};
    395396
     
    445446    /** RT is encapsulating a Intel DPDK capture record */
    446447        TRACE_RT_DATA_DPDK=TRACE_RT_DATA_SIMPLE+TRACE_FORMAT_DPDK,
     448
     449        /** RT is encapsulating a PF_RING capture record */
     450        TRACE_RT_DATA_PFRING = TRACE_RT_DATA_SIMPLE + TRACE_FORMAT_PFRING,
    447451
    448452        /** As PCAP does not store the linktype with the packet, we need to
  • lib/libtrace_int.h

    rb24d186 rb24d186  
    12631263void dpdk_constructor(void);
    12641264#endif
     1265#if HAVE_PFRING
     1266void pfring_constructor(void);
     1267#endif
    12651268
    12661269/** Extracts the RadioTap flags from a wireless link header
  • lib/trace.c

    rb24d186 rb24d186  
    159159#ifdef HAVE_DPDK
    160160        dpdk_constructor();
     161#endif
     162#ifdef HAVE_PFRING
     163        pfring_constructor();   
    161164#endif
    162165        }
Note: See TracChangeset for help on using the changeset viewer.