From patchwork Mon Jul 23 23:50:58 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jing Huang X-Patchwork-Id: 172706 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 88EA42C036D for ; Tue, 24 Jul 2012 01:50:17 +1000 (EST) Received: from localhost ([::1]:57868 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1StKtj-0003RN-MZ for incoming@patchwork.ozlabs.org; Mon, 23 Jul 2012 11:50:15 -0400 Received: from eggs.gnu.org ([208.118.235.92]:60884) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1StKtd-0003R2-0R for qemu-devel@nongnu.org; Mon, 23 Jul 2012 11:50:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1StKta-0006oL-Ro for qemu-devel@nongnu.org; Mon, 23 Jul 2012 11:50:08 -0400 Received: from mail-yx0-f173.google.com ([209.85.213.173]:41486) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1StKta-0006o2-Ik for qemu-devel@nongnu.org; Mon, 23 Jul 2012 11:50:06 -0400 Received: by yenl1 with SMTP id l1so5734778yen.4 for ; Mon, 23 Jul 2012 08:50:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; bh=AUOYBhjtJ56M1RwFfNOLK3qagp3Yok2OhHYCWUKGmTs=; b=NHoninKjTKIhH9sSHRgsm6kVKnkDmx5VjihcAkMbdYkI/VM8WBwP0acrz3UuSNgaGQ TRXyyTJ28eFuV8owcr0WjK4Oo3mILappju31i7wdFbrpRHHGwph7juQn2yQiasHDvQhw fgvWWWU8gKxMgYtWvX1cS1hFp+zlu9A9R0zNzdYI7hmqgyZ2qrunz8VKjVHwqiYO+wvX 5KN9AOGy3HRFr+Ma0HD/WmTRR4+0EwyEcORUMYVyHCMwlY0lLLvQIZZKclq9xBgMdTrf vpp2Jd1e8iDnOkV9Yu9w/IURPGo7c1zkvW6L+1EgQPOPtCGddsUx4kPxWvr+1wiWZYgM YLfQ== Received: by 10.66.77.40 with SMTP id p8mr31451544paw.78.1343058605432; Mon, 23 Jul 2012 08:50:05 -0700 (PDT) Received: from localhost.124.16.136.254 ([124.16.141.34]) by mx.google.com with ESMTPS id qi8sm10193692pbc.36.2012.07.23.08.50.02 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 23 Jul 2012 08:50:04 -0700 (PDT) From: Jing Huang To: qemu-devel@nongnu.org Date: Mon, 23 Jul 2012 23:50:58 +0000 Message-Id: <1343087458-13544-1-git-send-email-jing.huang.pku@gmail.com> X-Mailer: git-send-email 1.7.8.6 In-Reply-To: References: X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.85.213.173 Cc: peter.maydell@linaro.org, riku.voipio@iki.fi Subject: [Qemu-devel] [PATCH V4 2/3] 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 Signed-off-by: Jing Huang Reviewed-by: Peter Maydell --- linux-user/syscall.c | 20 ++++++++++++++++++++ 1 files changed, 20 insertions(+), 0 deletions(-) diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 3319bb8..9b498d0 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 @@ -1441,6 +1442,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. */