diff mbox series

[meta-networking,1/4] ipset: Update to 7.21

Message ID 20240325055204.150628-1-raj.khem@gmail.com
State New
Headers show
Series [meta-networking,1/4] ipset: Update to 7.21 | expand

Commit Message

Khem Raj March 25, 2024, 5:51 a.m. UTC
Fix build with latest musl while here

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 ...et-Define-portable-basename-function.patch | 50 +++++++++++++++++++
 .../ipset/{ipset_7.19.bb => ipset_7.21.bb}    |  5 +-
 2 files changed, 53 insertions(+), 2 deletions(-)
 create mode 100644 meta-networking/recipes-filter/ipset/ipset/0001-ipset-Define-portable-basename-function.patch
 rename meta-networking/recipes-filter/ipset/{ipset_7.19.bb => ipset_7.21.bb} (70%)
diff mbox series

Patch

diff --git a/meta-networking/recipes-filter/ipset/ipset/0001-ipset-Define-portable-basename-function.patch b/meta-networking/recipes-filter/ipset/ipset/0001-ipset-Define-portable-basename-function.patch
new file mode 100644
index 0000000000..a06bcac362
--- /dev/null
+++ b/meta-networking/recipes-filter/ipset/ipset/0001-ipset-Define-portable-basename-function.patch
@@ -0,0 +1,50 @@ 
+From 8c5c0a7a48af7652c50bc27a4efdd9cb4f7d95bd Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Sun, 24 Mar 2024 21:58:50 -0700
+Subject: [PATCH] ipset: Define portable basename function
+
+Newer version of musl have removed prototype for basename in string.h [1]
+which now makes it fail to compile with newer clang 18+ compiler therefore
+define own basename utility function and not depend on platform for it.
+
+[1] https://git.musl-libc.org/cgit/musl/commit/?id=725e17ed6dff4d0cd22487bb64470881e86a92e7
+
+Upstream-Status: Pending
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ src/ipset.c | 12 +++++++++++-
+ 1 file changed, 11 insertions(+), 1 deletion(-)
+
+diff --git a/src/ipset.c b/src/ipset.c
+index 162f477..7b5d580 100644
+--- a/src/ipset.c
++++ b/src/ipset.c
+@@ -16,6 +16,16 @@
+ #include <libipset/ipset.h>		/* ipset library */
+ #include <libipset/xlate.h>		/* translate to nftables */
+ 
++/* basename is implemented differently across different C libraries. This
++ * implementation matches the one provided by the GNU libc, and does not
++ * modify its input parameter.
++ */
++static const char *ipset_basename(const char *path)
++{
++	const char *base = strrchr(path, '/');
++	return base ? base + 1 : path;
++}
++
+ int
+ main(int argc, char *argv[])
+ {
+@@ -32,7 +42,7 @@ main(int argc, char *argv[])
+ 		exit(1);
+ 	}
+ 
+-	if (!strcmp(basename(argv[0]), "ipset-translate")) {
++	if (!strcmp(ipset_basename(argv[0]), "ipset-translate")) {
+ 		ret = ipset_xlate_argv(ipset, argc, argv);
+ 	} else {
+ 		ret = ipset_parse_argv(ipset, argc, argv);
+-- 
+2.44.0
+
diff --git a/meta-networking/recipes-filter/ipset/ipset_7.19.bb b/meta-networking/recipes-filter/ipset/ipset_7.21.bb
similarity index 70%
rename from meta-networking/recipes-filter/ipset/ipset_7.19.bb
rename to meta-networking/recipes-filter/ipset/ipset_7.21.bb
index bb4319f36c..c7ebdc1c66 100644
--- a/meta-networking/recipes-filter/ipset/ipset_7.19.bb
+++ b/meta-networking/recipes-filter/ipset/ipset_7.21.bb
@@ -9,8 +9,9 @@  SECTION = "base"
 
 DEPENDS = "libtool libmnl"
 
-SRC_URI = "http://ftp.netfilter.org/pub/ipset/${BP}.tar.bz2"
-SRC_URI[sha256sum] = "9bc1fba48d65786e3e0b63dc6b669a866823d77840c6990c0c6b23078ec2c4d6"
+SRC_URI = "http://ftp.netfilter.org/pub/ipset/${BP}.tar.bz2 \
+           file://0001-ipset-Define-portable-basename-function.patch"
+SRC_URI[sha256sum] = "e2c6ce4fcf3acb3893ca5d35c86935f80ad76fc5ccae601185842df760e0bc69"
 
 inherit autotools pkgconfig module-base