svn commit: r191654 - head/lib/libc/net
Bruce M Simpson
bms at FreeBSD.org
Wed Apr 29 09:58:31 UTC 2009
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);
/*
More information about the svn-src-head
mailing list