From owner-svn-src-head@FreeBSD.ORG Thu Nov 19 13:33:24 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0A2FE1065693; Thu, 19 Nov 2009 13:33:24 +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 D4A4D8FC0C; Thu, 19 Nov 2009 13:33:23 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nAJDXNQw008049; Thu, 19 Nov 2009 13:33:23 GMT (envelope-from bms@svn.freebsd.org) Received: (from bms@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nAJDXNvT008047; Thu, 19 Nov 2009 13:33:23 GMT (envelope-from bms@svn.freebsd.org) Message-Id: <200911191333.nAJDXNvT008047@svn.freebsd.org> From: Bruce M Simpson Date: Thu, 19 Nov 2009 13:33:23 +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: r199527 - head/sys/netinet6 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Nov 2009 13:33:24 -0000 Author: bms Date: Thu Nov 19 13:33:23 2009 New Revision: 199527 URL: http://svn.freebsd.org/changeset/base/199527 Log: Adapt r197135 to IPv6 stack: Don't allow joins w/o source on an existing group. This is almost always pilot error. We don't need to check for group filter UNDEFINED state at t1, because we only ever allocate filters with their groups, so we unconditionally reject such calls with EINVAL. Trying to change the active filter mode w/o going through IPV6_MSFILTER is also disallowed. MFC after: 1 day Modified: head/sys/netinet6/in6_mcast.c Modified: head/sys/netinet6/in6_mcast.c ============================================================================== --- head/sys/netinet6/in6_mcast.c Thu Nov 19 13:30:06 2009 (r199526) +++ head/sys/netinet6/in6_mcast.c Thu Nov 19 13:33:23 2009 (r199527) @@ -1942,15 +1942,18 @@ in6p_join_group(struct inpcb *inp, struc } } else { /* - * MCAST_JOIN_GROUP on an existing inclusive - * membership is an error; if you want to change - * filter mode, you must use the userland API - * setsourcefilter(). + * MCAST_JOIN_GROUP alone, on any existing membership, + * is rejected, to stop the same inpcb tying up + * multiple refs to the in_multi. + * On an existing inclusive membership, this is also + * an error; if you want to change filter mode, + * you must use the userland API setsourcefilter(). + * XXX We don't reject this for imf in UNDEFINED + * state at t1, because allocation of a filter + * is atomic with allocation of a membership. */ - if (imf->im6f_st[1] == MCAST_INCLUDE) { - error = EINVAL; - goto out_in6p_locked; - } + error = EINVAL; + goto out_in6p_locked; } } @@ -1985,6 +1988,9 @@ in6p_join_group(struct inpcb *inp, struc * membership of the group. The in6_multi may not have * been allocated yet if this is a new membership, however, * the in_mfilter slot will be allocated and must be initialized. + * + * Note: Grafting of exclusive mode filters doesn't happen + * in this path. */ if (ssa->ss.ss_family != AF_UNSPEC) { /* Membership starts in IN mode */