Merged in rtakacs/nuttx/fix_getsockname (pull request #410)

Support listening sockets in the getsockname function

Approved-by: Gregory Nutt <gnutt@nuttx.org>
This commit is contained in:
Roland Takacs 2017-06-19 13:36:52 +00:00 committed by Gregory Nutt
commit 175a49a746
1 changed files with 8 additions and 0 deletions

View File

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