From patchwork Mon Jul 16 10:14:12 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jing Huang X-Patchwork-Id: 171115 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 A57FA2C00DE for ; Mon, 16 Jul 2012 12:13:57 +1000 (EST) Received: from localhost ([::1]:57232 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Sqaot-0003Ni-O4 for incoming@patchwork.ozlabs.org; Sun, 15 Jul 2012 22:13:55 -0400 Received: from eggs.gnu.org ([208.118.235.92]:57222) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Sqaon-0003M3-0R for qemu-devel@nongnu.org; Sun, 15 Jul 2012 22:13:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Sqaom-0002Lb-3T for qemu-devel@nongnu.org; Sun, 15 Jul 2012 22:13:48 -0400 Received: from mail-gh0-f173.google.com ([209.85.160.173]:54995) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Sqaol-0002LU-Vn for qemu-devel@nongnu.org; Sun, 15 Jul 2012 22:13:48 -0400 Received: by ghrr14 with SMTP id r14so5134295ghr.4 for ; Sun, 15 Jul 2012 19:13:47 -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=of1fbC/ay39i1nblIkfkE3j9knLSHD1NGT1EK4i90K0=; b=TJZgjrFFZt2tbM9Hw8GiJpJHWA7MAVBqXnJhEHDDAeOd/uHFpOG6ft/mRrywEDI4N6 BoP6a+/UycEo3jo4lEii1TpE0+HCkz1B4cD88ymmr32Ktu//C5m0tgCV0wl3PX1vCmH0 6yhgXv985zBjAk1xn0Pn4fgXItt8jZa6+aX0zw85KvdHLkTAuXqo1or2h/9QYqUq54eY A0BHGJo3hDW8I79ir7wYEcRQyL83aAkOqOje4SfmfUfKmZLwoeiWMXxv7QKNDMj2SIBD 4mEpzsirc4U4DFLEsFJdkjmrOnbwuzLMH56MrPtrwwVIv3kIObSmtf/WvO290b1+HOh9 oFzg== Received: by 10.66.87.2 with SMTP id t2mr19386866paz.22.1342404827083; Sun, 15 Jul 2012 19:13:47 -0700 (PDT) Received: from localhost.124.16.136.254 ([124.16.141.34]) by mx.google.com with ESMTPS id nj4sm10870321pbc.5.2012.07.15.19.13.44 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 15 Jul 2012 19:13:46 -0700 (PDT) From: Jing Huang To: qemu-devel@nongnu.org Date: Mon, 16 Jul 2012 10:14:12 +0000 Message-Id: <1342433652-3339-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, jing.huang.pku@gmail.com Subject: [Qemu-devel] [PATCH v2 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 This patch makes do_setsockopt() support SOL_RAW ICMP_FILTER socket option. Signed-off-by: Jing Huang --- 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 28c8ba5..fc8690d 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,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*/ + optname = ICMP_FILTER; + 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, + (char *)&val, sizeof(val))); + break; + default: + goto unimplemented; + } + break; case TARGET_SOL_SOCKET: switch (optname) { /* Options with 'int' argument. */