From patchwork Tue Jul 24 23:59:23 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jing Huang X-Patchwork-Id: 172914 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 3A66E2C0088 for ; Wed, 25 Jul 2012 01:58:42 +1000 (EST) Received: from localhost ([::1]:38324 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SthVQ-0003kL-Ed for incoming@patchwork.ozlabs.org; Tue, 24 Jul 2012 11:58:40 -0400 Received: from eggs.gnu.org ([208.118.235.92]:53674) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SthVJ-0003jp-SA for qemu-devel@nongnu.org; Tue, 24 Jul 2012 11:58:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SthVE-00079h-3d for qemu-devel@nongnu.org; Tue, 24 Jul 2012 11:58:33 -0400 Received: from mail-gg0-f173.google.com ([209.85.161.173]:48147) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SthVD-00079c-U1 for qemu-devel@nongnu.org; Tue, 24 Jul 2012 11:58:28 -0400 Received: by ggnp1 with SMTP id p1so6908968ggn.4 for ; Tue, 24 Jul 2012 08:58:27 -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=ZhiKVqtLyI4TWTqn4mImMxUjWXskOLOGb9BnryS+gqo=; b=EaK5mhAkXLqExM2nFTVluumQSufxCXTSt2yVteS/OIoK6dapZ/LDy4ZdEG/wEmY29I jeKXTtV0LtAwZXPoJatMOiPyF6vLG+UJKpHuDLayO5mYxAep+v1qeHaRj8NDKgzfZgSE zZf1dGqp/5QGYZfimRkl0kA1pQrMIKnEh08gIVGQINrk6LWQBF4PfBZPPjqk0LjC5z6a P6+mF2voiMdrCE6l3WRddk5dIIFmBQgDml/GWmGI7jgp1Q5w72aIj9vKtUXgzJosJPXY w5u9cOsCe/n141mmJkmhzTvKDwiH6DQ30OD15opEmw5tmDN69QW23o39s2NoWFdT8Gu0 o2sw== Received: by 10.68.221.38 with SMTP id qb6mr45321593pbc.144.1343145507035; Tue, 24 Jul 2012 08:58:27 -0700 (PDT) Received: from localhost.124.16.136.254 ([124.16.141.34]) by mx.google.com with ESMTPS id rg10sm12401325pbc.54.2012.07.24.08.58.24 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 24 Jul 2012 08:58:25 -0700 (PDT) From: Jing Huang To: qemu-devel@nongnu.org Date: Tue, 24 Jul 2012 23:59:23 +0000 Message-Id: <1343174363-10330-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.161.173 Cc: peter.maydell@linaro.org, riku.voipio@iki.fi Subject: [Qemu-devel] [PATCH V6 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 6385934..362e478 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,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. */