Skip to content

Commit 24cf3af

Browse files
Veaceslav Falicodavem330
authored andcommitted
igmp: call ip_mc_clear_src() only when we have no users of ip_mc_list
In igmp_group_dropped() we call ip_mc_clear_src(), which resets the number of source filters per mulitcast. However, igmp_group_dropped() is also called on NETDEV_DOWN, NETDEV_PRE_TYPE_CHANGE and NETDEV_UNREGISTER, which means that the group might get added back on NETDEV_UP, NETDEV_REGISTER and NETDEV_POST_TYPE_CHANGE respectively, leaving us with broken source filters. To fix that, we must clear the source filters only when there are no users in the ip_mc_list, i.e. in ip_mc_dec_group() and on device destroy. Acked-by: David L Stevens <[email protected]> Signed-off-by: Veaceslav Falico <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent be3fc41 commit 24cf3af

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

net/ipv4/igmp.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1155,20 +1155,18 @@ static void igmp_group_dropped(struct ip_mc_list *im)
11551155

11561156
if (!in_dev->dead) {
11571157
if (IGMP_V1_SEEN(in_dev))
1158-
goto done;
1158+
return;
11591159
if (IGMP_V2_SEEN(in_dev)) {
11601160
if (reporter)
11611161
igmp_send_report(in_dev, im, IGMP_HOST_LEAVE_MESSAGE);
1162-
goto done;
1162+
return;
11631163
}
11641164
/* IGMPv3 */
11651165
igmpv3_add_delrec(in_dev, im);
11661166

11671167
igmp_ifc_event(in_dev);
11681168
}
1169-
done:
11701169
#endif
1171-
ip_mc_clear_src(im);
11721170
}
11731171

11741172
static void igmp_group_added(struct ip_mc_list *im)
@@ -1305,6 +1303,7 @@ void ip_mc_dec_group(struct in_device *in_dev, __be32 addr)
13051303
*ip = i->next_rcu;
13061304
in_dev->mc_count--;
13071305
igmp_group_dropped(i);
1306+
ip_mc_clear_src(i);
13081307

13091308
if (!in_dev->dead)
13101309
ip_rt_multicast_event(in_dev);
@@ -1414,7 +1413,8 @@ void ip_mc_destroy_dev(struct in_device *in_dev)
14141413
in_dev->mc_list = i->next_rcu;
14151414
in_dev->mc_count--;
14161415

1417-
igmp_group_dropped(i);
1416+
/* We've dropped the groups in ip_mc_down already */
1417+
ip_mc_clear_src(i);
14181418
ip_ma_put(i);
14191419
}
14201420
}

0 commit comments

Comments
 (0)