From owner-svn-src-all@FreeBSD.ORG Sun May 17 15:42:41 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 D82A9106567D; Sun, 17 May 2009 15:42:41 +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 C6C038FC1C; Sun, 17 May 2009 15:42:41 +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 n4HFgfDh031721; Sun, 17 May 2009 15:42:41 GMT (envelope-from bms@svn.freebsd.org) Received: (from bms@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4HFgfqj031720; Sun, 17 May 2009 15:42:41 GMT (envelope-from bms@svn.freebsd.org) Message-Id: <200905171542.n4HFgfqj031720@svn.freebsd.org> From: Bruce M Simpson Date: Sun, 17 May 2009 15:42:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192251 - stable/7/lib/libc/net 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: Sun, 17 May 2009 15:42:42 -0000 Author: bms Date: Sun May 17 15:42:41 2009 New Revision: 192251 URL: http://svn.freebsd.org/changeset/base/192251 Log: MFC rev 191654: Fix an obvious bug in getsourcefilter()'s use of struct __msfilterreq; the kernel will return in msfr_nsrcs the number of source filters in-mode for a given multicast group. However, the filters themselves were never copied out, as the libc function clobbers this field with zero, causing the kernel to assume the provided vector of struct sockaddr_storage has zero length. This bug would only affect users of SSM multicast, which is shimmed in 7.x. Picked up during mtest(8) refactoring. Modified: stable/7/lib/libc/net/sourcefilter.c Modified: stable/7/lib/libc/net/sourcefilter.c ============================================================================== --- stable/7/lib/libc/net/sourcefilter.c Sun May 17 12:30:25 2009 (r192250) +++ stable/7/lib/libc/net/sourcefilter.c Sun May 17 15:42:41 2009 (r192251) @@ -1,6 +1,6 @@ /*- - * Copyright (c) 2007 Bruce M. Simpson. - * All rights reserved + * Copyright (c) 2007-2009 Bruce Simpson. + * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -10,21 +10,18 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 4. Neither the name of Bruce M. Simpson nor the names of other - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. * - * THIS SOFTWARE IS PROVIDED BY BRUCE M. SIMPSON AND AFFILIATES - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BRUCE M. SIMPSON OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. */ #include @@ -340,7 +337,7 @@ getsourcefilter(int s, uint32_t interfac { struct __msfilterreq msfr; sockunion_t *psu; - int err, level, optlen, optname; + int err, level, nsrcs, optlen, optname; if (interface == 0 || group == NULL || numsrc == NULL || fmode == NULL) { @@ -348,6 +345,7 @@ getsourcefilter(int s, uint32_t interfac return (-1); } + nsrcs = *numsrc; *numsrc = 0; *fmode = 0; @@ -385,7 +383,7 @@ getsourcefilter(int s, uint32_t interfac memset(&msfr, 0, optlen); msfr.msfr_ifindex = interface; msfr.msfr_fmode = 0; - msfr.msfr_nsrcs = *numsrc; + msfr.msfr_nsrcs = nsrcs; memcpy(&msfr.msfr_group, &psu->ss, psu->ss.ss_len); /*