From owner-svn-src-all@FreeBSD.ORG Sat Jul 18 17:38:18 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6CE8C1065695; Sat, 18 Jul 2009 17:38:18 +0000 (UTC) (envelope-from bms@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5BACE8FC16; Sat, 18 Jul 2009 17:38:18 +0000 (UTC) (envelope-from bms@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n6IHcIM4007530; Sat, 18 Jul 2009 17:38:18 GMT (envelope-from bms@svn.freebsd.org) Received: (from bms@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n6IHcIrs007528; Sat, 18 Jul 2009 17:38:18 GMT (envelope-from bms@svn.freebsd.org) Message-Id: <200907181738.n6IHcIrs007528@svn.freebsd.org> From: Bruce M Simpson Date: Sat, 18 Jul 2009 17:38:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r195755 - head/sys/netinet6 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 18 Jul 2009 17:38:19 -0000 Author: bms Date: Sat Jul 18 17:38:18 2009 New Revision: 195755 URL: http://svn.freebsd.org/changeset/base/195755 Log: Fix a problem, whereby misbehaving IPv6 applications, which don't include a valid zone ID or interface identifier in a v6 multicast leave, would trigger a fairly paranoid KASSERT(). Observed with Boost++ regression tests on ref8.freebsd.org. Approved by: re (kib) Modified: head/sys/netinet6/in6_mcast.c Modified: head/sys/netinet6/in6_mcast.c ============================================================================== --- head/sys/netinet6/in6_mcast.c Sat Jul 18 16:33:27 2009 (r195754) +++ head/sys/netinet6/in6_mcast.c Sat Jul 18 17:38:18 2009 (r195755) @@ -2160,14 +2160,24 @@ in6p_leave_group(struct inpcb *inp, stru if (error) return (EADDRNOTAVAIL); /* + * Some badly behaved applications don't pass an ifindex + * or a scope ID, which is an API violation. In this case, + * perform a lookup as per a v6 join. + * * XXX For now, stomp on zone ID for the corner case. * This is not the 'KAME way', but we need to see the ifp * directly until such time as this implementation is * refactored, assuming the scope IDs are the way to go. */ ifindex = ntohs(gsa->sin6.sin6_addr.s6_addr16[1]); - KASSERT(ifindex != 0, ("%s: bad zone ID", __func__)); - ifp = ifnet_byindex(ifindex); + if (ifindex == 0) { + CTR2(KTR_MLD, "%s: warning: no ifindex, looking up " + "ifp for group %s.", __func__, + ip6_sprintf(ip6tbuf, &gsa->sin6.sin6_addr)); + ifp = in6p_lookup_mcast_ifp(inp, &gsa->sin6); + } else { + ifp = ifnet_byindex(ifindex); + } if (ifp == NULL) return (EADDRNOTAVAIL); }