[patch] Multicast: uninited memory used in filter at IP_DROP_MEMBERSHIP + IP_ADD_MEMBERSHIP

Stef Walter stef-list at memberwebs.com
Wed Sep 9 21:11:29 UTC 2009


If a multicast caller does an IP_DROP_MEMBERSHIP followed by a
IP_ADD_MEMBERSHIP, often an uninitialized filter is used for the
in_mfilter passed to in_joingroup_locked() in netinet/in_mcast.c.

The IP_ADD_MEMBERSHIP and IP_DROP_MEMBERSHIP have simple in_mreq input,
and are not using SSM or any of the new IGMPv3 features.

This results in the following behavior shown by ifmcstat. Before the
drop + add you can see the following groups for the northstar1
interface. Note that 224.0.0.5 (ie: OSPF-ALL.MCAST.NET) is subscribed
with an empty exclude filter as you would expect from simple ASM mode:

> # ifmcstat -i northstar1
> northstar1:
> 	inet 172.28.1.66
> 	igmpv3 flags=0<> rv 2 qi 125 qri 10 uri 3
> 		group 224.0.0.5 mode exclude
> 		group 224.0.0.1 mode exclude

After the drop + add, it looks like the following. Note that now
224.0.0.5 is subscribed with an empty *include* filter which results in
no packets received.

> # ifmcstat -i northstar1
> northstar1:
> 	inet 172.28.1.66
> 	igmpv3 flags=0<> rv 2 qi 125 qri 10 uri 3
> 		group 224.0.0.1 mode exclude
> 		group 224.0.0.5 mode include

uname: FreeBSD portillo-gate.ws.local 8.0-BETA3 FreeBSD 8.0-BETA3 #24:
Wed Sep  9 15:01:39 UTC 2009
root at portillo-gate.ws.local:/usr/src/sys/i386/compile/PORTILLO  i386

Patch is attached which fixes the problem. Is this the right approach?
If not, I hope it helps highlight the problem area.

Cheers,

Stef

-------------- next part --------------
A non-text attachment was scrubbed...
Name: freebsd-mcast-uninited.patch
Type: text/x-diff
Size: 339 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-net/attachments/20090909/48be30e2/freebsd-mcast-uninited.bin


More information about the freebsd-net mailing list