inet_sockif: errno alignment to Linux

cunittest error case: protocol invalid need return 123(EPROTONOSUPPORT)
now return 106(EAFNOSUPPORT)

inet_setup will check type ande protocol

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
This commit is contained in:
zhanghongyu 2022-10-19 11:49:26 +08:00 committed by Xiang Xiao
parent 6b955b0ef0
commit 85ffa4bcf3

View File

@ -1809,23 +1809,15 @@ FAR const struct sock_intf_s *
} }
else else
#endif #endif
#ifdef NET_UDP_HAVE_STACK #if defined(NET_UDP_HAVE_STACK) || defined(NET_TCP_HAVE_STACK)
if (type == SOCK_DGRAM && (protocol == 0 || protocol == IPPROTO_UDP))
{ {
return &g_inet_sockif; return &g_inet_sockif;
} }
else #else
#endif
#ifdef NET_TCP_HAVE_STACK
if (type == SOCK_STREAM && (protocol == 0 || protocol == IPPROTO_TCP))
{
return &g_inet_sockif;
}
else
#endif
{ {
return NULL; return NULL;
} }
#endif
} }
#endif /* HAVE_INET_SOCKETS */ #endif /* HAVE_INET_SOCKETS */