From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:46841) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Sqbu7-0003ho-At for qemu-devel@nongnu.org; Sun, 15 Jul 2012 23:23:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Sqbu6-0004HS-FQ for qemu-devel@nongnu.org; Sun, 15 Jul 2012 23:23:23 -0400 Received: from mail-lb0-f173.google.com ([209.85.217.173]:50097) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Sqbu6-0004HK-7X for qemu-devel@nongnu.org; Sun, 15 Jul 2012 23:23:22 -0400 Received: by lbok6 with SMTP id k6so1830016lbo.4 for ; Sun, 15 Jul 2012 20:23:20 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <1342433652-3339-1-git-send-email-jing.huang.pku@gmail.com> References: <1342433652-3339-1-git-send-email-jing.huang.pku@gmail.com> Date: Mon, 16 Jul 2012 11:23:20 +0800 Message-ID: From: Dunrong Huang Content-Type: text/plain; charset=ISO-8859-1 Subject: Re: [Qemu-devel] [PATCH v2 2/3] linux-user: make do_setsockopt support SOL_RAW ICMP_FILTER socket option List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Jing Huang Cc: peter.maydell@linaro.org, riku.voipio@iki.fi, qemu-devel@nongnu.org 2012/7/16 Jing Huang : > 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; Needless assignment statements. optname already has the value 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))); Dont need casting &val to char *. > + break; > + default: > + goto unimplemented; > + } > + break; > case TARGET_SOL_SOCKET: > switch (optname) { > /* Options with 'int' argument. */ > -- > 1.7.8.6 > > -- Best Regards, Dunrong Huang