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-apps.git


The following commit(s) were added to refs/heads/master by this push:
     new 691659d70 netutils/netlib: Build netlib_conntrack.c without IPv6 or 
IPv4.
691659d70 is described below

commit 691659d70e4f079f61f5ed42f924c86cc5d2fd73
Author: Marco Casaroli <[email protected]>
AuthorDate: Thu Nov 26 14:33:32 2026 +0100

    netutils/netlib: Build netlib_conntrack.c without IPv6 or IPv4.
    
    netlib_ct_parse_ip() copied the IPv4 and the IPv6 addresses of a
    conntrack tuple in all configurations.  union netlib_conntrack_addr_u
    has the member ipv6 only with CONFIG_NET_IPv6, and
    net_ipv6addr_hdrcopy() exists only with CONFIG_NET_IPv6, so
    CONFIG_NETLINK_NETFILTER without CONFIG_NET_IPv6 did not compile.  The
    IPv4 cases have the same problem without CONFIG_NET_IPv4.
    
    Handle each address family only when it is enabled.  The kernel sends
    only the attributes of the enabled families.
    
    Assisted-by: Claude Code:claude-opus-5-5
    Signed-off-by: Marco Casaroli <[email protected]>
---
 netutils/netlib/netlib_conntrack.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/netutils/netlib/netlib_conntrack.c 
b/netutils/netlib/netlib_conntrack.c
index b6312dd5c..359250a7f 100644
--- a/netutils/netlib/netlib_conntrack.c
+++ b/netutils/netlib/netlib_conntrack.c
@@ -66,18 +66,22 @@ static void netlib_ct_parse_ip(FAR const struct nfattr 
*attr,
     {
       switch (NFA_TYPE(subattr))
         {
+#ifdef CONFIG_NET_IPv4
           case CTA_IP_V4_SRC:
             net_ipv4addr_hdrcopy(&tuple->src.ipv4, NFA_DATA(subattr));
             break;
           case CTA_IP_V4_DST:
             net_ipv4addr_hdrcopy(&tuple->dst.ipv4, NFA_DATA(subattr));
             break;
+#endif
+#ifdef CONFIG_NET_IPv6
           case CTA_IP_V6_SRC:
             net_ipv6addr_hdrcopy(&tuple->src.ipv6, NFA_DATA(subattr));
             break;
           case CTA_IP_V6_DST:
             net_ipv6addr_hdrcopy(&tuple->dst.ipv6, NFA_DATA(subattr));
             break;
+#endif
         }
     }
 }

Reply via email to