Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 29 Apr 2009 09:58:31 +0000 (UTC)
From:      Bruce M Simpson <bms@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r191654 - head/lib/libc/net
Message-ID:  <200904290958.n3T9wVdI075616@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: bms
Date: Wed Apr 29 09:58:31 2009
New Revision: 191654
URL: http://svn.freebsd.org/changeset/base/191654

Log:
  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.
  
  MFC after:	1 day

Modified:
  head/lib/libc/net/sourcefilter.c

Modified: head/lib/libc/net/sourcefilter.c
==============================================================================
--- head/lib/libc/net/sourcefilter.c	Wed Apr 29 09:54:33 2009	(r191653)
+++ head/lib/libc/net/sourcefilter.c	Wed Apr 29 09:58:31 2009	(r191654)
@@ -337,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) {
@@ -345,6 +345,7 @@ getsourcefilter(int s, uint32_t interfac
 		return (-1);
 	}
 
+	nsrcs = *numsrc;
 	*numsrc = 0;
 	*fmode = 0;
 
@@ -382,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);
 
 	/*



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200904290958.n3T9wVdI075616>