Re: [PATCH 1/1] igmp: fix ip_mc_clear_src to not reset ip_mc_list->sf{mode,count}

From: David Stevens
Date: Mon May 16 2011 - 16:42:37 EST

> From: Veaceslav Falico <vfalico@xxxxxxxxxx>
> Date: Sun, 15 May 2011 18:59:45 +0200
> > ip_mc_clear_src resets the imc->sfcount and imc->sfmode, without
taking into
> > account the current number of sockets listening on that multicast
> struct, which
> > can lead to bogus routes for local listeners.
> >
> > On NETDEV_DOWN/UP event, if there were 3 multicast listeners for
> that interface's
> > address, the imc->sfcount[MCAST_EXCLUDE] will be reset to 1. And
> after that a
> > listener socket destroys, multicast traffic will not be delivered to
> > listeners because __mkroute_output drops the local flag for the route
> > checking ip_check_mc).

On NETDEV_DOWN, all group memberships are dropped.
is simply freeing all the source filters and turning it into an "EXCLUDE
membership (ie, the same as an ordinary join without source filtering).
ordinarily happens when you are deleting the group entirely (when the
count goes to 0), but is also called on device down.
This patch is not appropriate; when the groups are deleted, the
filters are deleted, and the filter counts have to reflect the source
in the list. If you had an "INCLUDE A" filter, for example, that would
an "INCLUDE nobody" filter and drop all traffic (from A or not). The
of source filters is not related to the number of listener sockets, and
function of ip_mc_clear_src() is to make it 0 (with the special case of 1
EXCLUDE), so setting the counts has to be done for proper functioning.
I don't quite understand the problem you're trying to solve here
when the device comes back up, the group should be re-added with
{EXCLUDE,nobody} and
ip_check_mc() should therefore return 1. Of course, while the interface is
down, the mc_list is empty and it'd return 0 in that case.
Do you have a small test program to demonstrate the problem?

For the patch, I have to say NACK.


To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at