]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
ipv6: add sysctl_mld_qrv to configure query robustness variable
authorHannes Frederic Sowa <hannes@stressinduktion.org>
Tue, 2 Sep 2014 13:49:25 +0000 (15:49 +0200)
committerDavid S. Miller <davem@davemloft.net>
Fri, 5 Sep 2014 05:26:14 +0000 (22:26 -0700)
This patch adds a new sysctl_mld_qrv knob to configure the mldv1/v2 query
robustness variable. It specifies how many retransmit of unsolicited mld
retransmit should happen. Admins might want to tune this on lossy links.

Also reset mld state on interface down/up, so we pick up new sysctl
settings during interface up event.

IPv6 certification requests this knob to be available.

I didn't make this knob netns specific, as it is mostly a setting in a
physical environment and should be per host.

Cc: Flavio Leitner <fbl@redhat.com>
Signed-off-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
Acked-by: Flavio Leitner <fbl@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Documentation/networking/ip-sysctl.txt
include/net/ipv6.h
net/ipv6/mcast.c
net/ipv6/sysctl_net_ipv6.c

index 3cce8ea6b139ddc013253f0bc129e5c7052f19d6..cfc71ac0f76487721815087c23576b07aa1b9922 100644 (file)
@@ -1152,6 +1152,11 @@ anycast_src_echo_reply - BOOLEAN
        FALSE: disabled
        Default: FALSE
 
+mld_qrv - INTEGER
+       Controls the MLD query robustness variable (see RFC3810 9.1).
+       Default: 2 (as specified by RFC3810 9.1)
+       Minimum: 1 (as specified by RFC6636 4.5)
+
 IPv6 Fragmentation:
 
 ip6frag_high_thresh - INTEGER
index a2db816e8461cff706f23c725cf69372ab8bfcaa..7e247e9b87654bb99cabc2288d14ade201b3f965 100644 (file)
@@ -121,6 +121,7 @@ struct frag_hdr {
 
 /* sysctls */
 extern int sysctl_mld_max_msf;
+extern int sysctl_mld_qrv;
 
 #define _DEVINC(net, statname, modifier, idev, field)                  \
 ({                                                                     \
index 70881795da96b00bda3ce8c107b0b9f346648aa2..64919425f1abf3a17df5be25e1ceb52143aeb044 100644 (file)
@@ -121,6 +121,7 @@ static int ip6_mc_leave_src(struct sock *sk, struct ipv6_mc_socklist *iml,
 #define IPV6_MLD_MAX_MSF       64
 
 int sysctl_mld_max_msf __read_mostly = IPV6_MLD_MAX_MSF;
+int sysctl_mld_qrv __read_mostly = MLD_QRV_DEFAULT;
 
 /*
  *     socket join on multicast group
@@ -1191,15 +1192,16 @@ static void mld_update_qrv(struct inet6_dev *idev,
         * and SHOULD NOT be one. Catch this here if we ever run
         * into such a case in future.
         */
+       const int min_qrv = min(MLD_QRV_DEFAULT, sysctl_mld_qrv);
        WARN_ON(idev->mc_qrv == 0);
 
        if (mlh2->mld2q_qrv > 0)
                idev->mc_qrv = mlh2->mld2q_qrv;
 
-       if (unlikely(idev->mc_qrv < 2)) {
+       if (unlikely(idev->mc_qrv < min_qrv)) {
                net_warn_ratelimited("IPv6: MLD: clamping QRV from %u to %u!\n",
-                                    idev->mc_qrv, MLD_QRV_DEFAULT);
-               idev->mc_qrv = MLD_QRV_DEFAULT;
+                                    idev->mc_qrv, min_qrv);
+               idev->mc_qrv = min_qrv;
        }
 }
 
@@ -2478,6 +2480,14 @@ void ipv6_mc_down(struct inet6_dev *idev)
        mld_clear_delrec(idev);
 }
 
+static void ipv6_mc_reset(struct inet6_dev *idev)
+{
+       idev->mc_qrv = sysctl_mld_qrv;
+       idev->mc_qi = MLD_QI_DEFAULT;
+       idev->mc_qri = MLD_QRI_DEFAULT;
+       idev->mc_v1_seen = 0;
+       idev->mc_maxdelay = unsolicited_report_interval(idev);
+}
 
 /* Device going up */
 
@@ -2488,6 +2498,7 @@ void ipv6_mc_up(struct inet6_dev *idev)
        /* Install multicast list, except for all-nodes (already installed) */
 
        read_lock_bh(&idev->lock);
+       ipv6_mc_reset(idev);
        for (i = idev->mc_list; i; i = i->next)
                igmp6_group_added(i);
        read_unlock_bh(&idev->lock);
@@ -2508,13 +2519,7 @@ void ipv6_mc_init_dev(struct inet6_dev *idev)
                        (unsigned long)idev);
        setup_timer(&idev->mc_dad_timer, mld_dad_timer_expire,
                    (unsigned long)idev);
-
-       idev->mc_qrv = MLD_QRV_DEFAULT;
-       idev->mc_qi = MLD_QI_DEFAULT;
-       idev->mc_qri = MLD_QRI_DEFAULT;
-
-       idev->mc_maxdelay = unsolicited_report_interval(idev);
-       idev->mc_v1_seen = 0;
+       ipv6_mc_reset(idev);
        write_unlock_bh(&idev->lock);
 }
 
index 0c56c93619e063710a8d32f3f9e15fd9cdb6453c..c5c10fafcfe2e068fe33adc8367206a16e40c7bf 100644 (file)
@@ -16,6 +16,8 @@
 #include <net/addrconf.h>
 #include <net/inet_frag.h>
 
+static int one = 1;
+
 static struct ctl_table ipv6_table_template[] = {
        {
                .procname       = "bindv6only",
@@ -63,6 +65,14 @@ static struct ctl_table ipv6_rotable[] = {
                .mode           = 0644,
                .proc_handler   = proc_dointvec
        },
+       {
+               .procname       = "mld_qrv",
+               .data           = &sysctl_mld_qrv,
+               .maxlen         = sizeof(int),
+               .mode           = 0644,
+               .proc_handler   = proc_dointvec_minmax,
+               .extra1         = &one
+       },
        { }
 };