]> The Tcpdump Group git mirrors - tcpdump/commitdiff
Use the new libpcap <pcap/nflog.h> for NFLOG definitions and declarations.
authorGuy Harris <[email protected]>
Mon, 3 Feb 2014 04:14:26 +0000 (20:14 -0800)
committerGuy Harris <[email protected]>
Mon, 3 Feb 2014 04:14:26 +0000 (20:14 -0800)
Use the header file for information about LINKTYPE_NFLOG files.

Don't build the NFLOG printer if we don't have that header file.

Fix some checks for pcap/XXX.h header files to look for
"tcpdump-stdinc.h" rather than <tcpdump-stdinc.h>, so that we don't fail
to find that header.

config.h.in
configure
configure.in
print-nflog.c
tcpdump.c

index 81da0ced0a02cf156798bdf18a1d1ab5c245ee14..a3ae3ac4a83e3b1519b7277d440dd79f92b57aa3 100644 (file)
 /* define if libpcap has pcap_list_datalinks() */
 #undef HAVE_PCAP_LIST_DATALINKS
 
+/* Define to 1 if you have the <pcap/nflog.h> header file. */
+#undef HAVE_PCAP_NFLOG_H
+
 /* Define to 1 if you have the `pcap_setdirection' function. */
 #undef HAVE_PCAP_SETDIRECTION
 
index f857b8da01577c026212d5decba85ef49bb43562..114edcd69f58ae0fc1c1105b2652f3ca632f69ab 100755 (executable)
--- a/configure
+++ b/configure
@@ -7308,7 +7308,7 @@ savedcppflags="$CPPFLAGS"
 CPPFLAGS="$CPPFLAGS $V_INCLS"
 for ac_header in pcap/bluetooth.h
 do :
-  ac_fn_c_check_header_compile "$LINENO" "pcap/bluetooth.h" "ac_cv_header_pcap_bluetooth_h" "#include <tcpdump-stdinc.h>
+  ac_fn_c_check_header_compile "$LINENO" "pcap/bluetooth.h" "ac_cv_header_pcap_bluetooth_h" "#include \"tcpdump-stdinc.h\"
 "
 if test "x$ac_cv_header_pcap_bluetooth_h" = xyes; then :
   cat >>confdefs.h <<_ACEOF
@@ -7319,9 +7319,22 @@ fi
 
 done
 
+for ac_header in pcap/nflog.h
+do :
+  ac_fn_c_check_header_compile "$LINENO" "pcap/nflog.h" "ac_cv_header_pcap_nflog_h" "#include \"tcpdump-stdinc.h\"
+"
+if test "x$ac_cv_header_pcap_nflog_h" = xyes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_PCAP_NFLOG_H 1
+_ACEOF
+
+fi
+
+done
+
 for ac_header in pcap/usb.h
 do :
-  ac_fn_c_check_header_compile "$LINENO" "pcap/usb.h" "ac_cv_header_pcap_usb_h" "#include <tcpdump-stdinc.h>
+  ac_fn_c_check_header_compile "$LINENO" "pcap/usb.h" "ac_cv_header_pcap_usb_h" "#include \"tcpdump-stdinc.h\"
 "
 if test "x$ac_cv_header_pcap_usb_h" = xyes; then :
   cat >>confdefs.h <<_ACEOF
index b2443afa411922071b2814abe62236c4c5a49582..e347d51284e0e877246cb8bec92afef4e5ac79ca 100644 (file)
@@ -986,8 +986,9 @@ fi
 #
 savedcppflags="$CPPFLAGS"
 CPPFLAGS="$CPPFLAGS $V_INCLS"
-AC_CHECK_HEADERS(pcap/bluetooth.h,,,[#include <tcpdump-stdinc.h>])
-AC_CHECK_HEADERS(pcap/usb.h,,,[#include <tcpdump-stdinc.h>])
+AC_CHECK_HEADERS(pcap/bluetooth.h,,,[#include "tcpdump-stdinc.h"])
+AC_CHECK_HEADERS(pcap/nflog.h,,,[#include "tcpdump-stdinc.h"])
+AC_CHECK_HEADERS(pcap/usb.h,,,[#include "tcpdump-stdinc.h"])
 CPPFLAGS="$savedcppflags"
 
 AC_PROG_RANLIB
index 8e7cd30bba43d538cd2fb8a883a43a9a5e2c142c..f53b48e6f09fe1d273d387d29393e885d143eacb 100644 (file)
 #include "netdissect.h"
 #include "interface.h"
 
-/*
- * Structure of an NFLOG header and TLV parts, as described at
- * http://www.tcpdump.org/linktypes/LINKTYPE_NFLOG.html
- */
-typedef struct nflog_hdr {
-       u_int8_t        nflog_family;           /* adress family */
-       u_int8_t        nflog_version;          /* version */
-       u_int16_t       nflog_rid;                      /* resource ID */
-} nflog_hdr_t;
-
-typedef struct nflog_tlv {
-       u_int16_t       tlv_length;             /* tlv length */
-       u_int16_t       tlv_type;               /* tlv type */
-       void*           tlv_value;              /* tlv value */
-} nflog_tlv_t;
-
-#ifdef DLT_NFLOG
-
-#define NFULA_PAYLOAD 9
+#if defined(DLT_NFLOG) && defined(HAVE_PCAP_NFLOG_H)
+#include <pcap/nflog.h>
 
 static const struct tok nflog_values[] = {
        { AF_INET,              "IPv4" },
@@ -139,7 +122,7 @@ nflog_if_print(struct netdissect_options *ndo,
        switch (hdr->nflog_family) {
 
        case AF_INET:
-                       ip_print(ndo, p, length);
+               ip_print(ndo, p, length);
                break;
 
 #ifdef INET6
@@ -161,4 +144,4 @@ nflog_if_print(struct netdissect_options *ndo,
        return h_size;
 }
 
-#endif /* DLT_NFLOG */
+#endif /* defined(DLT_NFLOG) && defined(HAVE_PCAP_NFLOG_H) */
index 19d7f2b42d4aadd8229c409bfc1f4c2f581a8005..1e3d906d0a1210c070d6a39eab4cb0fab379f3f1 100644 (file)
--- a/tcpdump.c
+++ b/tcpdump.c
@@ -341,7 +341,7 @@ static const struct ndo_printer ndo_printers[] = {
 #ifdef DLT_NETANALYZER_TRANSPARENT
        { netanalyzer_transparent_if_print, DLT_NETANALYZER_TRANSPARENT },
 #endif
-#ifdef DLT_NFLOG
+#if defined(DLT_NFLOG) && defined(HAVE_PCAP_NFLOG_H)
        { nflog_if_print,       DLT_NFLOG},
 #endif
        { NULL,                 0 },