mirror of
https://github.com/apache/nuttx.git
synced 2026-09-20 21:06:58 +08:00
Support listening sockets in the getsockname function
This commit is contained in:
@@ -157,6 +157,10 @@ int ipv4_getsockname(FAR struct socket *psock, FAR struct sockaddr *addr,
|
||||
|
||||
#ifdef CONFIG_NETDEV_MULTINIC
|
||||
/* Find the device matching the IPv4 address in the connection structure */
|
||||
if (ripaddr == 0)
|
||||
{
|
||||
ripaddr = lipaddr;
|
||||
}
|
||||
|
||||
dev = netdev_findby_ipv4addr(lipaddr, ripaddr);
|
||||
#else
|
||||
@@ -280,6 +284,10 @@ int ipv6_getsockname(FAR struct socket *psock, FAR struct sockaddr *addr,
|
||||
|
||||
#ifdef CONFIG_NETDEV_MULTINIC
|
||||
/* Find the device matching the IPv6 address in the connection structure */
|
||||
if (*ripaddr == 0)
|
||||
{
|
||||
ripaddr = lipaddr;
|
||||
}
|
||||
|
||||
dev = netdev_findby_ipv6addr(*lipaddr, *ripaddr);
|
||||
#else
|
||||
|
||||
Reference in New Issue
Block a user