forked from nuttx/nuttx-update
net: Return -ENOPROTOOPT for unsupported/unknown socket option
so usrsock implementation could support more option than built-in stack Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
parent
85d013f69a
commit
386547676d
2 changed files with 3 additions and 15 deletions
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue