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
This commit is contained in:
parent
a782d76533
commit
259233890b
@ -337,7 +337,7 @@ getsourcefilter(int s, uint32_t interface, struct sockaddr *group,
|
||||
{
|
||||
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 interface, struct sockaddr *group,
|
||||
return (-1);
|
||||
}
|
||||
|
||||
nsrcs = *numsrc;
|
||||
*numsrc = 0;
|
||||
*fmode = 0;
|
||||
|
||||
@ -382,7 +383,7 @@ getsourcefilter(int s, uint32_t interface, struct sockaddr *group,
|
||||
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);
|
||||
|
||||
/*
|
||||
|
Loading…
x
Reference in New Issue
Block a user