aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJing Huang <jing.huang.pku@gmail.com>2012-07-24 13:59:23 +0000
committerPeter Maydell <peter.maydell@linaro.org>2012-08-13 12:47:41 +0100
commit8569d06561524bb5a1041af1e556faa31b3d76de (patch)
tree8eb228e09f526d60ed81b343e1040b5b4aa7fd2f
parentb870367485eb4f1d096ddc00f011d56f1cd74e6e (diff)
downloadqemu-arm-8569d06561524bb5a1041af1e556faa31b3d76de.tar.gz
linux-user: make do_setsockopt support SOL_RAW ICMP_FILTER socket option
Signed-off-by: Jing Huang <jing.huang.pku@gmail.com> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-rw-r--r--linux-user/syscall.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 47f0eb3729..700163e0f3 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -60,6 +60,7 @@ int __clone2(int (*fn)(void *), void *child_stack_base,
#include <netinet/ip.h>
#include <netinet/tcp.h>
#include <linux/wireless.h>
+#include <linux/icmp.h>
#include "qemu-common.h"
#ifdef TARGET_GPROF
#include <sys/gmon.h>
@@ -1452,6 +1453,25 @@ static abi_long do_setsockopt(int sockfd, int level, int optname,
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:
+ goto unimplemented;
+ }
+ break;
case TARGET_SOL_SOCKET:
switch (optname) {
/* Options with 'int' argument. */