Merge Official Source

This commit is contained in:
CN_SZTL 2020-11-29 00:02:19 +08:00
commit fa42d1f66b
No known key found for this signature in database
GPG Key ID: 6850B6345C862176
15 changed files with 32 additions and 793 deletions

View File

@ -18,8 +18,28 @@ else
cmake_tool=$(shell which $(1))
endif
CMAKE_C_COMPILER:=$(call cmake_tool,$(TARGET_CC_NOCACHE))
CMAKE_CXX_COMPILER:=$(call cmake_tool,$(TARGET_CXX_NOCACHE))
ifeq ($(CONFIG_CCACHE),)
CMAKE_C_COMPILER:=$(call cmake_tool,$(TARGET_CC))
CMAKE_CXX_COMPILER:=$(call cmake_tool,$(TARGET_CXX))
CMAKE_C_COMPILER_ARG1:=
CMAKE_CXX_COMPILER_ARG1:=
CMAKE_HOST_C_COMPILER:=$(HOSTCC)
CMAKE_HOST_CXX_COMPILER:=$(HOSTCXX)
CMAKE_HOST_C_COMPILER_ARG1:=
CMAKE_HOST_CXX_COMPILER_ARG1:=
else
CCACHE:=$(STAGING_DIR_HOST)/bin/ccache
CMAKE_C_COMPILER:=$(CCACHE)
CMAKE_C_COMPILER_ARG1:=$(TARGET_CC_NOCACHE)
CMAKE_CXX_COMPILER:=$(CCACHE)
CMAKE_CXX_COMPILER_ARG1:=$(TARGET_CXX_NOCACHE)
CMAKE_HOST_C_COMPILER:=$(CCACHE)
CMAKE_HOST_C_COMPILER_ARG1:=$(HOSTCC_NOCACHE)
CMAKE_HOST_CXX_COMPILER:=$(CCACHE)
CMAKE_HOST_CXX_COMPILER_ARG1:=$(HOSTCXX_NOCACHE)
endif
CMAKE_AR:=$(call cmake_tool,$(TARGET_AR))
CMAKE_NM:=$(call cmake_tool,$(TARGET_NM))
CMAKE_RANLIB:=$(call cmake_tool,$(TARGET_RANLIB))
@ -41,11 +61,12 @@ define Build/Configure/Default
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_C_FLAGS_RELEASE="-DNDEBUG" \
-DCMAKE_CXX_FLAGS_RELEASE="-DNDEBUG" \
$(if $(CONFIG_CCACHE),-DCMAKE_CXX_COMPILER_LAUNCHER="$(STAGING_DIR_HOST)/bin/ccache") \
$(if $(CONFIG_CCACHE),-DCMAKE_C_COMPILER_LAUNCHER="$(STAGING_DIR_HOST)/bin/ccache") \
-DCMAKE_C_COMPILER="$(CMAKE_C_COMPILER)" \
-DCMAKE_C_COMPILER_ARG1="$(CMAKE_C_COMPILER_ARG1)" \
-DCMAKE_CXX_COMPILER="$(CMAKE_CXX_COMPILER)" \
-DCMAKE_CXX_COMPILER_ARG1="$(CMAKE_CXX_COMPILER_ARG1)" \
-DCMAKE_ASM_COMPILER="$(CMAKE_C_COMPILER)" \
-DCMAKE_ASM_COMPILER_ARG1="$(CMAKE_C_COMPILER_ARG1)" \
-DCMAKE_EXE_LINKER_FLAGS:STRING="$(TARGET_LDFLAGS)" \
-DCMAKE_MODULE_LINKER_FLAGS:STRING="$(TARGET_LDFLAGS) $(CMAKE_SHARED_LDFLAGS)" \
-DCMAKE_SHARED_LINKER_FLAGS:STRING="$(TARGET_LDFLAGS) $(CMAKE_SHARED_LDFLAGS)" \
@ -86,8 +107,12 @@ define Host/Configure/Default
LDFLAGS="$(HOST_LDFLAGS)" \
cmake \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_C_COMPILER="$(HOSTCC)" \
-DCMAKE_CXX_COMPILER="$(HOSTCXX)" \
-DCMAKE_C_COMPILER="$(CMAKE_HOST_C_COMPILER)" \
-DCMAKE_C_COMPILER_ARG1="$(CMAKE_HOST_C_COMPILER_ARG1)" \
-DCMAKE_CXX_COMPILER="$(CMAKE_HOST_CXX_COMPILER)" \
-DCMAKE_CXX_COMPILER_ARG1="$(CMAKE_HOST_CXX_COMPILER_ARG1)" \
-DCMAKE_ASM_COMPILER="$(CMAKE_HOST_C_COMPILER)" \
-DCMAKE_ASM_COMPILER_ARG1="$(CMAKE_HOST_C_COMPILER_ARG1)" \
-DCMAKE_C_FLAGS_RELEASE="-DNDEBUG" \
-DCMAKE_CXX_FLAGS_RELEASE="-DNDEBUG" \
-DCMAKE_EXE_LINKER_FLAGS:STRING="$(HOST_LDFLAGS)" \

