igmp: do not remove igmp souce list info when set link down
authorHangbin Liu <liuhangbin@gmail.com>
Mon, 14 Nov 2016 08:16:28 +0000 (16:16 +0800)
committerBen Hutchings <ben@decadent.org.uk>
Thu, 16 Mar 2017 02:18:57 +0000 (02:18 +0000)
commitbd1b664a19403ede448d29c87b2f23796bc7a577
tree5ec29fc0090c6f794fd07929aa77f318659a3ba3
parent43df37dbc66707afbf8a93cc9f6430b31be3931e
igmp: do not remove igmp souce list info when set link down

commit 24803f38a5c0b6c57ed800b47e695f9ce474bc3a upstream.

In commit 24cf3af3fed5 ("igmp: call ip_mc_clear_src..."), we forgot to remove
igmpv3_clear_delrec() in ip_mc_down(), which also called ip_mc_clear_src().
This make us clear all IGMPv3 source filter info after NETDEV_DOWN.
Move igmpv3_clear_delrec() to ip_mc_destroy_dev() and then no need
ip_mc_clear_src() in ip_mc_destroy_dev().

On the other hand, we should restore back instead of free all source filter
info in igmpv3_del_delrec(). Or we will not able to restore IGMPv3 source
filter info after NETDEV_UP and NETDEV_POST_TYPE_CHANGE.

Fixes: 24cf3af3fed5 ("igmp: call ip_mc_clear_src() only when ...")
Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
[bwh: Backported to 3.2:
 - Use IGMP_Unsolicited_Report_Count instead of sysctl_igmp_qrv
 - Adjust context]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
net/ipv4/igmp.c