]> The Tcpdump Group git mirrors - tcpdump/commitdiff
Merge remote-tracking branch 'bpf/master'
authorDenis Ovsienko <[email protected]>
Sun, 16 Jun 2013 20:02:15 +0000 (00:02 +0400)
committerDenis Ovsienko <[email protected]>
Sun, 16 Jun 2013 20:02:15 +0000 (00:02 +0400)
Conflicts:
Makefile.in

Makefile.in
netdissect.h
print-nflog.c [new file with mode: 0644]
print-ospf.c
print-ospf6.c
tcpdump-stdinc.h
tcpdump.c

index 2b5f8ad6ecc6b796ec3e7942c56bb249f352774c..3fb1da8d74bddda3e79f796a7ed03f04368856f8 100644 (file)
@@ -87,8 +87,8 @@ CSRC =        addrtoname.c af.c checksum.c cpack.c gmpls.c oui.c gmt2local.c ipproto.c
        print-l2tp.c print-lane.c print-ldp.c print-lldp.c print-llc.c \
         print-lmp.c print-lspping.c print-lwapp.c \
        print-lwres.c print-mobile.c print-mpcp.c print-mpls.c print-mptcp.c print-msdp.c \
-       print-msnlb.c print-nfs.c print-ntp.c print-null.c print-olsr.c \
-       print-openflow.c print-openflow-1.0.c print-ospf.c \
+       print-msnlb.c print-nfs.c print-ntp.c print-null.c print-nflog.c \
+       print-olsr.c print-openflow.c print-openflow-1.0.c print-ospf.c \
        print-pgm.c print-pim.c \
        print-ppi.c print-ppp.c print-pppoe.c print-pptp.c \
        print-radius.c print-raw.c print-rip.c print-rpki-rtr.c print-rrcp.c print-rsvp.c \
index 6e4a8972b5c7f97cd85dc90d5490863889b28b22..f1ce79596d74a0b48972ffe979edf29787e00085 100644 (file)
@@ -473,6 +473,8 @@ extern void pptp_print(netdissect_options *,const u_char *, u_int);
 extern u_int ipnet_if_print(netdissect_options *,const struct pcap_pkthdr *, const u_char *);
 extern u_int ppi_if_print(netdissect_options *,const struct pcap_pkthdr *, const u_char *);
 
+extern u_int nflog_if_print(netdissect_options *,const struct pcap_pkthdr *, const u_char *);
+
 extern u_int ieee802_15_4_if_print(netdissect_options *,const struct pcap_pkthdr *, const u_char *);
 
 #ifdef INET6
diff --git a/print-nflog.c b/print-nflog.c
new file mode 100644 (file)
index 0000000..eed9c48
--- /dev/null
@@ -0,0 +1,36 @@
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <tcpdump-stdinc.h>
+
+#include <stdio.h>
+#include <pcap.h>
+
+#include "netdissect.h"
+#include "interface.h"
+
+#ifdef DLT_NFLOG
+
+static void
+nflog_print(struct netdissect_options *ndo, const u_char *p, u_int length, u_int caplen _U_)
+{
+       ip_print(ndo, p, length);
+       return;
+}
+
+u_int
+nflog_if_print(struct netdissect_options *ndo,
+              const struct pcap_pkthdr *h, const u_char *p)
+{
+       if (h->len < 104 || h->caplen < 104) {
+               ND_PRINT((ndo, "[!nflog]"));
+               return h->caplen;
+       }
+
+       nflog_print(ndo, p + 104, h->len - 104, h->caplen - 104);
+
+       return 104;
+}
+
+#endif /* DLT_NFLOG */
index f8ff4aeac5b0d770ca4f72a99321e623b062f82d..736f5df39505c65208397fbb7b98b90a6e755e82 100644 (file)
@@ -187,10 +187,6 @@ static struct tok ospf_lls_eo_options[] = {
 
 static char tstr[] = " [|ospf2]";
 
-#ifdef WIN32
-#define inline __inline
-#endif /* WIN32 */
-
 static int ospf_print_lshdr(const struct lsa_hdr *);
 static const u_char *ospf_print_lsa(const struct lsa *);
 static int ospf_decode_v2(const struct ospfhdr *, const u_char *);
index fb62b3968597f64103e65dc994ae873191ba0968..dbd07ec3d436fe76b79e6d9cc8250b5ee351d5c3 100644 (file)
@@ -117,10 +117,6 @@ static struct tok ospf6_lsa_prefix_option_values[] = {
 
 static char tstr[] = " [|ospf3]";
 
-#ifdef WIN32
-#define inline __inline
-#endif /* WIN32 */
-
 /* Forwards */
 static void ospf6_print_ls_type(u_int, const rtrid_t *);
 static int ospf6_print_lshdr(const struct lsa6_hdr *);
index d350d1be126b3c7529162fc95eeef83434cd8be2..1e5fc3a9fcf9c1a1fa8f1ce12ee3a0a2128b087f 100644 (file)
@@ -84,6 +84,13 @@ extern const char *inet_ntop (int, const void *, char *, size_t);
 extern int inet_pton (int, const char *, void *);
 extern int inet_aton (const char *cp, struct in_addr *addr);
 
+/*
+ * With MSVC, for C, __inline is used to make a function an inline.
+ */
+#ifdef _MSC_VER
+#define inline __inline
+#endif
+
 #ifndef INET6_ADDRSTRLEN
 #define INET6_ADDRSTRLEN 46
 #endif
index c0605fbb697a75dfa08ba3b76186f26b2850859b..5435c7d41e6f292b7262e0f77c3f526d0cf56552 100644 (file)
--- a/tcpdump.c
+++ b/tcpdump.c
@@ -312,6 +312,9 @@ static struct printer printers[] = {
 };
 
 static struct ndo_printer ndo_printers[] = {
+#ifdef DLT_NFLOG
+       { nflog_if_print,       DLT_NFLOG},
+#endif
        { ether_if_print,       DLT_EN10MB },
 #ifdef DLT_IPNET
        { ipnet_if_print,       DLT_IPNET },