Skip to contentSkip to conversation

package/odhcp6c: fix build with glibc >= 2.43

PATCH Applied Bernd Kuhls 2 participants 6 messages May 27 – Jun 5

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/3 package/odhcp6c: fix build with glibc >= 2.43

Buildroot commit 227378b5930b681c79a13476ae60a98753a98a03 bumped glibc to 2.43 causing build errors in odhcp6c like:

/home/autobuild/autobuild/instance-10/output-1/build/odhcp6c-f19dd37fb467c9cf10cad57aefa0d048312d7dfd/src/config.c:
In function 'config_parse_opt_string':
/home/autobuild/autobuild/instance-10/output-1/build/odhcp6c-f19dd37fb467c9cf10cad57aefa0d048312d7dfd/src/config.c:338:21:
error: initialization discards 'const' qualifier from pointer target
type [-Werror=discarded-qualifiers]
338 | char *sep = strpbrk(src, ARRAY_SEP);

Add upstream commit to fix the problem.

Fixes:
https://autobuild.buildroot.net/results/efb/efb43d2dc069f5ba9c56816d670a8a2a3682d9ae/

---
v2: added result of Gitlab pipeline passed by series:

    https://gitlab.com/bkuhls/buildroot/-/pipelines/2557223551
 ...p6c-const-cast-for-c23-compatibility.patch | 102 ++++++++++++++++++
 1 file changed, 102 insertions(+)
 create mode 100644 package/odhcp6c/0001-odhcp6c-const-cast-for-c23-compatibility.patch
