Commit f7d27f5e4b for frr

commit f7d27f5e4bae04b1ec7ede8decb5cc19c2804d64
Author: Martin Winter <mwinter@opensourcerouting.org>
Date:   Tue Sep 22 12:21:25 2026 +0200

    lib: fix const qualifier discard in network_address_parse

    `network_address_parse()` assigned the result of `strchr()` on its
    `const char *address_string` parameter to a `char *`, so on distributions
    shipping the new glibc (Ubuntu 26.04 with glibc 2.43 and GCC 15) builds
    using `--enable-werror` fail with:

      lib/network.c: In function 'network_address_parse':
      lib/network.c:193:17: error: assignment discards 'const' qualifier from
      pointer target type [-Werror=discarded-qualifiers]

    `str_pos` served double duty: pointing into the read-only input string
    and into the local writable `addr` buffer.  Use a separate `const char *`
    for the former instead of casting the qualifier away; the remaining
    `str_pos` uses index `addr` and legitimately write through the pointer.

    Fixes: fd51e5c445 ("lib: network argument parser")

    Signed-off-by: Martin Winter <mwinter@opensourcerouting.org>

diff --git a/lib/network.c b/lib/network.c
index 5bae9351fb..ba0abb8790 100644
--- a/lib/network.c
+++ b/lib/network.c
@@ -179,6 +179,7 @@ static uint16_t parse_port(const char *port_string, char *error, size_t error_si
 bool network_address_parse(const char *address_string, struct network_address *address,
 			   uint16_t default_port)
 {
+	const char *addr_start;
 	char *str_pos, *str_pos_aux;
 	size_t str_len;
 	char addr[128];
@@ -190,19 +191,19 @@ bool network_address_parse(const char *address_string, struct network_address *a
 	memset(address, 0, sizeof(*address));

 	/* Basic parsing: find ':' to figure out type part and address part. */
-	str_pos = strchr(address_string, ':');
-	if (!str_pos) {
+	addr_start = strchr(address_string, ':');
+	if (!addr_start) {
 		snprintfrr(address->error, sizeof(address->error), "invalid address format: %s",
 			   address_string);
 		return false;
 	}

 	/* Calculate type string length. */
-	str_len = (size_t)(str_pos - address_string);
+	str_len = (size_t)(addr_start - address_string);

 	/* Copy the address part. */
-	str_pos++;
-	strlcpy(addr, str_pos, sizeof(addr));
+	addr_start++;
+	strlcpy(addr, addr_start, sizeof(addr));

 	if (strlen(addr) == 0) {
 		snprintfrr(address->error, sizeof(address->error), "address part is empty");