Unix domain: A few fixes from early integration

This commit is contained in:
Gregory Nutt
2015-01-27 16:39:30 -06:00
parent 55d94b6748
commit ca2102febb
10 changed files with 103 additions and 40 deletions
+2 -2
View File
@@ -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 */
+12
View File
@@ -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
View File
@@ -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: