Received: from eggs.gnu.org ([208.118.235.92]:34800) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SsH2L-0007tn-Qn for qemu-devel@nongnu.org; Fri, 20 Jul 2012 13:32:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SsH0t-0006XN-KH for qemu-devel@nongnu.org; Fri, 20 Jul 2012 13:30:45 -0400 Received: from mail-pb0-f45.google.com ([209.85.160.45]:55026) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SsH0t-0006XH-E7 for qemu-devel@nongnu.org; Fri, 20 Jul 2012 13:29:15 -0400 Received: by pbbro12 with SMTP id ro12so6433285pbb.4 for ; Fri, 20 Jul 2012 10:29:14 -0700 (PDT) From: Jing Huang Date: Sat, 21 Jul 2012 01:29:55 +0000 Message-Id: <1342834195-2670-1-git-send-email-jing.huang.pku@gmail.com> In-Reply-To: References: Subject: [Qemu-devel] [PATCH V3 2/3] linux-user: make do_setsockopt support SOL_RAW ICMP_FILTER socket option List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: peter.maydell@linaro.org, riku.voipio@iki.fi, jing.huang.pku@gmail.com Signed-off-by: Jing Huang --- linux-user/syscall.c | 19 +++++++++++++++++++ 1 files changed, 19 insertions(+), 0 deletions(-) diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 82aa83d..2228b1f 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 #include #include +#include #include "qemu-common.h" #ifdef TARGET_GPROF #include @@ -1442,6 +1443,24 @@ 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. */ -- 1.7.8.6