diff mbox series

libnetfilter-conntrack: backport patch fixing compilation with 5.15

Message ID 20220302143859.18656-1-ansuelsmth@gmail.com
State Accepted
Delegated to: Hauke Mehrtens
Headers show
Series libnetfilter-conntrack: backport patch fixing compilation with 5.15 | expand

Commit Message

Christian Marangi March 2, 2022, 2:38 p.m. UTC
Backport patch fixing compilation with 5.15 and musl provided by Robert Marko

Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
---
 package/libs/libnetfilter-conntrack/Makefile  |  2 +-
 ...-fix-build-with-kernel-5_15-and-musl.patch | 56 +++++++++++++++++++
 2 files changed, 57 insertions(+), 1 deletion(-)
 create mode 100644 package/libs/libnetfilter-conntrack/patches/0001-conntrack-fix-build-with-kernel-5_15-and-musl.patch

Comments

Robert Marko March 2, 2022, 2:43 p.m. UTC | #1
On Wed, 2 Mar 2022 at 15:40, Ansuel Smith <ansuelsmth@gmail.com> wrote:
>
> Backport patch fixing compilation with 5.15 and musl provided by Robert Marko

I would prefer just bumping the package version using GIT hash since
its already upstreamed.

Regards
>
> Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
> ---
>  package/libs/libnetfilter-conntrack/Makefile  |  2 +-
>  ...-fix-build-with-kernel-5_15-and-musl.patch | 56 +++++++++++++++++++
>  2 files changed, 57 insertions(+), 1 deletion(-)
>  create mode 100644 package/libs/libnetfilter-conntrack/patches/0001-conntrack-fix-build-with-kernel-5_15-and-musl.patch
>
> diff --git a/package/libs/libnetfilter-conntrack/Makefile b/package/libs/libnetfilter-conntrack/Makefile
> index 0cfb19f1..50432e9c 100644
> --- a/package/libs/libnetfilter-conntrack/Makefile
> +++ b/package/libs/libnetfilter-conntrack/Makefile
> @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
>
>  PKG_NAME:=libnetfilter_conntrack
>  PKG_VERSION:=1.0.9
> -PKG_RELEASE:=1
> +PKG_RELEASE:=2
>
>  PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
>  PKG_SOURCE_URL:=https://www.netfilter.org/projects/libnetfilter_conntrack/files
> diff --git a/package/libs/libnetfilter-conntrack/patches/0001-conntrack-fix-build-with-kernel-5_15-and-musl.patch b/package/libs/libnetfilter-conntrack/patches/0001-conntrack-fix-build-with-kernel-5_15-and-musl.patch
> new file mode 100644
> index 00000000..e21d5da5
> --- /dev/null
> +++ b/package/libs/libnetfilter-conntrack/patches/0001-conntrack-fix-build-with-kernel-5_15-and-musl.patch
> @@ -0,0 +1,56 @@
> +From 21ee35dde73aec5eba35290587d479218c6dd824 Mon Sep 17 00:00:00 2001
> +From: Robert Marko <robimarko@gmail.com>
> +Date: Thu, 24 Feb 2022 15:01:11 +0100
> +Subject: conntrack: fix build with kernel 5.15 and musl
> +
> +Currently, with kernel 5.15 headers and musl building is failing with
> +redefinition errors due to a conflict between the kernel and musl headers.
> +
> +Musl is able to suppres the conflicting kernel header definitions if they
> +are included after the standard libc ones, however since ICMP definitions
> +were moved into a separate internal header to avoid duplication this has
> +stopped working and is breaking the builds.
> +
> +It seems that the issue is that <netinet/in.h> which contains the UAPI
> +suppression defines is included in the internal.h header and not in the
> +proto.h which actually includes the kernel ICMP headers and thus UAPI
> +supression defines are not present.
> +
> +Solve this by moving the <netinet/in.h> include before the ICMP kernel
> +includes in the proto.h
> +
> +Fixes: bc1cb4b11403 ("conntrack: Move icmp request>reply type mapping to common file")
> +Signed-off-by: Robert Marko <robimarko@gmail.com>
> +Signed-off-by: Florian Westphal <fw@strlen.de>
> +---
> + include/internal/internal.h | 1 -
> + include/internal/proto.h    | 1 +
> + 2 files changed, 1 insertion(+), 1 deletion(-)
> +
> +diff --git a/include/internal/internal.h b/include/internal/internal.h
> +index 2ef8a90..7cd7c44 100644
> +--- a/include/internal/internal.h
> ++++ b/include/internal/internal.h
> +@@ -14,7 +14,6 @@
> + #include <arpa/inet.h>
> + #include <time.h>
> + #include <errno.h>
> +-#include <netinet/in.h>
> +
> + #include <libnfnetlink/libnfnetlink.h>
> + #include <libnetfilter_conntrack/libnetfilter_conntrack.h>
> +diff --git a/include/internal/proto.h b/include/internal/proto.h
> +index 40e7bfe..60a5f4e 100644
> +--- a/include/internal/proto.h
> ++++ b/include/internal/proto.h
> +@@ -2,6 +2,7 @@
> + #define _NFCT_PROTO_H_
> +
> + #include <stdint.h>
> ++#include <netinet/in.h>
> + #include <linux/icmp.h>
> + #include <linux/icmpv6.h>
> +
> +--
> +cgit v1.2.3
> +
> --
> 2.34.1
>
>
> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel@lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel
Christian Marangi March 2, 2022, 2:47 p.m. UTC | #2
Il giorno mer 2 mar 2022 alle ore 15:43 Robert Marko
<robimarko@gmail.com> ha scritto:
>
> On Wed, 2 Mar 2022 at 15:40, Ansuel Smith <ansuelsmth@gmail.com> wrote:
> >
> > Backport patch fixing compilation with 5.15 and musl provided by Robert Marko
>
> I would prefer just bumping the package version using GIT hash since
> its already upstreamed.
>
> Regards
> >

Don't know we use versioning with every netfilter package. I think for this kind
of package we use patches and we drop them on the version bump.
The patch is from the upstream netfilter git.
Robert Marko March 2, 2022, 3:02 p.m. UTC | #3
On Wed, 2 Mar 2022 at 15:47, Ansuel Smith <ansuelsmth@gmail.com> wrote:
>
> Il giorno mer 2 mar 2022 alle ore 15:43 Robert Marko
> <robimarko@gmail.com> ha scritto:
> >
> > On Wed, 2 Mar 2022 at 15:40, Ansuel Smith <ansuelsmth@gmail.com> wrote:
> > >
> > > Backport patch fixing compilation with 5.15 and musl provided by Robert Marko
> >
> > I would prefer just bumping the package version using GIT hash since
> > its already upstreamed.
> >
> > Regards
> > >
>
> Don't know we use versioning with every netfilter package. I think for this kind
> of package we use patches and we drop them on the version bump.
> The patch is from the upstream netfilter git.

It could be just me, but I don't like adding patches if they are
already upstreamed.
Anyway, in the end, I am fine with either since it's already upstream.

Regards
diff mbox series

Patch

diff --git a/package/libs/libnetfilter-conntrack/Makefile b/package/libs/libnetfilter-conntrack/Makefile
index 0cfb19f1..50432e9c 100644
--- a/package/libs/libnetfilter-conntrack/Makefile
+++ b/package/libs/libnetfilter-conntrack/Makefile
@@ -9,7 +9,7 @@  include $(TOPDIR)/rules.mk
 
 PKG_NAME:=libnetfilter_conntrack
 PKG_VERSION:=1.0.9
-PKG_RELEASE:=1
+PKG_RELEASE:=2
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
 PKG_SOURCE_URL:=https://www.netfilter.org/projects/libnetfilter_conntrack/files
diff --git a/package/libs/libnetfilter-conntrack/patches/0001-conntrack-fix-build-with-kernel-5_15-and-musl.patch b/package/libs/libnetfilter-conntrack/patches/0001-conntrack-fix-build-with-kernel-5_15-and-musl.patch
new file mode 100644
index 00000000..e21d5da5
--- /dev/null
+++ b/package/libs/libnetfilter-conntrack/patches/0001-conntrack-fix-build-with-kernel-5_15-and-musl.patch
@@ -0,0 +1,56 @@ 
+From 21ee35dde73aec5eba35290587d479218c6dd824 Mon Sep 17 00:00:00 2001
+From: Robert Marko <robimarko@gmail.com>
+Date: Thu, 24 Feb 2022 15:01:11 +0100
+Subject: conntrack: fix build with kernel 5.15 and musl
+
+Currently, with kernel 5.15 headers and musl building is failing with
+redefinition errors due to a conflict between the kernel and musl headers.
+
+Musl is able to suppres the conflicting kernel header definitions if they
+are included after the standard libc ones, however since ICMP definitions
+were moved into a separate internal header to avoid duplication this has
+stopped working and is breaking the builds.
+
+It seems that the issue is that <netinet/in.h> which contains the UAPI
+suppression defines is included in the internal.h header and not in the
+proto.h which actually includes the kernel ICMP headers and thus UAPI
+supression defines are not present.
+
+Solve this by moving the <netinet/in.h> include before the ICMP kernel
+includes in the proto.h
+
+Fixes: bc1cb4b11403 ("conntrack: Move icmp request>reply type mapping to common file")
+Signed-off-by: Robert Marko <robimarko@gmail.com>
+Signed-off-by: Florian Westphal <fw@strlen.de>
+---
+ include/internal/internal.h | 1 -
+ include/internal/proto.h    | 1 +
+ 2 files changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/include/internal/internal.h b/include/internal/internal.h
+index 2ef8a90..7cd7c44 100644
+--- a/include/internal/internal.h
++++ b/include/internal/internal.h
+@@ -14,7 +14,6 @@
+ #include <arpa/inet.h>
+ #include <time.h>
+ #include <errno.h>
+-#include <netinet/in.h>
+ 
+ #include <libnfnetlink/libnfnetlink.h>
+ #include <libnetfilter_conntrack/libnetfilter_conntrack.h>
+diff --git a/include/internal/proto.h b/include/internal/proto.h
+index 40e7bfe..60a5f4e 100644
+--- a/include/internal/proto.h
++++ b/include/internal/proto.h
+@@ -2,6 +2,7 @@
+ #define _NFCT_PROTO_H_
+ 
+ #include <stdint.h>
++#include <netinet/in.h>
+ #include <linux/icmp.h>
+ #include <linux/icmpv6.h>
+ 
+-- 
+cgit v1.2.3
+