package/odhcp6c/0001-odhcp6c-const-cast-for-c23-compatibility.patch new file +102 -0
new file mode 100644
index 0000000000..cdb26a7434
@@ -0,0 +1,102 @@
+From 3b69378125aba61b3391bf5fe607983ce75b839c Mon Sep 17 00:00:00 2001
+From: Rosen Penev <[email protected]>
+Date: Wed, 8 Apr 2026 14:14:56 -0700
+Subject: [PATCH] odhcp6c: const cast for c23 compatibility
+
+strpbrk is now a macro that returns const based on the parameter. Cast
+it away when we don't want const.
+
+Signed-off-by: Rosen Penev <[email protected]>
+
+Upstream: https://github.com/openwrt/odhcp6c/pull/156
+
+Signed-off-by: Bernd Kuhls <[email protected]>
+---
+ src/config.c | 18 +++++++++---------
+ 1 file changed, 9 insertions(+), 9 deletions(-)
+
+diff --git a/src/config.c b/src/config.c
+index 54e2d35..c1a3a99 100644
+--- a/src/config.c
++++ b/src/config.c
+@@ -338,7 +338,7 @@ static int config_parse_opt_u8(const char *src, uint8_t **dst)
+ static int config_parse_opt_string(const char *src, uint8_t **dst, const bool array)
+ {
+ 	int o_len = 0;
+-	char *sep = strpbrk(src, ARRAY_SEP);
++	char *sep = strpbrk((char*)src, ARRAY_SEP);
+ 
+ 	if (sep && !array)
+ 		return -1;
+@@ -362,7 +362,7 @@ static int config_parse_opt_string(const char *src, uint8_t **dst, const bool ar
+ 		src = sep;
+ 
+ 		if (sep)
+-			sep = strpbrk(src, ARRAY_SEP);
++			sep = strpbrk((char*)src, ARRAY_SEP);
+ 	} while (src);
+ 
+ 	return o_len;
+@@ -371,7 +371,7 @@ static int config_parse_opt_string(const char *src, uint8_t **dst, const bool ar
+ static int config_parse_opt_dns_string(const char *src, uint8_t **dst, const bool array)
+ {
+ 	int o_len = 0;
+-	char *sep = strpbrk(src, ARRAY_SEP);
++	char *sep = strpbrk((char*)src, ARRAY_SEP);
+ 
+ 	if (sep && !array)
+ 		return -1;
+@@ -399,7 +399,7 @@ static int config_parse_opt_dns_string(const char *src, uint8_t **dst, const boo
+ 		src = sep;
+ 
+ 		if (sep)
+-			sep = strpbrk(src, ARRAY_SEP);
++			sep = strpbrk((char*)src, ARRAY_SEP);
+ 	} while (src);
+ 
+ 	return o_len;
+@@ -408,7 +408,7 @@ static int config_parse_opt_dns_string(const char *src, uint8_t **dst, const boo
+ static int config_parse_opt_ip6(const char *src, uint8_t **dst, const bool array)
+ {
+ 	int o_len = 0;
+-	char *sep = strpbrk(src, ARRAY_SEP);
++	char *sep = strpbrk((char*)src, ARRAY_SEP);
+ 
+ 	if (sep && !array)
+ 		return -1;
+@@ -433,7 +433,7 @@ static int config_parse_opt_ip6(const char *src, uint8_t **dst, const bool array
+ 		src = sep;
+ 
+ 		if (sep)
+-			sep = strpbrk(src, ARRAY_SEP);
++			sep = strpbrk((char*)src, ARRAY_SEP);
+ 	} while (src);
+ 
+ 	return o_len;
+@@ -442,7 +442,7 @@ static int config_parse_opt_ip6(const char *src, uint8_t **dst, const bool array
+ static int config_parse_opt_user_class(const char *src, uint8_t **dst, const bool array)
+ {
+ 	int o_len = 0;
+-	char *sep = strpbrk(src, ARRAY_SEP);
++	char *sep = strpbrk((char*)src, ARRAY_SEP);
+ 
+ 	if (sep && !array)
+ 		return -1;
+@@ -471,7 +471,7 @@ static int config_parse_opt_user_class(const char *src, uint8_t **dst, const boo
+ 		src = sep;
+ 
+ 		if (sep)
+-			sep = strpbrk(src, ARRAY_SEP);
++			sep = strpbrk((char*)src, ARRAY_SEP);
+ 	} while (src);
+ 
+ 	return o_len;
+@@ -555,7 +555,7 @@ int config_parse_opt(const char *opt)
+ 	struct odhcp6c_opt *dopt = NULL;
+ 	int ret = -1;
+ 
+-	data = strpbrk(opt, ":");
++	data = strpbrk((char*)opt, ":");
+ 	if (!data)
+ 		return -1;
+ 
Signature · 6 lines
2.47.3

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#1 lore raw

PATCH 2/3 package/odhcp6c: needs gcc >= 10

Fixes build errors seen with Gitlab pipeline and this defconfig:
support/config-fragments/autobuild/bootlin-aarch64-glibc-old.config

https://gitlab.com/bkuhls/buildroot/-/jobs/14570080455

aarch64-linux-gcc.br_real: error: unrecognized command line option
‘-Wimplicit-fallthrough=5’; did you mean ‘-Wno-fallthrough’?
aarch64-linux-gcc.br_real: error: unrecognized command line option
‘-Wshadow=local’; did you mean ‘-Wshadow-ivar’?

Removing all the unrecognized command line options from CMakeLists.txt showed more build errors during compile:

output/build/odhcp6c-24485bb4b35ab84c17c2e87bd561d026d4c15c00/src/odhcp6c.h:47:46:
error: expected ‘)’ before ‘__VA_OPT__’
#define error(fmt, ...) __iflog(LOG_ERR, fmt __VA_OPT__(, ) __VA_ARGS__)

Another pipeline with gcc 9 showed other errors:
https://gitlab.com/bkuhls/buildroot/-/jobs/14570080479

/builds/bkuhls/buildroot/br-test-pkg/br-arm-basic/build/odhcp6c-24485bb4b35ab84c17c2e87bd561d026d4c15c00/src/dhcpv6.c:1126:4:
error: a label can only be part of a statement and a declaration is not a statement
1126 | struct dhcpv6_auth *r = (void*)&odata[-DHCPV6_OPT_HDR_SIZE];

so we raise the minimum gcc version to 10.

---
Series passed Gitlab pipeline:
https://gitlab.com/bkuhls/buildroot/-/pipelines/2557223551

 package/odhcp6c/Config.in | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
package/odhcp6c/Config.in +3 -2
index 83b38755c3..0acaff7fed 100644
@@ -2,6 +2,7 @@ config BR2_PACKAGE_ODHCP6C
 	bool "odhcp6c"
 	depends on BR2_USE_MMU # fork()
 	depends on !BR2_STATIC_LIBS # libubox
+	depends on BR2_TOOLCHAIN_GCC_AT_LEAST_10
 	depends on BR2_TOOLCHAIN_HAS_SYNC_4 # libubox -> json-c
 	select BR2_PACKAGE_LIBUBOX
 	help
@@ -10,7 +11,7 @@ config BR2_PACKAGE_ODHCP6C
 
 	  https://git.openwrt.org/project/odhcp6c.git
 
-comment "odhcp6c needs a toolchain w/ dynamic library"
+comment "odhcp6c needs a toolchain w/ dynamic library, gcc >= 10"
 	depends on BR2_USE_MMU
-	depends on BR2_STATIC_LIBS
+	depends on BR2_STATIC_LIBS || !BR2_TOOLCHAIN_GCC_AT_LEAST_10
 	depends on BR2_TOOLCHAIN_HAS_SYNC_4
Signature · 6 lines
2.47.3

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#2 lore raw

Re: [Buildroot] [PATCH 2/3] package/odhcp6c: needs gcc >= 10

In reply of:

Quoted 20 lines

Fixes build errors seen with Gitlab pipeline and this defconfig:
support/config-fragments/autobuild/bootlin-aarch64-glibc-old.config

https://gitlab.com/bkuhls/buildroot/-/jobs/14570080455

aarch64-linux-gcc.br_real: error: unrecognized command line option
‘-Wimplicit-fallthrough=5’; did you mean ‘-Wno-fallthrough’?
aarch64-linux-gcc.br_real: error: unrecognized command line option
‘-Wshadow=local’; did you mean ‘-Wshadow-ivar’?

Removing all the unrecognized command line options from CMakeLists.txt showed more build errors during compile:

output/build/odhcp6c-24485bb4b35ab84c17c2e87bd561d026d4c15c00/src/odhcp6c.h:47:46:
error: expected ‘)’ before ‘__VA_OPT__’
#define error(fmt, ...) __iflog(LOG_ERR, fmt __VA_OPT__(, ) __VA_ARGS__)

Another pipeline with gcc 9 showed other errors:
https://gitlab.com/bkuhls/buildroot/-/jobs/14570080479

Quoted 7 lines

/builds/bkuhls/buildroot/br-test-pkg/br-arm-basic/build/odhcp6c-24485bb4b35ab84c17c2e87bd561d026d4c15c00/src/dhcpv6.c:1126:4:
error: a label can only be part of a statement and a declaration is not a statement
1126 | struct dhcpv6_auth *r = (void*)&odata[-DHCPV6_OPT_HDR_SIZE];

so we raise the minimum gcc version to 10.

Applied to 2026.02.x. Thanks

Quoted 36 lines

---
Series passed Gitlab pipeline:
https://gitlab.com/bkuhls/buildroot/-/pipelines/2557223551

 package/odhcp6c/Config.in | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
package/odhcp6c/Config.in +3 -2
index 83b38755c3..0acaff7fed 100644
@@ -2,6 +2,7 @@ config BR2_PACKAGE_ODHCP6C
 	bool "odhcp6c"
 	depends on BR2_USE_MMU # fork()
 	depends on !BR2_STATIC_LIBS # libubox
+	depends on BR2_TOOLCHAIN_GCC_AT_LEAST_10
 	depends on BR2_TOOLCHAIN_HAS_SYNC_4 # libubox -> json-c
 	select BR2_PACKAGE_LIBUBOX
 	help
@@ -10,7 +11,7 @@ config BR2_PACKAGE_ODHCP6C
 
 	  https://git.openwrt.org/project/odhcp6c.git
 
-comment "odhcp6c needs a toolchain w/ dynamic library"
+comment "odhcp6c needs a toolchain w/ dynamic library, gcc >= 10"
 	depends on BR2_USE_MMU
-	depends on BR2_STATIC_LIBS
+	depends on BR2_STATIC_LIBS || !BR2_TOOLCHAIN_GCC_AT_LEAST_10
 	depends on BR2_TOOLCHAIN_HAS_SYNC_4
Signature · 6 lines
2.47.3

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#3 lore raw

Re: [Buildroot] [PATCH 2/3] package/odhcp6c: needs gcc >= 10

In reply to Bernd Kuhls

In reply of:

Quoted 20 lines

Fixes build errors seen with Gitlab pipeline and this defconfig:
support/config-fragments/autobuild/bootlin-aarch64-glibc-old.config

https://gitlab.com/bkuhls/buildroot/-/jobs/14570080455

aarch64-linux-gcc.br_real: error: unrecognized command line option
‘-Wimplicit-fallthrough=5’; did you mean ‘-Wno-fallthrough’?
aarch64-linux-gcc.br_real: error: unrecognized command line option
‘-Wshadow=local’; did you mean ‘-Wshadow-ivar’?

Removing all the unrecognized command line options from CMakeLists.txt showed more build errors during compile:

output/build/odhcp6c-24485bb4b35ab84c17c2e87bd561d026d4c15c00/src/odhcp6c.h:47:46:
error: expected ‘)’ before ‘__VA_OPT__’
#define error(fmt, ...) __iflog(LOG_ERR, fmt __VA_OPT__(, ) __VA_ARGS__)

Another pipeline with gcc 9 showed other errors:
https://gitlab.com/bkuhls/buildroot/-/jobs/14570080479

Quoted 7 lines

/builds/bkuhls/buildroot/br-test-pkg/br-arm-basic/build/odhcp6c-24485bb4b35ab84c17c2e87bd561d026d4c15c00/src/dhcpv6.c:1126:4:
error: a label can only be part of a statement and a declaration is not a statement
1126 | struct dhcpv6_auth *r = (void*)&odata[-DHCPV6_OPT_HDR_SIZE];

so we raise the minimum gcc version to 10.

Applied to 2025.02.x & 2026.02.x. Thanks

Quoted 36 lines

---
Series passed Gitlab pipeline:
https://gitlab.com/bkuhls/buildroot/-/pipelines/2557223551

 package/odhcp6c/Config.in | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
package/odhcp6c/Config.in +3 -2
index 83b38755c3..0acaff7fed 100644
@@ -2,6 +2,7 @@ config BR2_PACKAGE_ODHCP6C
 	bool "odhcp6c"
 	depends on BR2_USE_MMU # fork()
 	depends on !BR2_STATIC_LIBS # libubox
+	depends on BR2_TOOLCHAIN_GCC_AT_LEAST_10
 	depends on BR2_TOOLCHAIN_HAS_SYNC_4 # libubox -> json-c
 	select BR2_PACKAGE_LIBUBOX
 	help
@@ -10,7 +11,7 @@ config BR2_PACKAGE_ODHCP6C
 
 	  https://git.openwrt.org/project/odhcp6c.git
 
-comment "odhcp6c needs a toolchain w/ dynamic library"
+comment "odhcp6c needs a toolchain w/ dynamic library, gcc >= 10"
 	depends on BR2_USE_MMU
-	depends on BR2_STATIC_LIBS
+	depends on BR2_STATIC_LIBS || !BR2_TOOLCHAIN_GCC_AT_LEAST_10
 	depends on BR2_TOOLCHAIN_HAS_SYNC_4
Signature · 6 lines
2.47.3

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#4 lore raw

PATCH 3/3 package/odhcp6c: fix build with gcc >= 14.x

In reply to Bernd Kuhls

Detected by Gitlab pipeline when testing the other build fixes in this series. Autobuilders did not detect the problem due to the build error with glibc 2.43.

https://gitlab.com/bkuhls/buildroot/-/jobs/14571737512

/builds/bkuhls/buildroot/br-test-pkg/bootlin-powerpc-e500mc-uclibc/build/odhcp6c-f19dd37fb467c9cf10cad57aefa0d048312d7dfd/src/dhcpv6.c:1395:58:
error: comparison of integer expressions of different signedness:
‘uint32_t’ {aka ‘unsigned int’} and ‘int’ [-Werror=sign-compare]
1395 | if (ia_hdr->iaid != htonl(ifindex) && otype == DHCPV6_OPT_IA_NA)

https://gitlab.com/bkuhls/buildroot/-/jobs/14571737510

/builds/bkuhls/buildroot/br-test-pkg/bootlin-openrisc-uclibc/build/odhcp6c-f19dd37fb467c9cf10cad57aefa0d048312d7dfd/src/dhcpv6.c:1395:58:
error: comparison of integer expressions of different signedness:
‘uint32_t’ {aka ‘unsigned int’} and ‘int’ [-Werror=sign-compare]

https://gitlab.com/bkuhls/buildroot/-/jobs/14571737505

/builds/bkuhls/buildroot/br-test-pkg/bootlin-m68k-68040-uclibc/build/odhcp6c-f19dd37fb467c9cf10cad57aefa0d048312d7dfd/src/dhcpv6.c:1395:58:
error: comparison of integer expressions of different signedness:
‘uint32_t’ {aka ‘unsigned int’} and ‘int’ [-Werror=sign-compare]

---
Series passed Gitlab pipeline:
https://gitlab.com/bkuhls/buildroot/-/pipelines/2557223551

 ...002-dhcpv6-use-stable-IAID-for-IA_NA.patch | 95 +++++++++++++++++++
 1 file changed, 95 insertions(+)
 create mode 100644 package/odhcp6c/0002-dhcpv6-use-stable-IAID-for-IA_NA.patch
package/odhcp6c/0002-dhcpv6-use-stable-IAID-for-IA_NA.patch new file +95 -0
new file mode 100644
index 0000000000..fc70205ccc
@@ -0,0 +1,95 @@
+From 9a4d6fe802d21e4fc1b84f7d55b5c3c23e71d6ba Mon Sep 17 00:00:00 2001
+From: Paul Donald <[email protected]>
+Date: Thu, 18 Dec 2025 15:10:24 +0100
+Subject: [PATCH] dhcpv6: use stable IAID for IA_NA
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+https://www.rfc-editor.org/rfc/rfc8415.html#section-12
+
+   ........  The IAID is chosen by the client.  For any given use of an
+   IA by the client, the IAID for that IA MUST be consistent across
+   restarts of the DHCP client.  The client may maintain consistency by
+   either storing the IAID in non-volatile storage or using an algorithm
+   that will consistently produce the same IAID as long as the
+   configuration of the client has not changed.
+
+Signed-off-by: Paul Donald <[email protected]>
+Link: https://github.com/openwrt/odhcp6c/pull/140
+Signed-off-by: Álvaro Fernández Rojas <[email protected]>
+
+Upstream: https://github.com/openwrt/odhcp6c/commit/9a4d6fe802d21e4fc1b84f7d55b5c3c23e71d6ba
+
+Signed-off-by: Bernd Kuhls <[email protected]>
+---
+ src/dhcpv6.c  | 15 +++++++++++++--
+ src/odhcp6c.h |  1 +
+ 2 files changed, 14 insertions(+), 2 deletions(-)
+
+diff --git a/src/dhcpv6.c b/src/dhcpv6.c
+index d8bb8be..97860b1 100644
+--- a/src/dhcpv6.c
++++ b/src/dhcpv6.c
+@@ -262,6 +262,9 @@ static struct dhcpv6_stats dhcpv6_stats = {0};
+ // config
+ static struct config_dhcp* config_dhcp = NULL;
+ 
++// store unique ifname hash to use as IA->IAID
++static uint32_t ifname_hash_iaid = 0;
++
+ static uint32_t ntohl_unaligned(const uint8_t *data)
+ {
+ 	uint32_t buf;
+@@ -542,6 +545,12 @@ void dhcpv6_reset_stats(void)
+ 	memset(&dhcpv6_stats, 0, sizeof(dhcpv6_stats));
+ }
+ 
++uint32_t hash_ifname(const char *s) {
++	uint32_t h = 0;
++	while (*s) h = h * 31 + *s++;
++	return h;
++}
++
+ int init_dhcpv6(const char *ifname)
+ {
+ 	config_dhcp = config_dhcp_get();
+@@ -566,6 +575,8 @@ int init_dhcpv6(const char *ifname)
+ 	if (ioctl(sock, SIOCGIFINDEX, &ifr) < 0)
+ 		goto failure;
+ 
++	ifname_hash_iaid = hash_ifname(ifname);
++
+ 	ifindex = ifr.ifr_ifindex;
+ 
+ 	// Set the socket to non-blocking mode
+@@ -838,7 +849,7 @@ static void dhcpv6_send(enum dhcpv6_msg req_msg_type, uint8_t trid[3], uint32_t
+ 	struct dhcpv6_ia_hdr hdr_ia_na = {
+ 		.type = htons(DHCPV6_OPT_IA_NA),
+ 		.len = htons(sizeof(hdr_ia_na) - DHCPV6_OPT_HDR_SIZE),
+-		.iaid = htonl(ifindex),
++		.iaid = htonl(ifname_hash_iaid),
+ 		.t1 = 0,
+ 		.t2 = 0,
+ 	};
+@@ -1392,7 +1403,7 @@ static int dhcpv6_handle_reply(enum dhcpv6_msg orig, _o_unused const int rc,
+ 						continue;
+ 
+ 					// Test ID
+-					if (ia_hdr->iaid != htonl(ifindex) && otype == DHCPV6_OPT_IA_NA)
++					if (ia_hdr->iaid != htonl(ifname_hash_iaid) && otype == DHCPV6_OPT_IA_NA)
+ 						continue;
+ 
+ 					uint16_t code = DHCPV6_Success;
+diff --git a/src/odhcp6c.h b/src/odhcp6c.h
+index aa73bbc..c57f885 100644
+--- a/src/odhcp6c.h
++++ b/src/odhcp6c.h
+@@ -540,6 +540,7 @@ struct odhcp6c_opt {
+ 	const char *str;
+ };
+ 
++uint32_t hash_ifname(const char *s);
+ int init_dhcpv6(const char *ifname);
+ int dhcpv6_get_ia_mode(void);
+ int dhcpv6_promote_server_cand(void);
Signature · 6 lines
2.47.3

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#5 lore raw
In reply to Bernd Kuhls
Quoted 10 lines · Bernd Kuhls

Buildroot commit 227378b5930b681c79a13476ae60a98753a98a03 bumped glibc to 2.43 causing build errors in odhcp6c like:

/home/autobuild/autobuild/instance-10/output-1/build/odhcp6c-f19dd37fb467c9cf10cad57aefa0d048312d7dfd/src/config.c:
In function 'config_parse_opt_string':
/home/autobuild/autobuild/instance-10/output-1/build/odhcp6c-f19dd37fb467c9cf10cad57aefa0d048312d7dfd/src/config.c:338:21:
error: initialization discards 'const' qualifier from pointer target
type [-Werror=discarded-qualifiers]
338 | char *sep = strpbrk(src, ARRAY_SEP);

Quoted 6 lines

Add upstream commit to fix the problem.

Fixes:
https://autobuild.buildroot.net/results/efb/efb43d2dc069f5ba9c56816d670a8a2a3682d9ae/

Applied all three to master, thanks.

Regards,
Arnout

Quoted 106 lines

---
v2: added result of Gitlab pipeline passed by series:

     https://gitlab.com/bkuhls/buildroot/-/pipelines/2557223551
  ...p6c-const-cast-for-c23-compatibility.patch | 102 ++++++++++++++++++
  1 file changed, 102 insertions(+)

create mode 100644 package/odhcp6c/0001-odhcp6c-const-cast-for-c23-compatibility.patch

package/odhcp6c/0001-odhcp6c-const-cast-for-c23-compatibility.patch new file +92 -0
new file mode 100644
index 0000000000..cdb26a7434
@@ -0,0 +1,102 @@
+From 3b69378125aba61b3391bf5fe607983ce75b839c Mon Sep 17 00:00:00 2001
+From: Rosen Penev <[email protected]>
+Date: Wed, 8 Apr 2026 14:14:56 -0700
+Subject: [PATCH] odhcp6c: const cast for c23 compatibility
+
+strpbrk is now a macro that returns const based on the parameter. Cast
+it away when we don't want const.
+
+Signed-off-by: Rosen Penev <[email protected]>
+
+Upstream: https://github.com/openwrt/odhcp6c/pull/156
+
+Signed-off-by: Bernd Kuhls <[email protected]>
+---
+ src/config.c | 18 +++++++++---------
+ 1 file changed, 9 insertions(+), 9 deletions(-)
+
+diff --git a/src/config.c b/src/config.c
+index 54e2d35..c1a3a99 100644
+--- a/src/config.c
++++ b/src/config.c
+@@ -338,7 +338,7 @@ static int config_parse_opt_u8(const char *src, uint8_t **dst)
+ static int config_parse_opt_string(const char *src, uint8_t **dst, const bool array)
+ {
+ 	int o_len = 0;
+-	char *sep = strpbrk(src, ARRAY_SEP);
++	char *sep = strpbrk((char*)src, ARRAY_SEP);
+
+ 	if (sep && !array)
+ 		return -1;
+@@ -362,7 +362,7 @@ static int config_parse_opt_string(const char *src, uint8_t **dst, const bool ar
+ 		src = sep;
+
+ 		if (sep)
+-			sep = strpbrk(src, ARRAY_SEP);
++			sep = strpbrk((char*)src, ARRAY_SEP);
+ 	} while (src);
+
+ 	return o_len;
+@@ -371,7 +371,7 @@ static int config_parse_opt_string(const char *src, uint8_t **dst, const bool ar
+ static int config_parse_opt_dns_string(const char *src, uint8_t **dst, const bool array)
+ {
+ 	int o_len = 0;
+-	char *sep = strpbrk(src, ARRAY_SEP);
++	char *sep = strpbrk((char*)src, ARRAY_SEP);
+
+ 	if (sep && !array)
+ 		return -1;
+@@ -399,7 +399,7 @@ static int config_parse_opt_dns_string(const char *src, uint8_t **dst, const boo
+ 		src = sep;
+
+ 		if (sep)
+-			sep = strpbrk(src, ARRAY_SEP);
++			sep = strpbrk((char*)src, ARRAY_SEP);
+ 	} while (src);
+
+ 	return o_len;
+@@ -408,7 +408,7 @@ static int config_parse_opt_dns_string(const char *src, uint8_t **dst, const boo
+ static int config_parse_opt_ip6(const char *src, uint8_t **dst, const bool array)
+ {
+ 	int o_len = 0;
+-	char *sep = strpbrk(src, ARRAY_SEP);
++	char *sep = strpbrk((char*)src, ARRAY_SEP);
+
+ 	if (sep && !array)
+ 		return -1;
+@@ -433,7 +433,7 @@ static int config_parse_opt_ip6(const char *src, uint8_t **dst, const bool array
+ 		src = sep;
+
+ 		if (sep)
+-			sep = strpbrk(src, ARRAY_SEP);
++			sep = strpbrk((char*)src, ARRAY_SEP);
+ 	} while (src);
+
+ 	return o_len;
+@@ -442,7 +442,7 @@ static int config_parse_opt_ip6(const char *src, uint8_t **dst, const bool array
+ static int config_parse_opt_user_class(const char *src, uint8_t **dst, const bool array)
+ {
+ 	int o_len = 0;
+-	char *sep = strpbrk(src, ARRAY_SEP);
++	char *sep = strpbrk((char*)src, ARRAY_SEP);
+
+ 	if (sep && !array)
+ 		return -1;
+@@ -471,7 +471,7 @@ static int config_parse_opt_user_class(const char *src, uint8_t **dst, const boo
+ 		src = sep;
+
+ 		if (sep)
+-			sep = strpbrk(src, ARRAY_SEP);
++			sep = strpbrk((char*)src, ARRAY_SEP);
+ 	} while (src);
+

package/odhcp6c/0001-odhcp6c-const-cast-for-c23-compatibility.patch line 102

Quoted 10 lines
package/odhcp6c/0001-odhcp6c-const-cast-for-c23-compatibility.patch new file +10 -0
+ 	return o_len;
+@@ -555,7 +555,7 @@ int config_parse_opt(const char *opt)
+ 	struct odhcp6c_opt *dopt = NULL;
+ 	int ret = -1;
+
+-	data = strpbrk(opt, ":");
++	data = strpbrk((char*)opt, ":");
+ 	if (!data)
+ 		return -1;
+

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot