You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by ma...@apache.org on 2022/09/28 11:47:53 UTC
[incubator-nuttx] branch master updated: net: Return -ENOPROTOOPT for unsupported/unknown socket option
This is an automated email from the ASF dual-hosted git repository.
masayuki pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git
The following commit(s) were added to refs/heads/master by this push:
new 386547676d net: Return -ENOPROTOOPT for unsupported/unknown socket option
386547676d is described below
commit 386547676dfe72a5dc21e69528a4b5fada60480c
Author: Xiang Xiao <xi...@xiaomi.com>
AuthorDate: Tue Sep 27 21:52:05 2022 +0800
net: Return -ENOPROTOOPT for unsupported/unknown socket option
so usrsock implementation could support more option than built-in stack
Signed-off-by: Xiang Xiao <xi...@xiaomi.com>
---
net/socket/getsockopt.c | 10 +---------
net/socket/setsockopt.c | 8 ++------
2 files changed, 3 insertions(+), 15 deletions(-)
diff --git a/net/socket/getsockopt.c b/net/socket/getsockopt.c
index 5fe4ee71b4..1022ac18c7 100644
--- a/net/socket/getsockopt.c
+++ b/net/socket/getsockopt.c
@@ -85,7 +85,7 @@ static int psock_socketlevel_option(FAR struct socket *psock, int option,
/* Verify that the socket option if valid (but might not be supported ) */
- if (!_SO_GETVALID(option) || !value || !value_len)
+ if (!value || !value_len)
{
return -EINVAL;
}
@@ -339,14 +339,6 @@ static int psock_socketlevel_option(FAR struct socket *psock, int option,
}
#endif
- /* The following are not yet implemented
- * (return values other than {0,1})
- */
-
- case SO_LINGER: /* Lingers on a close() if data is present */
- case SO_RCVLOWAT: /* Sets the minimum number of bytes to input */
- case SO_SNDLOWAT: /* Sets the minimum number of bytes to output */
-
default:
return -ENOPROTOOPT;
}
diff --git a/net/socket/setsockopt.c b/net/socket/setsockopt.c
index 9fcac5ade9..ab2345f5a3 100644
--- a/net/socket/setsockopt.c
+++ b/net/socket/setsockopt.c
@@ -80,7 +80,7 @@ static int psock_socketlevel_option(FAR struct socket *psock, int option,
/* Verify that the socket option if valid (but might not be supported ) */
- if (!_SO_SETVALID(option) || !value)
+ if (!value)
{
return -EINVAL;
}
@@ -445,16 +445,12 @@ static int psock_socketlevel_option(FAR struct socket *psock, int option,
}
#endif
- /* The following are not yet implemented */
-
- case SO_RCVLOWAT: /* Sets the minimum number of bytes to input */
- case SO_SNDLOWAT: /* Sets the minimum number of bytes to output */
-
/* There options are only valid when used with getopt */
case SO_ACCEPTCONN: /* Reports whether socket listening is enabled */
case SO_ERROR: /* Reports and clears error status. */
case SO_TYPE: /* Reports the socket type */
+ return -EINVAL;
default:
return -ENOPROTOOPT;