From patchwork Tue Jul 24 22:31:55 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jing Huang X-Patchwork-Id: 172890 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 39E272C0086 for ; Wed, 25 Jul 2012 00:31:14 +1000 (EST) Received: from localhost ([::1]:54550 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Stg8m-00025R-AR for incoming@patchwork.ozlabs.org; Tue, 24 Jul 2012 10:31:12 -0400 Received: from eggs.gnu.org ([208.118.235.92]:56873) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Stg8d-0001yk-2d for qemu-devel@nongnu.org; Tue, 24 Jul 2012 10:31:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Stg8Z-0001wW-3Q for qemu-devel@nongnu.org; Tue, 24 Jul 2012 10:31:02 -0400 Received: from mail-gh0-f173.google.com ([209.85.160.173]:41166) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Stg8Z-0001wQ-00 for qemu-devel@nongnu.org; Tue, 24 Jul 2012 10:30:59 -0400 Received: by ghrr14 with SMTP id r14so6805177ghr.4 for ; Tue, 24 Jul 2012 07:30:58 -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=1pYWgxNxHIGyO1MdW5WkjJC7XFTMIViDWch40uBvyC0=; b=sZmZTQSwvUjIIB8acHR4nHZ/sz2Xg6Md7+xKa0G3BjMDPSE0vsfuYLpZatIWZWOKFU mcEDFJNrsWSxqAnFBYZ0/gJoePHrqiWs+8D/ZEARTTaYUd0WjxPX/5qgIvU4ODB7Ty5I QMEnx76ucvx1alQnGJGu8sG58mDfkuhXqmScEYcjdT06nA8KAHmeC3OznuljPtn3iGLB 5n49VQPKX6YSpYI8ZLZi9hUT3vNZvW1Wrwh1Riak0xCdxPDktQVGZ29H8MRAHe4svY6O dTdPlutNAfRye6GKkCl14O4KcSwAnAMZNxfunYJ0cyV2LkX/xXhVEZlPgEj8J1XRtfTx 03aA== Received: by 10.68.231.233 with SMTP id tj9mr45059098pbc.39.1343140258115; Tue, 24 Jul 2012 07:30:58 -0700 (PDT) Received: from localhost.124.16.136.254 ([124.16.141.34]) by mx.google.com with ESMTPS id ot4sm12269182pbb.65.2012.07.24.07.30.55 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 24 Jul 2012 07:30:57 -0700 (PDT) From: Jing Huang To: qemu-devel@nongnu.org Date: Tue, 24 Jul 2012 22:31:55 +0000 Message-Id: <1343169115-9617-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.160.173 Cc: peter.maydell@linaro.org, riku.voipio@iki.fi Subject: [Qemu-devel] [PATCH V5 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 | 19 +++++++++++++++++++ 1 files changed, 19 insertions(+), 0 deletions(-) diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 6385934..cc2a1c3 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 @@ -1440,6 +1441,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. */