mirror of
https://github.com/apache/nuttx.git
synced 2026-06-06 16:50:55 +08:00
Unix domain: A few fixes from early integration
This commit is contained in:
+2
-2
@@ -228,7 +228,7 @@ int psock_bind(FAR struct socket *psock, const struct sockaddr *addr,
|
||||
{
|
||||
/* Bind the Unix domain connection structure */
|
||||
|
||||
ret = local_bind(psock->s_conn, addr, addrlen);
|
||||
ret = psock_local_bind(psock, addr, addrlen);
|
||||
}
|
||||
#endif /* CONFIG_NET_LOCAL */
|
||||
|
||||
@@ -269,7 +269,7 @@ int psock_bind(FAR struct socket *psock, const struct sockaddr *addr,
|
||||
{
|
||||
/* Bind the Unix domain connection structure */
|
||||
|
||||
ret = local_bind(psock->s_conn, addr, addrlen);
|
||||
ret = psock_local_bind(psock, addr, addrlen);
|
||||
}
|
||||
#endif /* CONFIG_NET_LOCAL */
|
||||
|
||||
|
||||
@@ -503,6 +503,18 @@ int psock_connect(FAR struct socket *psock, FAR const struct sockaddr *addr,
|
||||
break;
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_NET_LOCAL
|
||||
case AF_LOCAL:
|
||||
{
|
||||
if (addrlen < sizeof(sa_family_t))
|
||||
{
|
||||
err = EBADF;
|
||||
goto errout;
|
||||
}
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
|
||||
default:
|
||||
DEBUGPANIC();
|
||||
err = EAFNOSUPPORT;
|
||||
|
||||
+50
-10
@@ -292,27 +292,67 @@ int psock_socket(int domain, int type, int protocol, FAR struct socket *psock)
|
||||
|
||||
switch (type)
|
||||
{
|
||||
#ifdef CONFIG_NET_TCP
|
||||
#if defined(CONFIG_NET_TCP) || defined(CONFIG_NET_LOCAL)
|
||||
case SOCK_STREAM:
|
||||
if ((protocol != 0 && protocol != IPPROTO_TCP) || !dgramok)
|
||||
#ifdef CONFIG_NET_TCP
|
||||
#ifdef CONFIG_NET_LOCAL
|
||||
if (ipdomain)
|
||||
#endif
|
||||
{
|
||||
err = EPROTONOSUPPORT;
|
||||
goto errout;
|
||||
if ((protocol != 0 && protocol != IPPROTO_TCP) || !dgramok)
|
||||
{
|
||||
err = EPROTONOSUPPORT;
|
||||
goto errout;
|
||||
}
|
||||
}
|
||||
#endif /* CONFIG_NET_TCP */
|
||||
|
||||
#ifdef CONFIG_NET_LOCAL
|
||||
#ifdef CONFIG_NET_TCP
|
||||
else
|
||||
#endif
|
||||
{
|
||||
if (protocol != 0 || !dgramok)
|
||||
{
|
||||
err = EPROTONOSUPPORT;
|
||||
goto errout;
|
||||
}
|
||||
}
|
||||
#endif /* CONFIG_NET_LOCAL */
|
||||
|
||||
break;
|
||||
#endif
|
||||
#endif /* CONFIG_NET_TCP || CONFIG_NET_LOCAL */
|
||||
|
||||
#ifdef CONFIG_NET_UDP
|
||||
#if defined(CONFIG_NET_UDP) || defined(CONFIG_NET_LOCAL)
|
||||
case SOCK_DGRAM:
|
||||
if ((protocol != 0 && protocol != IPPROTO_UDP) || !dgramok)
|
||||
#ifdef CONFIG_NET_UDP
|
||||
#ifdef CONFIG_NET_LOCAL
|
||||
if (ipdomain)
|
||||
#endif
|
||||
{
|
||||
err = EPROTONOSUPPORT;
|
||||
goto errout;
|
||||
if ((protocol != 0 && protocol != IPPROTO_UDP) || !dgramok)
|
||||
{
|
||||
err = EPROTONOSUPPORT;
|
||||
goto errout;
|
||||
}
|
||||
}
|
||||
#endif /* CONFIG_NET_UDP */
|
||||
|
||||
#ifdef CONFIG_NET_LOCAL
|
||||
#ifdef CONFIG_NET_UDP
|
||||
else
|
||||
#endif
|
||||
{
|
||||
if (protocol != 0 || !dgramok)
|
||||
{
|
||||
err = EPROTONOSUPPORT;
|
||||
goto errout;
|
||||
}
|
||||
}
|
||||
#endif /* CONFIG_NET_LOCAL */
|
||||
|
||||
break;
|
||||
#endif
|
||||
#endif /* CONFIG_NET_UDP || CONFIG_NET_LOCAL */
|
||||
|
||||
#ifdef CONFIG_NET_PKT
|
||||
case SOCK_RAW:
|
||||
|
||||
Reference in New Issue
Block a user