From 64b2ea45cadc8cfcd95d4520ba436c05dc16c2b4 Mon Sep 17 00:00:00 2001 From: Huang Xin Date: Tue, 14 Jun 2022 09:42:29 -0700 Subject: [PATCH] add iptables 1.8.7 --- ...ile.am-do-not-install-etc-ethertypes.patch | 40 +++++++++++++++ ...ption-to-enable-disable-libnfnetlink.patch | 47 +++++++++++++++++ ...-conntrack-when-libnfnetlink-enabled.patch | 51 +++++++++++++++++++ .../iptables/iptables/ip6tables.rules | 0 .../iptables/iptables/ip6tables.service | 13 +++++ .../iptables/iptables/iptables.rules | 0 .../iptables/iptables/iptables.service | 13 +++++ .../iptables/iptables_1.8.7.bb | 44 ++++++++++++++++ 8 files changed, 208 insertions(+) create mode 100644 meta/meta-mediatek-aud/recipes-support/iptables/iptables/0001-Makefile.am-do-not-install-etc-ethertypes.patch create mode 100644 meta/meta-mediatek-aud/recipes-support/iptables/iptables/0001-configure-Add-option-to-enable-disable-libnfnetlink.patch create mode 100644 meta/meta-mediatek-aud/recipes-support/iptables/iptables/0002-configure.ac-only-check-conntrack-when-libnfnetlink-enabled.patch create mode 100644 meta/meta-mediatek-aud/recipes-support/iptables/iptables/ip6tables.rules create mode 100644 meta/meta-mediatek-aud/recipes-support/iptables/iptables/ip6tables.service create mode 100644 meta/meta-mediatek-aud/recipes-support/iptables/iptables/iptables.rules create mode 100644 meta/meta-mediatek-aud/recipes-support/iptables/iptables/iptables.service create mode 100644 meta/meta-mediatek-aud/recipes-support/iptables/iptables_1.8.7.bb diff --git a/meta/meta-mediatek-aud/recipes-support/iptables/iptables/0001-Makefile.am-do-not-install-etc-ethertypes.patch b/meta/meta-mediatek-aud/recipes-support/iptables/iptables/0001-Makefile.am-do-not-install-etc-ethertypes.patch new file mode 100644 index 000000000..aa5126582 --- /dev/null +++ b/meta/meta-mediatek-aud/recipes-support/iptables/iptables/0001-Makefile.am-do-not-install-etc-ethertypes.patch @@ -0,0 +1,40 @@ +From a4ed9fc8da720585f853d2ca6ffd30e2fa4d1247 Mon Sep 17 00:00:00 2001 +From: Trevor Gamblin +Date: Wed, 9 Mar 2022 12:50:39 -0500 +Subject: [PATCH] Makefile.am: do not install /etc/ethertypes + +The /etc/ethertypes is provided by netbase since 6.0[1]. +Do not instal the file in ebtables, otherwise there would be a conflict: +Error: Transaction test error: + file /etc/ethertypes conflicts between attempted installs of +netbase-1:6.2-r0.corei7_64 and iptables-1.8.7-r0.corei7_64 + +[1] +https://salsa.debian.org/md/netbase/-/commit/316680c6a2c3641b6abc76b3eebf88781f609d35) + +This patch is based off of the same change made for the ebtables recipe: + +http://cgit.openembedded.org/meta-openembedded/tree/meta-networking/recipes-filter/ebtables/ebtables-2.0.11/0001-Makefile.am-do-not-install-etc-ethertypes.patch?h=master + +Upstream-Status: Inappropriate [embedded specific] + +Signed-off-by: Trevor Gamblin +--- + Makefile.am | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/Makefile.am b/Makefile.am +index 799bf8b8..2eb1843f 100644 +--- a/Makefile.am ++++ b/Makefile.am +@@ -18,7 +18,6 @@ SUBDIRS += iptables + + if ENABLE_NFTABLES + confdir = $(sysconfdir) +-dist_conf_DATA = etc/ethertypes + endif + + .PHONY: tarball +-- +2.35.1 + diff --git a/meta/meta-mediatek-aud/recipes-support/iptables/iptables/0001-configure-Add-option-to-enable-disable-libnfnetlink.patch b/meta/meta-mediatek-aud/recipes-support/iptables/iptables/0001-configure-Add-option-to-enable-disable-libnfnetlink.patch new file mode 100644 index 000000000..03c36ccbc --- /dev/null +++ b/meta/meta-mediatek-aud/recipes-support/iptables/iptables/0001-configure-Add-option-to-enable-disable-libnfnetlink.patch @@ -0,0 +1,47 @@ +From c46db7c2e1f63ec525835553587e70c635565310 Mon Sep 17 00:00:00 2001 +From: "Maxin B. John" +Date: Tue, 21 Feb 2017 11:16:31 +0200 +Subject: [PATCH] configure: Add option to enable/disable libnfnetlink + +This changes the configure behaviour from autodetecting +for libnfnetlink to having an option to disable it explicitly + +Upstream-Status: Pending + +Signed-off-by: Khem Raj +Signed-off-by: Maxin B. John +--- + configure.ac | 10 +++++++--- + 1 file changed, 7 insertions(+), 3 deletions(-) + +diff --git a/configure.ac b/configure.ac +index eda7871..03ddc50 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -63,6 +63,9 @@ AC_ARG_WITH([pkgconfigdir], AS_HELP_STRING([--with-pkgconfigdir=PATH], + AC_ARG_ENABLE([nftables], + AS_HELP_STRING([--disable-nftables], [Do not build nftables compat]), + [enable_nftables="$enableval"], [enable_nftables="yes"]) ++AC_ARG_ENABLE([libnfnetlink], ++ AS_HELP_STRING([--disable-libnfnetlink], [Do not use netfilter netlink library]), ++ [enable_libnfnetlink="$enableval"], [enable_libnfnetlink="yes"]) + AC_ARG_ENABLE([connlabel], + AS_HELP_STRING([--disable-connlabel], + [Do not build libnetfilter_conntrack]), +@@ -115,9 +118,10 @@ if test "x$enable_bpfc" = "xyes" || test "x$enable_nfsynproxy" = "xyes"; then + AC_CHECK_LIB(pcap, pcap_compile,, AC_MSG_ERROR(missing libpcap library required by bpf compiler or nfsynproxy tool)) + fi + +-PKG_CHECK_MODULES([libnfnetlink], [libnfnetlink >= 1.0], +- [nfnetlink=1], [nfnetlink=0]) +-AM_CONDITIONAL([HAVE_LIBNFNETLINK], [test "$nfnetlink" = 1]) ++AS_IF([test "x$enable_libnfnetlink" = "xyes"], [ ++ PKG_CHECK_MODULES([libnfnetlink], [libnfnetlink >= 1.0]) ++ ]) ++AM_CONDITIONAL([HAVE_LIBNFNETLINK], [test "x$enable_libnfnetlink" = "xyes"]) + + if test "x$enable_nftables" = "xyes"; then + PKG_CHECK_MODULES([libmnl], [libmnl >= 1.0], [mnl=1], [mnl=0]) +-- +2.4.0 + diff --git a/meta/meta-mediatek-aud/recipes-support/iptables/iptables/0002-configure.ac-only-check-conntrack-when-libnfnetlink-enabled.patch b/meta/meta-mediatek-aud/recipes-support/iptables/iptables/0002-configure.ac-only-check-conntrack-when-libnfnetlink-enabled.patch new file mode 100644 index 000000000..7842c6408 --- /dev/null +++ b/meta/meta-mediatek-aud/recipes-support/iptables/iptables/0002-configure.ac-only-check-conntrack-when-libnfnetlink-enabled.patch @@ -0,0 +1,51 @@ +From 26090b3dbcdf6a11e60535da949b726a6e86426d Mon Sep 17 00:00:00 2001 +From: "Maxin B. John" +Date: Tue, 21 Feb 2017 11:49:07 +0200 +Subject: [PATCH] configure.ac: + only-check-conntrack-when-libnfnetlink-enabled.patch + +Package libnetfilter-conntrack depends on package libnfnetlink. iptables +checks package libnetfilter-conntrack whatever its package config +libnfnetlink is enabled or not. When libnfnetlink is disabled but +package libnetfilter-conntrack exists, it fails randomly with: + +In file included from +.../iptables/1.4.21-r0/iptables-1.4.21/extensions/libxt_connlabel.c:8:0: + +.../tmp/sysroots/qemumips/usr/include/libnetfilter_conntrack/libnetfilter_conntrack.h:14:42: +fatal error: libnfnetlink/linux_nfnetlink.h: No such file or directory + +compilation terminated. +GNUmakefile:96: recipe for target 'libxt_connlabel.oo' failed +Only check libnetfilter-conntrack when libnfnetlink is enabled to fix it. + +Upstream-Status: Pending + +Signed-off-by: Kai Kang +Signed-off-by: Maxin B. John +--- + configure.ac | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +diff --git a/configure.ac b/configure.ac +index 03ddc50..523caea 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -172,10 +172,12 @@ if test "$nftables" != 1; then + fi + + if test "x$enable_connlabel" = "xyes"; then +- PKG_CHECK_MODULES([libnetfilter_conntrack], ++ nfconntrack=0 ++ AS_IF([test "x$enable_libnfnetlink" = "xyes"], [ ++ PKG_CHECK_MODULES([libnetfilter_conntrack], + [libnetfilter_conntrack >= 1.0.6], + [nfconntrack=1], [nfconntrack=0]) +- ++ ]) + if test "$nfconntrack" -ne 1; then + blacklist_modules="$blacklist_modules connlabel"; + echo "WARNING: libnetfilter_conntrack not found, connlabel match will not be built"; +-- +2.4.0 + diff --git a/meta/meta-mediatek-aud/recipes-support/iptables/iptables/ip6tables.rules b/meta/meta-mediatek-aud/recipes-support/iptables/iptables/ip6tables.rules new file mode 100644 index 000000000..e69de29bb diff --git a/meta/meta-mediatek-aud/recipes-support/iptables/iptables/ip6tables.service b/meta/meta-mediatek-aud/recipes-support/iptables/iptables/ip6tables.service new file mode 100644 index 000000000..6c059fca4 --- /dev/null +++ b/meta/meta-mediatek-aud/recipes-support/iptables/iptables/ip6tables.service @@ -0,0 +1,13 @@ +[Unit] +Description=IPv6 Packet Filtering Framework +Before=network-pre.target +Wants=network-pre.target + +[Service] +Type=oneshot +ExecStart=@SBINDIR@/ip6tables-restore -w -- @RULESDIR@/ip6tables.rules +ExecReload=@SBINDIR@/ip6tables-restore -w -- @RULESDIR@/ip6tables.rules +RemainAfterExit=yes + +[Install] +WantedBy=multi-user.target diff --git a/meta/meta-mediatek-aud/recipes-support/iptables/iptables/iptables.rules b/meta/meta-mediatek-aud/recipes-support/iptables/iptables/iptables.rules new file mode 100644 index 000000000..e69de29bb diff --git a/meta/meta-mediatek-aud/recipes-support/iptables/iptables/iptables.service b/meta/meta-mediatek-aud/recipes-support/iptables/iptables/iptables.service new file mode 100644 index 000000000..0eb3c343d --- /dev/null +++ b/meta/meta-mediatek-aud/recipes-support/iptables/iptables/iptables.service @@ -0,0 +1,13 @@ +[Unit] +Description=IPv4 Packet Filtering Framework +Before=network-pre.target +Wants=network-pre.target + +[Service] +Type=oneshot +ExecStart=@SBINDIR@/iptables-restore -w -- @RULESDIR@/iptables.rules +ExecReload=@SBINDIR@/iptables-restore -w -- @RULESDIR@/iptables.rules +RemainAfterExit=yes + +[Install] +WantedBy=multi-user.target diff --git a/meta/meta-mediatek-aud/recipes-support/iptables/iptables_1.8.7.bb b/meta/meta-mediatek-aud/recipes-support/iptables/iptables_1.8.7.bb new file mode 100644 index 000000000..06c97e938 --- /dev/null +++ b/meta/meta-mediatek-aud/recipes-support/iptables/iptables_1.8.7.bb @@ -0,0 +1,44 @@ +SUMMARY = "Tools for managing kernel packet filtering capabilities" +DESCRIPTION = "iptables is the userspace command line program used to configure and control network packet \ +filtering code in Linux." +HOMEPAGE = "http://www.netfilter.org/" +BUGTRACKER = "http://bugzilla.netfilter.org/" +LICENSE = "GPL-2.0-or-later" +LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263 \ + file://iptables/iptables.c;beginline=13;endline=25;md5=c5cffd09974558cf27d0f763df2a12dc \ +" + +SRC_URI = "http://netfilter.org/projects/iptables/files/iptables-${PV}.tar.bz2 \ + file://0001-configure-Add-option-to-enable-disable-libnfnetlink.patch \ + file://0001-Makefile.am-do-not-install-etc-ethertypes.patch \ + file://0002-configure.ac-only-check-conntrack-when-libnfnetlink-enabled.patch \ + file://iptables.service \ + file://iptables.rules \ + file://ip6tables.service \ + file://ip6tables.rules \ + " +SRC_URI[sha256sum] = "c109c96bb04998cd44156622d36f8e04b140701ec60531a10668cfdff5e8d8f0" + +inherit autotools pkgconfig + +EXTRA_OECONF = "--with-kernel=${STAGING_INCDIR} \ + " +PACKAGECONFIG ?= "${@bb.utils.contains('DISTRO_FEATURES', 'ipv6', 'ipv6', '', d)} \ + " + +PACKAGECONFIG[ipv6] = "--enable-ipv6,--disable-ipv6," + +# libnfnetlink recipe is in meta-networking layer +PACKAGECONFIG[libnfnetlink] = "--enable-libnfnetlink,--disable-libnfnetlink,libnfnetlink libnetfilter-conntrack" + +# libnftnl recipe is in meta-networking layer(previously known as libnftables) +PACKAGECONFIG[libnftnl] = "--enable-nftables,--disable-nftables,libnftnl" + +do_configure_prepend() { + # Remove some libtool m4 files + # Keep ax_check_linker_flags.m4 which belongs to autoconf-archive. + rm -f libtool.m4 lt~obsolete.m4 ltoptions.m4 ltsugar.m4 ltversion.m4 +} + +FILES_${PN} += "${libdir}/xtables/*" +INSANE_SKIP_${PN} = "dev-so"