aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--net/ipv6/mcast.c34
1 files changed, 30 insertions, 4 deletions
diff --git a/net/ipv6/mcast.c b/net/ipv6/mcast.c
index 005b22fd6bcb..c916568d838a 100644
--- a/net/ipv6/mcast.c
+++ b/net/ipv6/mcast.c
@@ -1112,11 +1112,34 @@ static bool mld_marksources(struct ifmcaddr6 *pmc, int nsrcs,
1112 return true; 1112 return true;
1113} 1113}
1114 1114
1115static int mld_force_mld_version(const struct inet6_dev *idev)
1116{
1117 /* Normally, both are 0 here. If enforcement to a particular is
1118 * being used, individual device enforcement will have a lower
1119 * precedence over 'all' device (.../conf/all/force_mld_version).
1120 */
1121
1122 if (dev_net(idev->dev)->ipv6.devconf_all->force_mld_version != 0)
1123 return dev_net(idev->dev)->ipv6.devconf_all->force_mld_version;
1124 else
1125 return idev->cnf.force_mld_version;
1126}
1127
1128static bool mld_in_v2_mode_only(const struct inet6_dev *idev)
1129{
1130 return mld_force_mld_version(idev) == 2;
1131}
1132
1133static bool mld_in_v1_mode_only(const struct inet6_dev *idev)
1134{
1135 return mld_force_mld_version(idev) == 1;
1136}
1137
1115static bool mld_in_v1_mode(const struct inet6_dev *idev) 1138static bool mld_in_v1_mode(const struct inet6_dev *idev)
1116{ 1139{
1117 if (dev_net(idev->dev)->ipv6.devconf_all->force_mld_version == 1) 1140 if (mld_in_v2_mode_only(idev))
1118 return true; 1141 return false;
1119 if (idev->cnf.force_mld_version == 1) 1142 if (mld_in_v1_mode_only(idev))
1120 return true; 1143 return true;
1121 if (idev->mc_v1_seen && time_before(jiffies, idev->mc_v1_seen)) 1144 if (idev->mc_v1_seen && time_before(jiffies, idev->mc_v1_seen))
1122 return true; 1145 return true;
@@ -1223,7 +1246,6 @@ int igmp6_event_query(struct sk_buff *skb)
1223 return -EINVAL; 1246 return -EINVAL;
1224 1247
1225 idev = __in6_dev_get(skb->dev); 1248 idev = __in6_dev_get(skb->dev);
1226
1227 if (idev == NULL) 1249 if (idev == NULL)
1228 return 0; 1250 return 0;
1229 1251
@@ -1236,6 +1258,10 @@ int igmp6_event_query(struct sk_buff *skb)
1236 return -EINVAL; 1258 return -EINVAL;
1237 1259
1238 if (len == MLD_V1_QUERY_LEN) { 1260 if (len == MLD_V1_QUERY_LEN) {
1261 /* Ignore v1 queries */
1262 if (mld_in_v2_mode_only(idev))
1263 return 0;
1264
1239 /* MLDv1 router present */ 1265 /* MLDv1 router present */
1240 max_delay = msecs_to_jiffies(ntohs(mld->mld_maxdelay)); 1266 max_delay = msecs_to_jiffies(ntohs(mld->mld_maxdelay));
1241 1267