From nobody Tue Feb 10 02:43:02 2026 Delivered-To: importer@patchew.org Received-SPF: temperror (zoho.com: Error in retrieving data from DNS) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=temperror (zoho.com: Error in retrieving data from DNS) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1556110888; cv=none; d=zoho.com; s=zohoarc; b=gpDYugoV7+gR/aezc1L23BpimXub27RSCWWifwWCr4f6HQnBtR6Q+BYWZ4vt3WrHNzHtB3W9dQK0FVy7HB18z8tEMVwFW8dA9wsMaV6BnOnaAwxWVlDBG11siv0SsWlpjlhI+bFaSPrpxeqKppcbBq0YlS9mUkGqk5OMJyHMDuQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1556110888; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=lNhTLG21JHNoQsaNwvCkUkz5V/brFnul4AMLlQkD1Ig=; b=G2BaT5oNoT+6rGgjL/TjdtdPq+JHM8o8Md785IL9g2cnrlMwp0ulJFtyW4DVv8rt7/ukVcUPJIHlPAao0ruWUqjo9a/V7X/CncqdaxiX/jCui2n2O+YxuanDL+zcVLkdLYnepq3whMut8vKkO+owS8Bz8fieNSVu6dWiopW6cpg= ARC-Authentication-Results: i=1; mx.zoho.com; spf=temperror (zoho.com: Error in retrieving data from DNS) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 15561108889867.109936331692211; Wed, 24 Apr 2019 06:01:28 -0700 (PDT) Received: from localhost ([127.0.0.1]:41352 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hJHWa-0003cW-Th for importer@patchew.org; Wed, 24 Apr 2019 09:01:20 -0400 Received: from eggs.gnu.org ([209.51.188.92]:47810) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hJHUq-0002at-AK for qemu-devel@nongnu.org; Wed, 24 Apr 2019 08:59:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hJHUY-0000mo-VJ for qemu-devel@nongnu.org; Wed, 24 Apr 2019 08:59:27 -0400 Received: from mx2.rt-rk.com ([89.216.37.149]:54895 helo=mail.rt-rk.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hJHUX-0007qf-PZ for qemu-devel@nongnu.org; Wed, 24 Apr 2019 08:59:14 -0400 Received: from localhost (localhost [127.0.0.1]) by mail.rt-rk.com (Postfix) with ESMTP id 98B071A413F; Wed, 24 Apr 2019 14:58:11 +0200 (CEST) Received: from rtrkw774-lin.domain.local (rtrkw774-lin.domain.local [10.10.13.43]) by mail.rt-rk.com (Postfix) with ESMTPSA id 3F8631A23E6; Wed, 24 Apr 2019 14:58:11 +0200 (CEST) X-Virus-Scanned: amavisd-new at rt-rk.com From: Aleksandar Markovic To: qemu-devel@nongnu.org Date: Wed, 24 Apr 2019 14:57:02 +0200 Message-Id: <1556110623-655-5-git-send-email-aleksandar.markovic@rt-rk.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1556110623-655-1-git-send-email-aleksandar.markovic@rt-rk.com> References: <1556110623-655-1-git-send-email-aleksandar.markovic@rt-rk.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 89.216.37.149 Subject: [Qemu-devel] [PATCH v2 4/5] linux-user: setsockopt(): Add support for the option IPV6_ADD_MEMBERSHIP X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lvivier@redhat.com, thuth@redhat.com, jcmvbkbc@gmail.com, arikalo@wavecomp.com, daniel.santos@pobox.com, amarkovic@wavecomp.com, Neng Chen , philmd@redhat.com, aurelien@aurel32.net Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Neng Chen Add support for the option IPV6_ADD_MEMBERSHIP of the syscall setsockopt(). This option controls membership in multicast groups. Argument is a pointer to a struct ipv6_mreq, which is in turn defined in a platform-inedependant manner in the Linux kernel file include/uapi/linux/in6.h as: The header defines the ipv6_mreq structure, which includes the following members: struct in6_addr ipv6mr_multiaddr /* IPv6 multicast address */ unsigned int ipv6mr_interface /* local interface index */ struct ipv6_mreq { /* IPv6 multicast address of group */ struct in6_addr ipv6mr_multiaddr; /* local IPv6 address of interface */ int ipv6mr_ifindex; }; The header also defines the in6_addr structure, which a union of the following structure: struct in6_addr { union { __u8 u6_addr8[16]; __be16 u6_addr16[8]; __be32 u6_addr32[4]; } in6_u; The emulation behavior of IPV6_ADD_MEMBERSHIP is devised based on the definitions above. Signed-off-by: Neng Chen Signed-off-by: Aleksandar Markovic --- linux-user/syscall.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 96cd4bf..b47a45d 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -1892,6 +1892,24 @@ static abi_long do_setsockopt(int sockfd, int level,= int optname, &pki, sizeof(pki))); break; } + case IPV6_ADD_MEMBERSHIP: + { + struct ipv6_mreq ipv6mreq; + + if (optlen < sizeof(ipv6mreq)) { + return -TARGET_EINVAL; + } + + if (copy_from_user(&ipv6mreq, optval_addr, sizeof(ipv6mreq))) { + return -TARGET_EFAULT; + } + + ipv6mreq.ipv6mr_interface =3D tswap32(ipv6mreq.ipv6mr_interfac= e); + + ret =3D get_errno(setsockopt(sockfd, level, optname, + &ipv6mreq, sizeof(ipv6mreq))); + break; + } default: goto unimplemented; } --=20 2.7.4