This is an automated email from the ASF dual-hosted git repository.

GUIDINGLI pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit 3c393c7c7ca2904118149d532f416b7b5499c23e
Author: Marco Casaroli <[email protected]>
AuthorDate: Thu Nov 26 11:44:54 2026 +0100

    net/utils: Build the ICMP checksums for the ICMPv6 stack too.
    
    net_icmpchksum.c has icmp_chksum() and icmpv6_chksum().  Make.defs and
    CMakeLists.txt added it for the ICMP stack, and for the ICMPv6 stack only
    in the else branch, when CONFIG_NET_ICMP is off.  With CONFIG_NET_ICMP
    and CONFIG_NET_ICMP_NO_STACK (a usrsock ICMP socket) and the ICMPv6
    stack, the file was not built, and the link failed: undefined reference
    to icmpv6_chksum() from icmpv6_solicit.c, icmpv6_advertise.c,
    icmpv6_rsolicit.c and icmpv6_sendmsg.c.
    
    Build the file when either stack is built.
    
    Assisted-by: Claude Code:claude-opus-5-5
    Signed-off-by: Marco Casaroli <[email protected]>
---
 net/utils/CMakeLists.txt |  5 ++---
 net/utils/Make.defs      | 12 ++++--------
 2 files changed, 6 insertions(+), 11 deletions(-)

diff --git a/net/utils/CMakeLists.txt b/net/utils/CMakeLists.txt
index ff6cc52ef40..ec9eb5a291a 100644
--- a/net/utils/CMakeLists.txt
+++ b/net/utils/CMakeLists.txt
@@ -55,9 +55,8 @@ endif()
 
 # ICMP utilities
 
-if(CONFIG_NET_ICMP AND NOT CONFIG_NET_ICMP_NO_STACK)
-  list(APPEND SRCS net_icmpchksum.c)
-elseif(CONFIG_NET_ICMPv6 AND NOT CONFIG_NET_ICMPv6_NO_STACK)
+if((CONFIG_NET_ICMP AND NOT CONFIG_NET_ICMP_NO_STACK)
+   OR (CONFIG_NET_ICMPv6 AND NOT CONFIG_NET_ICMPv6_NO_STACK))
   list(APPEND SRCS net_icmpchksum.c)
 endif()
 
diff --git a/net/utils/Make.defs b/net/utils/Make.defs
index a75b9b231c5..f90fcd835f0 100644
--- a/net/utils/Make.defs
+++ b/net/utils/Make.defs
@@ -46,14 +46,10 @@ endif
 
 # ICMP utilities
 
-ifeq ($(CONFIG_NET_ICMP),y)
-  ifneq ($(CONFIG_NET_ICMP_NO_STACK),y)
-    NET_CSRCS += net_icmpchksum.c
-  endif
-else ifeq ($(CONFIG_NET_ICMPv6),y)
-  ifneq ($(CONFIG_NET_ICMPv6_NO_STACK),y)
-    NET_CSRCS += net_icmpchksum.c
-  endif
+ifeq ($(CONFIG_NET_ICMP)$(CONFIG_NET_ICMP_NO_STACK),y)
+NET_CSRCS += net_icmpchksum.c
+else ifeq ($(CONFIG_NET_ICMPv6)$(CONFIG_NET_ICMPv6_NO_STACK),y)
+NET_CSRCS += net_icmpchksum.c
 endif
 
 # Include utility build support

Reply via email to