examples/ipsec-secgw: fix discarded-qualifers warnings
PATCH 1/1 examples/ipsec-secgw: fix discarded-qualifers warnings
glibc 2.42 has const-preserving functions.
This leads to warnings when there is a const argument and an assignment to a non-const variable.
Example with GCC 16.0.1 and glibc 2.43 on Fedora Rawhide (F45).
/examples/ipsec-secgw/parser.c: In function ‘parse_ipv4_addr’:../examples/ipsec-secgw/parser.c:53:13:
warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
53 | pch = strchr(token, '/');
| ^
--- examples/ipsec-secgw/parser.c | 4 ++-- examples/ipsec-secgw/sa.c | 2 +- examples/ipsec-secgw/sp4.c | 2 +- examples/ipsec-secgw/sp6.c | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-)
examples/ipsec-secgw/parser.c +2 -2
@@ -49,5 +49,5 @@ parse_ipv4_addr(const char *token, struct in_addr *ipv4, uint32_t *mask) {char ip_str[INET_ADDRSTRLEN ] = {0 }; -char *pch; +const char *pch; pch =strchr (token,'/' );
@@ -79,5 +79,5 @@ parse_ipv6_addr(const char *token, struct rte_ipv6_addr *ipv6, uint32_t *mask) {char ip_str[256 ] = {0 }; -char *pch; +const char *pch; pch =strchr (token,'/' );
examples/ipsec-secgw/sa.c +1 -1
@@ -1676,5 +1676,5 @@ sa_spi_present(struct sa_ctx *sa_ctx, uint32_t spi, int inbound) {uint32_t num; -struct ipsec_sa *sa; +const struct ipsec_sa *sa;struct ipsec_sa tmpl;const struct ipsec_sa *sar;
examples/ipsec-secgw/sp4.c +1 -1
@@ -611,5 +611,5 @@ sp4_spi_present(uint32_t spi, int inbound, struct ip_addr ip_addr[2], {uint32_t num; -struct acl4_rules *rule; +const struct acl4_rules *rule;const struct acl4_rules *acr;struct acl4_rules tmpl;
examples/ipsec-secgw/sp6.c +1 -1
@@ -755,5 +755,5 @@ sp6_spi_present(uint32_t spi, int inbound, struct ip_addr ip_addr[2], {uint32_t num; -struct acl6_rules *rule; +const struct acl6_rules *rule;const struct acl6_rules *acr;struct acl6_rules tmpl;
Signature · 1 line
2.53.0
Quoted 11 lines · Kevin Traynor
glibc 2.42 has const-preserving functions.
This leads to warnings when there is a const argument and an assignment to a non-const variable.
Example with GCC 16.0.1 and glibc 2.43 on Fedora Rawhide (F45).
/examples/ipsec-secgw/parser.c: In function ‘parse_ipv4_addr’:
../examples/ipsec-secgw/parser.c:53:13:
warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
Quoted 7 lines
53 | pch = strchr(token, '/'); | ^Signed-off-by Kevin Traynor <[email protected]>---
Thomas Monjalon
Applied16/03/2026 11:12, Radu Nicolau:
Quoted 3 lines · Kevin Traynor
Quoted 1 line
glibc 2.42 has const-preserving functions.
It is in glibc 2.43.
Quoted 13 lines
Quoted 13 lines
This leads to warnings when there is a const argument and an assignment to a non-const variable.
Example with GCC 16.0.1 and glibc 2.43 on Fedora Rawhide (F45).
/examples/ipsec-secgw/parser.c: In function ‘parse_ipv4_addr’:
../examples/ipsec-secgw/parser.c:53:13:
warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]53 | pch = strchr(token, '/'); | ^
Quoted 5 lines
Quoted 4 lines
Signed-off-by Kevin Traynor <[email protected]>---
Acked-by Radu Nicolau <[email protected]>
Applied, thanks.