sim: Pass through unknown sockopt to system.

Remove the interception of unknown levels and option names in sim usrsock.
This allows the system socket interface to handle them and return the correct error codes or behavior, rather than returning a generic error locally.

Signed-off-by: liqinhui <liqinhui@xiaomi.com>
This commit is contained in:
liqinhui
2024-12-25 21:19:13 +08:00
committed by archer
parent ee06211e05
commit 0e4d291156
+7 -3
View File
@@ -188,7 +188,7 @@ static int optname_to_native(int optname)
default:
syslog(LOG_ERR, "Invalid optname: %x\n", optname);
return -1;
return -ENOPROTOOPT;
}
}
@@ -198,6 +198,10 @@ static int host_usrsock_sockopt(int sockfd, int level, int optname,
{
int ret = -EINVAL;
/* For the parameters that nuttx does not support,
* return the ENOPROTOOPT.
*/
if (level == NUTTX_SOL_SOCKET)
{
level = SOL_SOCKET;
@@ -216,13 +220,13 @@ static int host_usrsock_sockopt(int sockfd, int level, int optname,
}
else
{
return ret;
return -ENOPROTOOPT;
}
optname = optname_to_native(optname);
if (optname < 0)
{
return ret;
return optname;
}
if (set)