add UDP compile option to avoid build error

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: 梁超众 <liangchaozhong@xiaomi.com>
This commit is contained in:
梁超众 2023-01-13 19:31:05 +08:00 committed by archer
parent 8564b49469
commit 5e0af0ecfd

View File

@ -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 */