From 85ffa4bcf349bdbad655146201e99523600b1b80 Mon Sep 17 00:00:00 2001 From: zhanghongyu Date: Wed, 19 Oct 2022 11:49:26 +0800 Subject: [PATCH] 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 --- net/inet/inet_sockif.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/net/inet/inet_sockif.c b/net/inet/inet_sockif.c index 6ea41d8ce3c..c198c14c875 100644 --- a/net/inet/inet_sockif.c +++ b/net/inet/inet_sockif.c @@ -1809,23 +1809,15 @@ FAR const struct sock_intf_s * } else #endif -#ifdef NET_UDP_HAVE_STACK - if (type == SOCK_DGRAM && (protocol == 0 || protocol == IPPROTO_UDP)) +#if defined(NET_UDP_HAVE_STACK) || defined(NET_TCP_HAVE_STACK) { return &g_inet_sockif; } - else -#endif -#ifdef NET_TCP_HAVE_STACK - if (type == SOCK_STREAM && (protocol == 0 || protocol == IPPROTO_TCP)) - { - return &g_inet_sockif; - } - else -#endif +#else { return NULL; } +#endif } #endif /* HAVE_INET_SOCKETS */