From 5e0af0ecfdbc4cacf225599244621ab088c89ffd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A2=81=E8=B6=85=E4=BC=97?= Date: Fri, 13 Jan 2023 19:31:05 +0800 Subject: [PATCH] add UDP compile option to avoid build error MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The following build error happens when CONFIG_NET_IPv6 is enabled and CONFIG_NET_UDP is not enabled. inet/ipv6_setsockopt.c:132:19: error: invalid use of undefined type 'struct udp_conn_s' 132 | conn->flags |= _UDP_FLAG_PKTINFO; | ^~ inet/ipv6_setsockopt.c:132:30: error: '_UDP_FLAG_PKTINFO' undeclared (first use in this function) 132 | conn->flags |= _UDP_FLAG_PKTINFO; | ^~~~~~~~~~~~~~~~~ inet/ipv6_setsockopt.c:132:30: note: each undeclared identifier is reported only once for each function it appears in inet/ipv6_setsockopt.c:136:19: error: invalid use of undefined type 'struct udp_conn_s' 136 | conn->flags &= ~_UDP_FLAG_PKTINFO; Signed-off-by: 梁超众 --- net/inet/ipv6_setsockopt.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/net/inet/ipv6_setsockopt.c b/net/inet/ipv6_setsockopt.c index 17bbdb695d..5f581a6ba8 100644 --- a/net/inet/ipv6_setsockopt.c +++ b/net/inet/ipv6_setsockopt.c @@ -111,6 +111,7 @@ int ipv6_setsockopt(FAR struct socket *psock, int option, } break; +#if defined(CONFIG_NET_UDP) && !defined(CONFIG_NET_UDP_NO_STACK) case IPV6_PKTINFO: case IPV6_RECVPKTINFO: { @@ -139,6 +140,7 @@ int ipv6_setsockopt(FAR struct socket *psock, int option, ret = OK; } break; +#endif /* The following IPv6 socket options are defined, but not implemented */