View File

@ -1,72 +0,0 @@
#
# Copyright (C) 2009-2013 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
PKG_NAME:=libnetfilter_cthelper
PKG_VERSION:=1.0.0
PKG_RELEASE:=2
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
PKG_SOURCE_URL:= \
http://www.netfilter.org/projects/libnetfilter_cthelper/files/ \
ftp://ftp.netfilter.org/pub/libnetfilter_cthelper/
PKG_HASH:=07618e71c4d9a6b6b3dc1986540486ee310a9838ba754926c7d14a17d8fccf3d
PKG_FIXUP:=autoreconf
PKG_LICENSE:=GPL-2.0+
PKG_INSTALL:=1
include $(INCLUDE_DIR)/package.mk
define Package/libnetfilter-cthelper
SECTION:=libs
CATEGORY:=Libraries
DEPENDS:=+libmnl
TITLE:=API to the in-kernel connection tracking helper infrastructure
URL:=http://www.netfilter.org/projects/libnetfilter_cthelper/
ABI_VERSION:=0
endef
define Package/libnetfilter-cthelper/description
libnetfilter_cthelper is a userspace library providing a programming
interface (API) to the in-kernel connection tracking helpers.
This library is currently used by conntrack-tools.
endef
TARGET_CFLAGS += $(FPIC)
CONFIGURE_ARGS += \
--enable-static \
--enable-shared \
define Build/InstallDev
$(INSTALL_DIR) $(1)/usr/include/libnetfilter_cthelper
$(CP) \
$(PKG_INSTALL_DIR)/usr/include/libnetfilter_cthelper/*.h \
$(1)/usr/include/libnetfilter_cthelper/
$(INSTALL_DIR) $(1)/usr/lib
$(CP) \
$(PKG_INSTALL_DIR)/usr/lib/libnetfilter_cthelper.{so*,a,la} \
$(1)/usr/lib/
$(INSTALL_DIR) $(1)/usr/lib/pkgconfig
$(CP) \
$(PKG_INSTALL_DIR)/usr/lib/pkgconfig/libnetfilter_cthelper.pc \
$(1)/usr/lib/pkgconfig/
endef
define Package/libnetfilter-cthelper/install
$(INSTALL_DIR) $(1)/usr/lib
$(CP) \
$(PKG_INSTALL_DIR)/usr/lib/libnetfilter_cthelper.so.* \
$(1)/usr/lib/
endef
$(eval $(call BuildPackage,libnetfilter-cthelper))

View File

@ -1,72 +0,0 @@
#
# Copyright (C) 2009-2013 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
PKG_NAME:=libnetfilter_cttimeout
PKG_VERSION:=1.0.0
PKG_RELEASE:=2
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
PKG_SOURCE_URL:= \
http://www.netfilter.org/projects/libnetfilter_cttimeout/files/ \
ftp://ftp.netfilter.org/pub/libnetfilter_cttimeout/
PKG_HASH:=aeab12754f557cba3ce2950a2029963d817490df7edb49880008b34d7ff8feba
PKG_FIXUP:=autoreconf
PKG_LICENSE:=GPL-2.0+
PKG_INSTALL:=1
include $(INCLUDE_DIR)/package.mk
define Package/libnetfilter-cttimeout
SECTION:=libs
CATEGORY:=Libraries
DEPENDS:=+libmnl
TITLE:=API to the in-kernel connection tracking timeout infrastructure
URL:=http://www.netfilter.org/projects/libnetfilter_cttimeout/
ABI_VERSION:=1
endef
define Package/libnetfilter-cttimeout/description
libnetfilter_cttimeout is a userspace library providing a programming
interface (API) to the in-kernel connection tracking timeout handling.
This library is currently used by conntrack-tools.
endef
TARGET_CFLAGS += $(FPIC)
CONFIGURE_ARGS += \
--enable-static \
--enable-shared \
define Build/InstallDev
$(INSTALL_DIR) $(1)/usr/include/libnetfilter_cttimeout
$(CP) \
$(PKG_INSTALL_DIR)/usr/include/libnetfilter_cttimeout/*.h \
$(1)/usr/include/libnetfilter_cttimeout/
$(INSTALL_DIR) $(1)/usr/lib
$(CP) \
$(PKG_INSTALL_DIR)/usr/lib/libnetfilter_cttimeout.{so*,a,la} \
$(1)/usr/lib/
$(INSTALL_DIR) $(1)/usr/lib/pkgconfig
$(CP) \
$(PKG_INSTALL_DIR)/usr/lib/pkgconfig/libnetfilter_cttimeout.pc \
$(1)/usr/lib/pkgconfig/
endef
define Package/libnetfilter-cttimeout/install
$(INSTALL_DIR) $(1)/usr/lib
$(CP) \
$(PKG_INSTALL_DIR)/usr/lib/libnetfilter_cttimeout.so.* \
$(1)/usr/lib/
endef
$(eval $(call BuildPackage,libnetfilter-cttimeout))

View File

@ -1,75 +0,0 @@
#
# Copyright (C) 2014 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
PKG_NAME:=libnetfilter_log
PKG_VERSION:=1.0.1
PKG_RELEASE:=3
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
PKG_SOURCE_URL:= \
http://www.netfilter.org/projects/libnetfilter_log/files/ \
ftp://ftp.netfilter.org/pub/libnetfilter_log/
PKG_HASH:=74e0fe75753dba3ac114531b5e73240452c789a3f3adccf5c51217da1d933b21
PKG_MAINTAINER:=Yousong Zhou <yszhou4tech@gmail.com>
PKG_FIXUP:=autoreconf
PKG_LICENSE:=GPL-2.0+
PKG_INSTALL:=1
include $(INCLUDE_DIR)/package.mk
define Package/libnetfilter-log
SECTION:=libs
CATEGORY:=Libraries
DEPENDS:=+libnfnetlink +kmod-nfnetlink-log +libmnl
TITLE:=API to receive to-be-logged packets from the kernel nfnetlink_log subsystem
URL:=http://www.netfilter.org/projects/libnetfilter_log/
ABI_VERSION:=1
endef
define Package/libnetfilter-log/description
libnetfilter_log is a userspace library providing interface to packets that
have been logged by the kernel packet filter. It is is part of a system that
deprecates the old syslog/dmesg based packet logging. This library has been
previously known as libnfnetlink_log.
endef
TARGET_CFLAGS += $(FPIC)
CONFIGURE_ARGS += \
--enable-static \
--enable-shared \
--without-ipulog \
define Build/InstallDev
$(INSTALL_DIR) $(1)/usr/include/libnetfilter_log
$(CP) \
$(PKG_INSTALL_DIR)/usr/include/libnetfilter_log/*.h \
$(1)/usr/include/libnetfilter_log/
$(INSTALL_DIR) $(1)/usr/lib
$(CP) \
$(PKG_INSTALL_DIR)/usr/lib/libnetfilter_log.{so*,a,la} \
$(1)/usr/lib/
$(INSTALL_DIR) $(1)/usr/lib/pkgconfig
$(CP) \
$(PKG_INSTALL_DIR)/usr/lib/pkgconfig/libnetfilter_log.pc \
$(1)/usr/lib/pkgconfig/
endef
define Package/libnetfilter-log/install
$(INSTALL_DIR) $(1)/usr/lib
$(CP) \
$(PKG_INSTALL_DIR)/usr/lib/libnetfilter_log.so.* \
$(1)/usr/lib/
endef
$(eval $(call BuildPackage,libnetfilter-log))

View File

@ -1,25 +0,0 @@
From 8858b8eacd1385f99796ead78b3a7157c5e93121 Mon Sep 17 00:00:00 2001
From: Jan Engelhardt <jengelh@inai.de>
Date: Sun, 24 Jun 2012 14:57:14 +0200
Subject: [PATCH 1/6] build: remove unnecessary pkgconfig->config.status
dependency
The flags obtained from pkgconfig are in essence preprocessor ones.
Signed-off-by: Jan Engelhardt <jengelh@inai.de>
---
Make_global.am | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/Make_global.am b/Make_global.am
index b7dab7b..a4e9bd9 100644
--- a/Make_global.am
+++ b/Make_global.am
@@ -1,2 +1,2 @@
-AM_CPPFLAGS = -I${top_srcdir}/include
-AM_CFLAGS = -Wall ${LIBNFNETLINK_CFLAGS}
+AM_CPPFLAGS = -I${top_srcdir}/include ${LIBNFNETLINK_CFLAGS}
+AM_CFLAGS = -Wall
--
1.7.10.4

View File

@ -1,24 +0,0 @@
From fee63b81ee432d0b3e03ffcf9f54cda99476f267 Mon Sep 17 00:00:00 2001
From: Jan Engelhardt <jengelh@inai.de>
Date: Sun, 24 Jun 2012 14:57:48 +0200
Subject: [PATCH 2/6] build: remove unused lines in Makefile.am
Signed-off-by: Jan Engelhardt <jengelh@inai.de>
---
Makefile.am | 2 --
1 file changed, 2 deletions(-)
diff --git a/Makefile.am b/Makefile.am
index b758e56..9a1cbcb 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,6 +1,4 @@
-AM_CPPFLAGS = -I$(top_srcdir)/include
SUBDIRS = include src utils
-LINKOPTS = -lnfnetlink
ACLOCAL_AMFLAGS = -I m4
--
1.7.10.4

View File

@ -1,29 +0,0 @@
From 1aa23946431ac593568ccac0e0b6925e7dfd7bd3 Mon Sep 17 00:00:00 2001
From: Jan Engelhardt <jengelh@inai.de>
Date: Mon, 8 Oct 2012 15:15:07 +0200
Subject: [PATCH 3/6] build: resolve automake-1.12 warnings
am/ltlibrary.am: warning: 'libnetfilter_log.la': linking libtool
libraries using a non-POSIX archiver requires 'AM_PROG_AR' in
'configure.ac'
Signed-off-by: Jan Engelhardt <jengelh@inai.de>
---
configure.ac | 1 +
1 file changed, 1 insertion(+)
diff --git a/configure.ac b/configure.ac
index fe6e75f..e6e1317 100644
--- a/configure.ac
+++ b/configure.ac
@@ -7,6 +7,7 @@ AC_CONFIG_MACRO_DIR([m4])
AM_INIT_AUTOMAKE([-Wall foreign subdir-objects
tar-pax no-dist-gzip dist-bzip2 1.6])
+m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
dnl kernel style compile messages
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
--
1.7.10.4

View File

@ -1,24 +0,0 @@
From 7529487f70e244cd31ef84b037b1c32749c134a7 Mon Sep 17 00:00:00 2001
From: Eric Leblond <eric@regit.org>
Date: Sun, 4 Nov 2012 09:29:44 +0100
Subject: [PATCH 4/6] Add include needed for integer type definition.
---
include/libnetfilter_log/libnetfilter_log.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/include/libnetfilter_log/libnetfilter_log.h b/include/libnetfilter_log/libnetfilter_log.h
index 6b0d3b0..a1331de 100644
--- a/include/libnetfilter_log/libnetfilter_log.h
+++ b/include/libnetfilter_log/libnetfilter_log.h
@@ -9,6 +9,7 @@
#ifndef __LIBNETFILTER_LOG_H
#define __LIBNETFILTER_LOG_H
+#include <sys/types.h>
#include <libnetfilter_log/linux_nfnetlink_log.h>
struct nflog_handle;
--
1.7.10.4

View File

@ -1,27 +0,0 @@
From 2f22d3c4453135c27873b9014e9dc5b5712804df Mon Sep 17 00:00:00 2001
From: Gustavo Zacarias <gustavo@zacarias.com.ar>
Date: Tue, 10 Sep 2013 16:23:31 -0300
Subject: [PATCH 5/6] configure: uclinux is also linux
Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
configure.ac | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/configure.ac b/configure.ac
index e6e1317..189a753 100644
--- a/configure.ac
+++ b/configure.ac
@@ -20,7 +20,7 @@ AC_PROG_INSTALL
AC_PROG_LN_S
case "$host" in
-*-*-linux*) ;;
+*-*-linux* | *-*-uclinux*) ;;
*) AC_MSG_ERROR([Linux only, dude!]);;
esac
--
1.7.10.4

View File

@ -1,95 +0,0 @@
From a1b392b4156db984ab2b695a4a70d113f70cb9b8 Mon Sep 17 00:00:00 2001
From: Matthieu Crapet <Matthieu.Crapet@ingenico.com>
Date: Wed, 5 Feb 2014 14:18:57 +0100
Subject: [PATCH 6/6] configure: add --without-ipulog option to disable
libipulog build
This is a compat library used for netfilter ULOG target.
ULOG only works with IPv4. NFLOG has replaced ULOG.
Signed-off-by: Matthieu Crapet <Matthieu.Crapet@ingenico.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
configure.ac | 5 +++++
include/libnetfilter_log/Makefile.am | 5 ++++-
src/Makefile.am | 6 +++++-
utils/Makefile.am | 7 +++++--
4 files changed, 19 insertions(+), 4 deletions(-)
diff --git a/configure.ac b/configure.ac
index 189a753..88ff7ab 100644
--- a/configure.ac
+++ b/configure.ac
@@ -24,6 +24,11 @@ case "$host" in
*) AC_MSG_ERROR([Linux only, dude!]);;
esac
+AC_ARG_WITH([ipulog],
+ AC_HELP_STRING([--without-ipulog], [don't build libipulog compat library]),
+ [ipulog_skip=1], [ipulog_skip=0])
+AM_CONDITIONAL([BUILD_IPULOG], [test $ipulog_skip = 0])
+
dnl Dependencies
PKG_CHECK_MODULES([LIBNFNETLINK], [libnfnetlink >= 0.0.41])
diff --git a/include/libnetfilter_log/Makefile.am b/include/libnetfilter_log/Makefile.am
index fe934f1..fde1d60 100644
--- a/include/libnetfilter_log/Makefile.am
+++ b/include/libnetfilter_log/Makefile.am
@@ -1,3 +1,6 @@
-pkginclude_HEADERS = libnetfilter_log.h libipulog.h linux_nfnetlink_log.h
+pkginclude_HEADERS = libnetfilter_log.h linux_nfnetlink_log.h
+if BUILD_IPULOG
+pkginclude_HEADERS += libipulog.h
+endif
diff --git a/src/Makefile.am b/src/Makefile.am
index 10a66e2..33933a4 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -22,14 +22,18 @@ LIBVERSION=2:0:1
include ${top_srcdir}/Make_global.am
-lib_LTLIBRARIES = libnetfilter_log.la libnetfilter_log_libipulog.la
+lib_LTLIBRARIES = libnetfilter_log.la
libnetfilter_log_la_LDFLAGS = -Wc,-nostartfiles -lnfnetlink \
-version-info $(LIBVERSION)
libnetfilter_log_la_SOURCES = libnetfilter_log.c
libnetfilter_log_la_LIBADD = ${LIBNFNETLINK_LIBS}
+if BUILD_IPULOG
+lib_LTLIBRARIES += libnetfilter_log_libipulog.la
+
libnetfilter_log_libipulog_la_LDFLAGS = -Wc,-nostartfiles \
-version-info 1:0:0
libnetfilter_log_libipulog_la_LIBADD = libnetfilter_log.la
libnetfilter_log_libipulog_la_SOURCES = libipulog_compat.c
+endif
diff --git a/utils/Makefile.am b/utils/Makefile.am
index ae64c90..f961b6c 100644
--- a/utils/Makefile.am
+++ b/utils/Makefile.am
@@ -1,12 +1,15 @@
include ${top_srcdir}/Make_global.am
-check_PROGRAMS = nfulnl_test ulog_test
+check_PROGRAMS = nfulnl_test
nfulnl_test_SOURCES = nfulnl_test.c
nfulnl_test_LDADD = ../src/libnetfilter_log.la
nfulnl_test_LDFLAGS = -dynamic
+if BUILD_IPULOG
+check_PROGRAMS += ulog_test
+
ulog_test_SOURCES = ulog_test.c
ulog_test_LDADD = ../src/libnetfilter_log_libipulog.la ../src/libnetfilter_log.la
ulog_test_LDFLAGS = -dynamic
-
+endif
--
1.7.10.4

View File

@ -1,108 +0,0 @@
From 614d8b6cfb969c6102ef320de22b1eb199efce2a Mon Sep 17 00:00:00 2001
From: Felix Janda <felix.janda@posteo.de>
Date: Sat, 16 May 2015 13:37:53 +0200
Subject: include: Sync with current kernel headers
Signed-off-by: Felix Janda <felix.janda@posteo.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
include/libnetfilter_log/linux_nfnetlink_log.h | 51 +++++++++++++-------------
1 file changed, 25 insertions(+), 26 deletions(-)
diff --git a/include/libnetfilter_log/linux_nfnetlink_log.h b/include/libnetfilter_log/linux_nfnetlink_log.h
index 4c802c8..9f38277 100644
--- a/include/libnetfilter_log/linux_nfnetlink_log.h
+++ b/include/libnetfilter_log/linux_nfnetlink_log.h
@@ -20,33 +20,31 @@ enum nfulnl_msg_types {
};
struct nfulnl_msg_packet_hdr {
- u_int16_t hw_protocol; /* hw protocol (network order) */
- u_int8_t hook; /* netfilter hook */
- u_int8_t _pad;
-} __attribute__ ((packed));
+ __be16 hw_protocol; /* hw protocol (network order) */
+ __u8 hook; /* netfilter hook */
+ __u8 _pad;
+};
struct nfulnl_msg_packet_hw {
- u_int16_t hw_addrlen;
- u_int16_t _pad;
- u_int8_t hw_addr[8];
-} __attribute__ ((packed));
+ __be16 hw_addrlen;
+ __u16 _pad;
+ __u8 hw_addr[8];
+};
struct nfulnl_msg_packet_timestamp {
- aligned_u64 sec;
- aligned_u64 usec;
-} __attribute__ ((packed));
-
-#define NFULNL_PREFIXLEN 30 /* just like old log target */
+ __aligned_be64 sec;
+ __aligned_be64 usec;
+};
enum nfulnl_attr_type {
NFULA_UNSPEC,
NFULA_PACKET_HDR,
- NFULA_MARK, /* u_int32_t nfmark */
+ NFULA_MARK, /* __u32 nfmark */
NFULA_TIMESTAMP, /* nfulnl_msg_packet_timestamp */
- NFULA_IFINDEX_INDEV, /* u_int32_t ifindex */
- NFULA_IFINDEX_OUTDEV, /* u_int32_t ifindex */
- NFULA_IFINDEX_PHYSINDEV, /* u_int32_t ifindex */
- NFULA_IFINDEX_PHYSOUTDEV, /* u_int32_t ifindex */
+ NFULA_IFINDEX_INDEV, /* __u32 ifindex */
+ NFULA_IFINDEX_OUTDEV, /* __u32 ifindex */
+ NFULA_IFINDEX_PHYSINDEV, /* __u32 ifindex */
+ NFULA_IFINDEX_PHYSOUTDEV, /* __u32 ifindex */
NFULA_HWADDR, /* nfulnl_msg_packet_hw */
NFULA_PAYLOAD, /* opaque data payload */
NFULA_PREFIX, /* string prefix */
@@ -71,23 +69,23 @@ enum nfulnl_msg_config_cmds {
};
struct nfulnl_msg_config_cmd {
- u_int8_t command; /* nfulnl_msg_config_cmds */
+ __u8 command; /* nfulnl_msg_config_cmds */
} __attribute__ ((packed));
struct nfulnl_msg_config_mode {
- u_int32_t copy_range;
- u_int8_t copy_mode;
- u_int8_t _pad;
+ __be32 copy_range;
+ __u8 copy_mode;
+ __u8 _pad;
} __attribute__ ((packed));
enum nfulnl_attr_config {
NFULA_CFG_UNSPEC,
NFULA_CFG_CMD, /* nfulnl_msg_config_cmd */
NFULA_CFG_MODE, /* nfulnl_msg_config_mode */
- NFULA_CFG_NLBUFSIZ, /* u_int32_t buffer size */
- NFULA_CFG_TIMEOUT, /* u_int32_t in 1/100 s */
- NFULA_CFG_QTHRESH, /* u_int32_t */
- NFULA_CFG_FLAGS, /* u_int16_t */
+ NFULA_CFG_NLBUFSIZ, /* __u32 buffer size */
+ NFULA_CFG_TIMEOUT, /* __u32 in 1/100 s */
+ NFULA_CFG_QTHRESH, /* __u32 */
+ NFULA_CFG_FLAGS, /* __u16 */
__NFULA_CFG_MAX
};
#define NFULA_CFG_MAX (__NFULA_CFG_MAX -1)
@@ -95,6 +93,7 @@ enum nfulnl_attr_config {
#define NFULNL_COPY_NONE 0x00
#define NFULNL_COPY_META 0x01
#define NFULNL_COPY_PACKET 0x02
+/* 0xff is reserved, don't use it for new copy modes. */
#define NFULNL_CFG_F_SEQ 0x0001
#define NFULNL_CFG_F_SEQ_GLOBAL 0x0002
--
2.11.0

View File

@ -1,52 +0,0 @@
From 721ea5ec049e12afdd7c182f2899ab6d92914e68 Mon Sep 17 00:00:00 2001
From: Ken-ichirou MATSUZAWA <chamaken@gmail.com>
Date: Fri, 11 Sep 2015 12:12:11 +0900
Subject: include: Sync with kernel headers
Signed-off-by: Ken-ichirou MATSUZAWA <chamas@h4.dion.ne.jp>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
include/libnetfilter_log/linux_nfnetlink_log.h | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/include/libnetfilter_log/linux_nfnetlink_log.h b/include/libnetfilter_log/linux_nfnetlink_log.h
index 9f38277..081e7f9 100644
--- a/include/libnetfilter_log/linux_nfnetlink_log.h
+++ b/include/libnetfilter_log/linux_nfnetlink_log.h
@@ -1,16 +1,12 @@
#ifndef _NFNETLINK_LOG_H
#define _NFNETLINK_LOG_H
-#ifndef aligned_u64
-#define aligned_u64 unsigned long long __attribute__((aligned(8)))
-#endif
-
/* This file describes the netlink messages (i.e. 'protocol packets'),
* and not any kind of function definitions. It is shared between kernel and
* userspace. Don't put kernel specific stuff in here */
#include <linux/types.h>
-#include <libnfnetlink/linux_nfnetlink.h>
+#include <linux/netfilter/nfnetlink.h>
enum nfulnl_msg_types {
NFULNL_MSG_PACKET, /* packet from kernel to userspace */
@@ -55,6 +51,8 @@ enum nfulnl_attr_type {
NFULA_HWTYPE, /* hardware type */
NFULA_HWHEADER, /* hardware header */
NFULA_HWLEN, /* hardware header length */
+ NFULA_CT, /* nf_conntrack_netlink.h */
+ NFULA_CT_INFO, /* enum ip_conntrack_info */
__NFULA_MAX
};
@@ -97,5 +95,6 @@ enum nfulnl_attr_config {
#define NFULNL_CFG_F_SEQ 0x0001
#define NFULNL_CFG_F_SEQ_GLOBAL 0x0002
+#define NFULNL_CFG_F_CONNTRACK 0x0004
#endif /* _NFNETLINK_LOG_H */
--
2.11.0

View File

@ -1,71 +0,0 @@
#
# Copyright (C) 2009-2013 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
PKG_NAME:=libnetfilter_queue
PKG_RELEASE:=2
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL=https://git.netfilter.org/libnetfilter_queue
PKG_SOURCE_DATE:=2017-06-27
PKG_SOURCE_VERSION:=601abd1c71ccdf90753cf294c120ad43fb25dc54
PKG_MIRROR_HASH:=283b99cfe5856dc87fd6bab8f78c0c59b72462d6b4f2b13111f928cf33020eb3
PKG_FIXUP:=autoreconf
PKG_LICENSE:=GPL-2.0+
PKG_INSTALL:=1
include $(INCLUDE_DIR)/package.mk
define Package/libnetfilter-queue
SECTION:=libs
CATEGORY:=Libraries
DEPENDS:=+libmnl +libnfnetlink
TITLE:=Userspace API to packets queued by kernel packet filter
URL:=http://www.netfilter.org/projects/libnetfilter_queue/
ABI_VERSION:=1
endef
define Package/libnetfilter-queue/description
libnetfilter_queue is a userspace library providing a programming
interface (API) to packets that have been queued by the kernel
packet filter.
endef
TARGET_CFLAGS += $(FPIC) -D_GNU_SOURCE=1
CONFIGURE_ARGS += \
--enable-static \
--enable-shared \
define Build/InstallDev
$(INSTALL_DIR) $(1)/usr/include/libnetfilter_queue
$(CP) \
$(PKG_INSTALL_DIR)/usr/include/libnetfilter_queue/*.h \
$(1)/usr/include/libnetfilter_queue/
$(INSTALL_DIR) $(1)/usr/lib
$(CP) \
$(PKG_INSTALL_DIR)/usr/lib/libnetfilter_queue.{so*,a,la} \
$(1)/usr/lib/
$(INSTALL_DIR) $(1)/usr/lib/pkgconfig
$(CP) \
$(PKG_INSTALL_DIR)/usr/lib/pkgconfig/libnetfilter_queue.pc \
$(1)/usr/lib/pkgconfig/
endef
define Package/libnetfilter-queue/install
$(INSTALL_DIR) $(1)/usr/lib
$(CP) \
$(PKG_INSTALL_DIR)/usr/lib/libnetfilter_queue.so.* \
$(1)/usr/lib/
endef
$(eval $(call BuildPackage,libnetfilter-queue))

View File

@ -1,113 +0,0 @@
--- a/src/extra/checksum.c
+++ b/src/extra/checksum.c
@@ -11,6 +11,7 @@
#include <stdio.h>
#include <stdbool.h>
+#include <endian.h>
#include <arpa/inet.h>
#include <netinet/ip.h>
#include <netinet/ip6.h>
@@ -26,8 +27,13 @@ uint16_t nfq_checksum(uint32_t sum, uint
sum += *buf++;
size -= sizeof(uint16_t);
}
- if (size)
- sum += *(uint8_t *)buf;
+ if (size) {
+#if __BYTE_ORDER == __BIG_ENDIAN
+ sum += (uint16_t)*(uint8_t *)buf << 8;
+#else
+ sum += (uint16_t)*(uint8_t *)buf;
+#endif
+ }
sum = (sum >> 16) + (sum & 0xffff);
sum += (sum >>16);
@@ -35,7 +41,7 @@ uint16_t nfq_checksum(uint32_t sum, uint
return (uint16_t)(~sum);
}
-uint16_t nfq_checksum_tcpudp_ipv4(struct iphdr *iph)
+uint16_t nfq_checksum_tcpudp_ipv4(struct iphdr *iph, uint16_t protocol_id)
{
uint32_t sum = 0;
uint32_t iph_len = iph->ihl*4;
@@ -46,13 +52,13 @@ uint16_t nfq_checksum_tcpudp_ipv4(struct
sum += (iph->saddr) & 0xFFFF;
sum += (iph->daddr >> 16) & 0xFFFF;
sum += (iph->daddr) & 0xFFFF;
- sum += htons(IPPROTO_TCP);
+ sum += htons(protocol_id);
sum += htons(len);
return nfq_checksum(sum, (uint16_t *)payload, len);
}
-uint16_t nfq_checksum_tcpudp_ipv6(struct ip6_hdr *ip6h, void *transport_hdr)
+uint16_t nfq_checksum_tcpudp_ipv6(struct ip6_hdr *ip6h, void *transport_hdr, uint16_t protocol_id)
{
uint32_t sum = 0;
uint32_t hdr_len = (uint32_t *)transport_hdr - (uint32_t *)ip6h;
@@ -68,7 +74,7 @@ uint16_t nfq_checksum_tcpudp_ipv6(struct
sum += (ip6h->ip6_dst.s6_addr16[i] >> 16) & 0xFFFF;
sum += (ip6h->ip6_dst.s6_addr16[i]) & 0xFFFF;
}
- sum += htons(IPPROTO_TCP);
+ sum += htons(protocol_id);
sum += htons(ip6h->ip6_plen);
return nfq_checksum(sum, (uint16_t *)payload, len);
--- a/src/extra/tcp.c
+++ b/src/extra/tcp.c
@@ -96,7 +96,7 @@ nfq_tcp_compute_checksum_ipv4(struct tcp
{
/* checksum field in header needs to be zero for calculation. */
tcph->check = 0;
- tcph->check = nfq_checksum_tcpudp_ipv4(iph);
+ tcph->check = nfq_checksum_tcpudp_ipv4(iph, IPPROTO_TCP);
}
EXPORT_SYMBOL(nfq_tcp_compute_checksum_ipv4);
@@ -110,7 +110,7 @@ nfq_tcp_compute_checksum_ipv6(struct tcp
{
/* checksum field in header needs to be zero for calculation. */
tcph->check = 0;
- tcph->check = nfq_checksum_tcpudp_ipv6(ip6h, tcph);
+ tcph->check = nfq_checksum_tcpudp_ipv6(ip6h, tcph, IPPROTO_TCP);
}
EXPORT_SYMBOL(nfq_tcp_compute_checksum_ipv6);
--- a/src/extra/udp.c
+++ b/src/extra/udp.c
@@ -96,7 +96,7 @@ nfq_udp_compute_checksum_ipv4(struct udp
{
/* checksum field in header needs to be zero for calculation. */
udph->check = 0;
- udph->check = nfq_checksum_tcpudp_ipv4(iph);
+ udph->check = nfq_checksum_tcpudp_ipv4(iph, IPPROTO_UDP);
}
EXPORT_SYMBOL(nfq_udp_compute_checksum_ipv4);
@@ -115,7 +115,7 @@ nfq_udp_compute_checksum_ipv6(struct udp
{
/* checksum field in header needs to be zero for calculation. */
udph->check = 0;
- udph->check = nfq_checksum_tcpudp_ipv6(ip6h, udph);
+ udph->check = nfq_checksum_tcpudp_ipv6(ip6h, udph, IPPROTO_UDP);
}
EXPORT_SYMBOL(nfq_udp_compute_checksum_ipv6);
--- a/src/internal.h
+++ b/src/internal.h
@@ -15,8 +15,8 @@ struct iphdr;
struct ip6_hdr;
uint16_t nfq_checksum(uint32_t sum, uint16_t *buf, int size);
-uint16_t nfq_checksum_tcpudp_ipv4(struct iphdr *iph);
-uint16_t nfq_checksum_tcpudp_ipv6(struct ip6_hdr *ip6h, void *transport_hdr);
+uint16_t nfq_checksum_tcpudp_ipv4(struct iphdr *iph, uint16_t protocol_id);
+uint16_t nfq_checksum_tcpudp_ipv6(struct ip6_hdr *ip6h, void *transport_hdr, uint16_t protocol_id);
struct pkt_buff {
uint8_t *mac_header;

View File

@ -292,6 +292,7 @@ HOSTCXX_NOCACHE:=$(HOSTCXX)
export TARGET_CC_NOCACHE
export TARGET_CXX_NOCACHE
export HOSTCC_NOCACHE
export HOSTCXX_NOCACHE
ifneq ($(CONFIG_CCACHE),)
TARGET_CC:= ccache_cc