]> git.kernelconcepts.de Git - karo-tx-linux.git/blobdiff - net/ipv4/igmp.c
ipip: Setup and TX path for ipip/UDP foo-over-udp encapsulation
[karo-tx-linux.git] / net / ipv4 / igmp.c
index f10eab462282b1afa80bcc3e7bac7f862ab9709f..4146153d875d3ea9a35fa1b53ac01f76bf420e45 100644 (file)
 #define IGMP_V2_Unsolicited_Report_Interval    (10*HZ)
 #define IGMP_V3_Unsolicited_Report_Interval    (1*HZ)
 #define IGMP_Query_Response_Interval           (10*HZ)
-#define IGMP_Unsolicited_Report_Count          2
+#define IGMP_Query_Robustness_Variable         2
 
 
 #define IGMP_Initial_Report_Delay              (1)
@@ -756,8 +756,7 @@ static void igmp_ifc_event(struct in_device *in_dev)
 {
        if (IGMP_V1_SEEN(in_dev) || IGMP_V2_SEEN(in_dev))
                return;
-       in_dev->mr_ifc_count = in_dev->mr_qrv ? in_dev->mr_qrv :
-               IGMP_Unsolicited_Report_Count;
+       in_dev->mr_ifc_count = in_dev->mr_qrv ?: sysctl_igmp_qrv;
        igmp_ifc_start_timer(in_dev, 1);
 }
 
@@ -1086,8 +1085,7 @@ static void igmpv3_add_delrec(struct in_device *in_dev, struct ip_mc_list *im)
        pmc->interface = im->interface;
        in_dev_hold(in_dev);
        pmc->multiaddr = im->multiaddr;
-       pmc->crcount = in_dev->mr_qrv ? in_dev->mr_qrv :
-               IGMP_Unsolicited_Report_Count;
+       pmc->crcount = in_dev->mr_qrv ?: sysctl_igmp_qrv;
        pmc->sfmode = im->sfmode;
        if (pmc->sfmode == MCAST_INCLUDE) {
                struct ip_sf_list *psf;
@@ -1226,8 +1224,7 @@ static void igmp_group_added(struct ip_mc_list *im)
        }
        /* else, v3 */
 
-       im->crcount = in_dev->mr_qrv ? in_dev->mr_qrv :
-               IGMP_Unsolicited_Report_Count;
+       im->crcount = in_dev->mr_qrv ?: sysctl_igmp_qrv;
        igmp_ifc_event(in_dev);
 #endif
 }
@@ -1322,7 +1319,7 @@ void ip_mc_inc_group(struct in_device *in_dev, __be32 addr)
        spin_lock_init(&im->lock);
 #ifdef CONFIG_IP_MULTICAST
        setup_timer(&im->timer, igmp_timer_expire, (unsigned long)im);
-       im->unsolicit_count = IGMP_Unsolicited_Report_Count;
+       im->unsolicit_count = sysctl_igmp_qrv;
 #endif
 
        im->next_rcu = in_dev->mc_list;
@@ -1460,7 +1457,7 @@ void ip_mc_init_dev(struct in_device *in_dev)
                        (unsigned long)in_dev);
        setup_timer(&in_dev->mr_ifc_timer, igmp_ifc_timer_expire,
                        (unsigned long)in_dev);
-       in_dev->mr_qrv = IGMP_Unsolicited_Report_Count;
+       in_dev->mr_qrv = sysctl_igmp_qrv;
 #endif
 
        spin_lock_init(&in_dev->mc_tomb_lock);
@@ -1474,6 +1471,9 @@ void ip_mc_up(struct in_device *in_dev)
 
        ASSERT_RTNL();
 
+#ifdef CONFIG_IP_MULTICAST
+       in_dev->mr_qrv = sysctl_igmp_qrv;
+#endif
        ip_mc_inc_group(in_dev, IGMP_ALL_HOSTS);
 
        for_each_pmc_rtnl(in_dev, pmc)
@@ -1540,7 +1540,9 @@ static struct in_device *ip_mc_find_dev(struct net *net, struct ip_mreqn *imr)
  */
 int sysctl_igmp_max_memberships __read_mostly = IP_MAX_MEMBERSHIPS;
 int sysctl_igmp_max_msf __read_mostly = IP_MAX_MSF;
-
+#ifdef CONFIG_IP_MULTICAST
+int sysctl_igmp_qrv __read_mostly = IGMP_Query_Robustness_Variable;
+#endif
 
 static int ip_mc_del1_src(struct ip_mc_list *pmc, int sfmode,
        __be32 *psfsrc)
@@ -1575,8 +1577,7 @@ static int ip_mc_del1_src(struct ip_mc_list *pmc, int sfmode,
 #ifdef CONFIG_IP_MULTICAST
                if (psf->sf_oldin &&
                    !IGMP_V1_SEEN(in_dev) && !IGMP_V2_SEEN(in_dev)) {
-                       psf->sf_crcount = in_dev->mr_qrv ? in_dev->mr_qrv :
-                               IGMP_Unsolicited_Report_Count;
+                       psf->sf_crcount = in_dev->mr_qrv ?: sysctl_igmp_qrv;
                        psf->sf_next = pmc->tomb;
                        pmc->tomb = psf;
                        rv = 1;
@@ -1639,8 +1640,7 @@ static int ip_mc_del_src(struct in_device *in_dev, __be32 *pmca, int sfmode,
                /* filter mode change */
                pmc->sfmode = MCAST_INCLUDE;
 #ifdef CONFIG_IP_MULTICAST
-               pmc->crcount = in_dev->mr_qrv ? in_dev->mr_qrv :
-                       IGMP_Unsolicited_Report_Count;
+               pmc->crcount = in_dev->mr_qrv ?: sysctl_igmp_qrv;
                in_dev->mr_ifc_count = pmc->crcount;
                for (psf = pmc->sources; psf; psf = psf->sf_next)
                        psf->sf_crcount = 0;
@@ -1818,8 +1818,7 @@ static int ip_mc_add_src(struct in_device *in_dev, __be32 *pmca, int sfmode,
 #ifdef CONFIG_IP_MULTICAST
                /* else no filters; keep old mode for reports */
 
-               pmc->crcount = in_dev->mr_qrv ? in_dev->mr_qrv :
-                       IGMP_Unsolicited_Report_Count;
+               pmc->crcount = in_dev->mr_qrv ?: sysctl_igmp_qrv;
                in_dev->mr_ifc_count = pmc->crcount;
                for (psf = pmc->sources; psf; psf = psf->sf_next)
                        psf->sf_crcount = 0;
@@ -2539,7 +2538,7 @@ static int igmp_mc_seq_show(struct seq_file *seq, void *v)
                querier = "NONE";
 #endif
 
-               if (rcu_dereference(state->in_dev->mc_list) == im) {
+               if (rcu_access_pointer(state->in_dev->mc_list) == im) {
                        seq_printf(seq, "%d\t%-10s: %5d %7s\n",
                                   state->dev->ifindex, state->dev->name, state->in_dev->mc_count, querier);
                }