From owner-freebsd-net@FreeBSD.ORG Thu Sep 4 15:56:07 2014 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id D39153CC; Thu, 4 Sep 2014 15:56:07 +0000 (UTC) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9D4331CEE; Thu, 4 Sep 2014 15:56:07 +0000 (UTC) Received: from ralph.baldwin.cx (pool-173-70-85-31.nwrknj.fios.verizon.net [173.70.85.31]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 685D7B95E; Thu, 4 Sep 2014 11:56:06 -0400 (EDT) From: John Baldwin To: freebsd-net@freebsd.org Subject: Re: [Bug 193246] Bug in IPv6 multicast join(), uncovered by Jenkins Date: Thu, 04 Sep 2014 10:42:59 -0400 Message-ID: <3393302.jtrfEtP2nm@ralph.baldwin.cx> User-Agent: KMail/4.10.5 (FreeBSD/10.0-STABLE; KDE/4.10.5; amd64; ; ) In-Reply-To: References: <54070758.2050405@FreeBSD.org> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Thu, 04 Sep 2014 11:56:06 -0400 (EDT) Cc: Craig Rodrigues , "Andrey V. Elsukov" , bugzilla-noreply@freebsd.org X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Sep 2014 15:56:08 -0000 On Wednesday, September 03, 2014 06:39:53 AM Craig Rodrigues wrote: > On Wed, Sep 3, 2014 at 5:19 AM, Andrey V. Elsukov wrote: > > On 03.09.2014 14:05, bugzilla-noreply@freebsd.org wrote: > > > > Hi, > > > > you said that this code works in linux. I looked in the linux kernel > > source, and I think it should return EINVAL too. > > > > net/ipv6/mcast.c:ipv6_sock_mc_join: > > 154 if (!ipv6_addr_is_multicast(addr)) > > 155 return -EINVAL; > > The code does work in Linux. However, you need to look at the > JDK source, not the Linux kernel source. > > In this file: > http://hg.openjdk.java.net/jdk7/jdk7/jdk/file/9b8c96f96a0f/src/solaris/nativ > e/java/net/PlainDatagramSocketImpl.c > > in the mcast_join_leave() function, there are two code paths: (1) > Linux, (2) Solaris. > > It looks like on Solaris, they support IPv4-mapped multicast addresses for > IPV6, and things work when they create an IPv6 socket, and then put an > IPv4-mapped multicast address in it. For Linux, they have specific > code paths in that function which seem to force creating an IPv4 > socket. >From looking at the source, it doesn't look like the Linux workaround (using IP_ADD_MEMBERSHIP on an AF_INET6 socket) will work on FreeBSD. I'm not sure how hard it would be to fix in6_mcast.c to support IPv4 groups. bms@ might know. -- John Baldwin