From owner-freebsd-net@FreeBSD.ORG Wed Sep 3 12:20:33 2014 Return-Path: Delivered-To: freebsd-net@FreeBSD.org Received: from mx2.freebsd.org (mx2.freebsd.org [8.8.178.116]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 930BDDBB; Wed, 3 Sep 2014 12:20:33 +0000 (UTC) Received: from butcher-nb.yandex.net (hub.freebsd.org [IPv6:2001:1900:2254:206c::16:88]) by mx2.freebsd.org (Postfix) with ESMTP id C5D484A2C; Wed, 3 Sep 2014 12:20:32 +0000 (UTC) Message-ID: <54070758.2050405@FreeBSD.org> Date: Wed, 03 Sep 2014 16:19:36 +0400 From: "Andrey V. Elsukov" User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:24.0) Gecko/20100101 Thunderbird/24.5.0 MIME-Version: 1.0 To: bugzilla-noreply@freebsd.org, freebsd-net@FreeBSD.org Subject: Re: [Bug 193246] Bug in IPv6 multicast join(), uncovered by Jenkins References: In-Reply-To: X-Enigmail-Version: 1.6 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit 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: Wed, 03 Sep 2014 12:20:33 -0000 On 03.09.2014 14:05, bugzilla-noreply@freebsd.org wrote: > In FreeBSD, in src/sys/netinet6/in6_mcast.c inside in6p_join_group(), there > is this: > > if (!IN6_IS_ADDR_MULTICAST(&gsa->sin6.sin6_addr)) > return (EINVAL); > > Since IN6_IS_ADDR_MULTICAST() only checks if the first octet is 0xff, that is > what is returning the EINVAL. So the JDK is creating > an IPV4 multicast address mapped inside an IPV6 address. The FreeBSD > kernel code is rejecting this as a valid IPV6 multicast address. > > I'm not sure if it is better to fix this in the kernel or the JDK. 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; -- WBR, Andrey V. Elsukov