ipv4: igmp: Allow removing groups from a removed interface
authorAndrew Lunn <andrew@lunn.ch>
Tue, 1 Dec 2015 15:31:08 +0000 (16:31 +0100)
committerWilly Tarreau <w@1wt.eu>
Fri, 29 Jan 2016 21:12:47 +0000 (22:12 +0100)
commit5f4876761cb8a57db5cb8dc856961b6a24944c67
treecef6714c3cb499623b5b9f9dbac4d83b401612fa
parentabffc10c391bd6e46f9fe4ddef1c557307a8dece
ipv4: igmp: Allow removing groups from a removed interface

commit 4eba7bb1d72d9bde67d810d09bf62dc207b63c5c upstream.

When a multicast group is joined on a socket, a struct ip_mc_socklist
is appended to the sockets mc_list containing information about the
joined group.

If the interface is hot unplugged, this entry becomes stale. Prior to
commit 52ad353a5344f ("igmp: fix the problem when mc leave group") it
was possible to remove the stale entry by performing a
IP_DROP_MEMBERSHIP, passing either the old ifindex or ip address on
the interface. However, this fix enforces that the interface must
still exist. Thus with time, the number of stale entries grows, until
sysctl_igmp_max_memberships is reached and then it is not possible to
join and more groups.

The previous patch fixes an issue where a IP_DROP_MEMBERSHIP is
performed without specifying the interface, either by ifindex or ip
address. However here we do supply one of these. So loosen the
restriction on device existence to only apply when the interface has
not been specified. This then restores the ability to clean up the
stale entries.

Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Fixes: 52ad353a5344f "(igmp: fix the problem when mc leave group")
Signed-off-by: David S. Miller <davem@davemloft.net>
[bwh: Backported to 3.2: adjust context]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
(cherry picked from commit b1fa852672fb1ea4b0e34bfa1136bb65dba66151)
Signed-off-by: Willy Tarreau <w@1wt.eu>
net/ipv4/igmp.c