mirror of
https://github.com/apache/nuttx.git
synced 2026-05-27 11:26:12 +08:00
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:
committed by
Masayuki Ishikawa
parent
85d013f69a
commit
386547676d
@@ -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 ) */
|
/* 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;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
@@ -339,14 +339,6 @@ static int psock_socketlevel_option(FAR struct socket *psock, int option,
|
|||||||
}
|
}
|
||||||
#endif
|
#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:
|
default:
|
||||||
return -ENOPROTOOPT;
|
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 ) */
|
/* Verify that the socket option if valid (but might not be supported ) */
|
||||||
|
|
||||||
if (!_SO_SETVALID(option) || !value)
|
if (!value)
|
||||||
{
|
{
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
@@ -445,16 +445,12 @@ static int psock_socketlevel_option(FAR struct socket *psock, int option,
|
|||||||
}
|
}
|
||||||
#endif
|
#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 */
|
/* There options are only valid when used with getopt */
|
||||||
|
|
||||||
case SO_ACCEPTCONN: /* Reports whether socket listening is enabled */
|
case SO_ACCEPTCONN: /* Reports whether socket listening is enabled */
|
||||||
case SO_ERROR: /* Reports and clears error status. */
|
case SO_ERROR: /* Reports and clears error status. */
|
||||||
case SO_TYPE: /* Reports the socket type */
|
case SO_TYPE: /* Reports the socket type */
|
||||||
|
return -EINVAL;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return -ENOPROTOOPT;
|
return -ENOPROTOOPT;
|
||||||
|
|||||||
Reference in New Issue
Block a user