提交 920394db 编写于 作者: J Jing Huang 提交者: Peter Maydell

linux-user: make do_setsockopt support SOL_RAW ICMP_FILTER socket option

Signed-off-by: NJing Huang <jing.huang.pku@gmail.com>
Reviewed-by: NPeter Maydell <peter.maydell@linaro.org>
Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
上级 ca619067
...@@ -60,6 +60,7 @@ int __clone2(int (*fn)(void *), void *child_stack_base, ...@@ -60,6 +60,7 @@ int __clone2(int (*fn)(void *), void *child_stack_base,
#include <netinet/ip.h> #include <netinet/ip.h>
#include <netinet/tcp.h> #include <netinet/tcp.h>
#include <linux/wireless.h> #include <linux/wireless.h>
#include <linux/icmp.h>
#include "qemu-common.h" #include "qemu-common.h"
#ifdef TARGET_GPROF #ifdef TARGET_GPROF
#include <sys/gmon.h> #include <sys/gmon.h>
...@@ -1448,6 +1449,25 @@ static abi_long do_setsockopt(int sockfd, int level, int optname, ...@@ -1448,6 +1449,25 @@ static abi_long do_setsockopt(int sockfd, int level, int optname,
unlock_user (ip_mreq_source, optval_addr, 0); unlock_user (ip_mreq_source, optval_addr, 0);
break; break;
default:
goto unimplemented;
}
break;
case SOL_RAW:
switch (optname) {
case ICMP_FILTER:
/* struct icmp_filter takes an u32 value */
if (optlen < sizeof(uint32_t)) {
return -TARGET_EINVAL;
}
if (get_user_u32(val, optval_addr)) {
return -TARGET_EFAULT;
}
ret = get_errno(setsockopt(sockfd, level, optname,
&val, sizeof(val)));
break;
default: default:
goto unimplemented; goto unimplemented;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册