From patchwork Tue Aug 14 09:40:31 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 177209 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 220BE2C008B for ; Tue, 14 Aug 2012 20:11:31 +1000 (EST) Received: from localhost ([::1]:38476 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T1DtI-0005nY-6V for incoming@patchwork.ozlabs.org; Tue, 14 Aug 2012 05:58:24 -0400 Received: from eggs.gnu.org ([208.118.235.92]:48108) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T1Drl-0001UA-7g for qemu-devel@nongnu.org; Tue, 14 Aug 2012 05:56:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1T1Dri-0001ZI-DK for qemu-devel@nongnu.org; Tue, 14 Aug 2012 05:56:49 -0400 Received: from mnementh.archaic.org.uk ([81.2.115.146]:46389) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T1Dri-0001Xp-7B for qemu-devel@nongnu.org; Tue, 14 Aug 2012 05:56:46 -0400 Received: from pm215 by mnementh.archaic.org.uk with local (Exim 4.72) (envelope-from ) id 1T1Dc4-0000AU-Fu; Tue, 14 Aug 2012 10:40:36 +0100 From: Peter Maydell To: Anthony Liguori , Blue Swirl Date: Tue, 14 Aug 2012 10:40:31 +0100 Message-Id: <1344937236-611-6-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.2.5 In-Reply-To: <1344937236-611-1-git-send-email-peter.maydell@linaro.org> References: <1344937236-611-1-git-send-email-peter.maydell@linaro.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 81.2.115.146 Cc: Riku Voipio , qemu-devel@nongnu.org Subject: [Qemu-devel] [PATCH 05/10] linux-user: make do_setsockopt support SOL_RAW ICMP_FILTER socket option X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Jing Huang Signed-off-by: Jing Huang Reviewed-by: Peter Maydell Signed-off-by: Peter Maydell --- linux-user/syscall.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 47f0eb3..700163e 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 @@ -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. */