From db4e4c9d0e19255f908d4eec17a52407fa5b44c5 Mon Sep 17 00:00:00 2001 From: Erik Ekman Date: Tue, 2 Jun 2026 23:04:23 +0200 Subject: [PATCH] nd6: add cast of nd6_find_option to struct pointer MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit GCC compiler complained: ../../../../src/core/ipv6/nd6.c:861:16: error: request for implicit conversion from ‘void *’ to ‘struct lladdr_option *’ not permitted in C++ [-Werror=c++-compat] 861 | lladdr_opt = nd6_find_option(p, sizeof(*redir_hdr), ND6_OPTION_TYPE_TARGET_LLADDR); | ^ cc1: all warnings being treated as errors --- src/core/ipv6/nd6.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/core/ipv6/nd6.c b/src/core/ipv6/nd6.c index f1f62d58..8a559589 100644 --- a/src/core/ipv6/nd6.c +++ b/src/core/ipv6/nd6.c @@ -394,7 +394,8 @@ nd6_input(struct pbuf *p, struct netif *inp) } #endif /* LWIP_IPV6_DUP_DETECT_ATTEMPTS */ - lladdr_opt = nd6_find_option(p, sizeof(*na_hdr), ND6_OPTION_TYPE_TARGET_LLADDR); + lladdr_opt = (struct lladdr_option *) + nd6_find_option(p, sizeof(*na_hdr), ND6_OPTION_TYPE_TARGET_LLADDR); if (!lladdr_opt) { /* Missing target lladdr option, or did not fully fit inside p */ pbuf_free(p); @@ -426,7 +427,8 @@ nd6_input(struct pbuf *p, struct netif *inp) /* Update cache entry. */ if ((na_hdr->flags & ND6_FLAG_OVERRIDE) || (neighbor_cache[i].state == ND6_INCOMPLETE)) { - lladdr_opt = nd6_find_option(p, sizeof(*na_hdr), ND6_OPTION_TYPE_TARGET_LLADDR); + lladdr_opt = (struct lladdr_option *) + nd6_find_option(p, sizeof(*na_hdr), ND6_OPTION_TYPE_TARGET_LLADDR); if (!lladdr_opt) { /* Missing target lladdr option, or did not fully fit inside p */ pbuf_free(p); @@ -486,7 +488,8 @@ nd6_input(struct pbuf *p, struct netif *inp) /* @todo RFC MUST: if IP source is 'any', there is no source LL address option */ /* Check if there is a link-layer address provided. Only point to it if in this buffer. */ - lladdr_opt = nd6_find_option(p, sizeof(*ns_hdr), ND6_OPTION_TYPE_SOURCE_LLADDR); + lladdr_opt = (struct lladdr_option*) + nd6_find_option(p, sizeof(*ns_hdr), ND6_OPTION_TYPE_SOURCE_LLADDR); /* Check if the target address is configured on the receiving netif. */ accepted = 0; @@ -858,7 +861,8 @@ nd6_input(struct pbuf *p, struct netif *inp) /* @todo RFC MUST: all included options have a length greater than zero */ /* Check if there is a link-layer address provided. Only point to it if in this buffer. */ - lladdr_opt = nd6_find_option(p, sizeof(*redir_hdr), ND6_OPTION_TYPE_TARGET_LLADDR); + lladdr_opt = (struct lladdr_option *) + nd6_find_option(p, sizeof(*redir_hdr), ND6_OPTION_TYPE_TARGET_LLADDR); /* Find dest address in cache */ dest_idx = nd6_find_destination_cache_entry(&destination_address);