xiaoxiang781216 commented on code in PR #10319:
URL: https://github.com/apache/nuttx/pull/10319#discussion_r1299867266
##########
net/inet/ipv6_setsockopt.c:
##########
@@ -103,10 +105,41 @@ int ipv6_setsockopt(FAR struct socket *psock, int option,
}
break;
- /* The following IPv6 socket options are defined, but not implemented */
-
case IPV6_MULTICAST_IF: /* Interface to use for outgoing multicast
* packets */
+#if defined NET_UDP_HAVE_STACK && defined CONFIG_NET_BINDTODEVICE
Review Comment:
```suggestion
#if defined(NET_UDP_HAVE_STACK) && defined(CONFIG_NET_BINDTODEVICE)
```
##########
net/inet/ipv4_setsockopt.c:
##########
@@ -208,10 +208,83 @@ int ipv4_setsockopt(FAR struct socket *psock, int option,
}
break;
- /* The following IPv4 socket options are defined, but not implemented */
-
case IP_MULTICAST_IF: /* Set local device for a multicast
* socket */
+#if defined NET_UDP_HAVE_STACK && defined CONFIG_NET_BINDTODEVICE
Review Comment:
```suggestion
#if defined(NET_UDP_HAVE_STACK) && defined(CONFIG_NET_BINDTODEVICE)
```
##########
net/udp/udp_finddev.c:
##########
@@ -186,43 +199,58 @@ udp_find_raddr_device(FAR struct udp_conn_s *conn,
else
#endif
{
- net_ipv6addr_t raddr;
-
- if (!net_ipv6addr_cmp(conn->u.ipv6.laddr, g_ipv6_unspecaddr))
+ struct in6_addr raddr;
+ if (remote)
{
- /* If the socket is bound to some non-zero, local address.
- * Normal lookup using the verified local address.
- */
-
- return netdev_findby_lipv6addr(conn->u.ipv6.laddr);
+ FAR const struct sockaddr_in6 *inaddr =
+ (FAR const struct sockaddr_in6 *)remote;
+ net_ipv6addr_copy(raddr.in6_u.u6_addr16,
+ inaddr->sin6_addr.s6_addr16);
}
-
-#ifdef CONFIG_NET_BINDTODEVICE
- if (conn->sconn.s_boundto != 0)
+ else
{
- /* If the socket is bound to a local network device.
- * Select the network device that has been bound.
- * If the index is invalid, return NULL.
- */
-
- return netdev_findbyindex(conn->sconn.s_boundto);
+ net_ipv6addr_copy(raddr.in6_u.u6_addr16, conn->u.ipv6.raddr);
}
-#endif
+#if defined CONFIG_NET_MLD && defined (CONFIG_NET_BINDTODEVICE)
Review Comment:
```suggestion
#if defined(CONFIG_NET_MLD) && defined(CONFIG_NET_BINDTODEVICE)
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]