aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHannes Frederic Sowa <hannes@stressinduktion.org>2013-08-13 19:03:46 -0400
committerDavid S. Miller <davem@davemloft.net>2013-08-13 20:05:04 -0400
commitfc4eba58b4c1462ff3d6247b66fb47d6928db6d2 (patch)
tree94f3e5c02dc7d27c1a851e8c9368081c47d6d38c
parent74c181d528bd8b5989f424a489262d0742ca31ae (diff)
ipv6: make unsolicited report intervals configurable for mld
Commit cab70040dfd95ee32144f02fade64f0cb94f31a0 ("net: igmp: Reduce Unsolicited report interval to 1s when using IGMPv3") and 2690048c01f32bf45d1c1e1ab3079bc10ad2aea7 ("net: igmp: Allow user-space configuration of igmp unsolicited report interval") by William Manley made igmp unsolicited report intervals configurable per interface and corrected the interval of unsolicited igmpv3 report messages resendings to 1s. Same needs to be done for IPv6: MLDv1 (RFC2710 7.10.): 10 seconds MLDv2 (RFC3810 9.11.): 1 second Both intervals are configurable via new procfs knobs mldv1_unsolicited_report_interval and mldv2_unsolicited_report_interval. (also added .force_mld_version to ipv6_devconf_dflt to bring structs in line without semantic changes) v2: a) Joined documentation update for IPv4 and IPv6 MLD/IGMP unsolicited_report_interval procfs knobs. b) incorporate stylistic feedback from William Manley v3: a) add new DEVCONF_* values to the end of the enum (thanks to David Miller) Cc: Cong Wang <xiyou.wangcong@gmail.com> Cc: William Manley <william.manley@youview.com> Cc: Benjamin LaHaise <bcrl@kvack.org> Cc: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org> Signed-off-by: Hannes Frederic Sowa <hannes@stressinduktion.org> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--Documentation/networking/ip-sysctl.txt18
-rw-r--r--include/linux/ipv6.h2
-rw-r--r--include/uapi/linux/ipv6.h2
-rw-r--r--net/ipv6/addrconf.c25
-rw-r--r--net/ipv6/mcast.c17
5 files changed, 61 insertions, 3 deletions
diff --git a/Documentation/networking/ip-sysctl.txt b/Documentation/networking/ip-sysctl.txt
index 36be26b2ef7a..debfe857d8f9 100644
--- a/Documentation/networking/ip-sysctl.txt
+++ b/Documentation/networking/ip-sysctl.txt
@@ -1039,7 +1039,15 @@ disable_policy - BOOLEAN
1039disable_xfrm - BOOLEAN 1039disable_xfrm - BOOLEAN
1040 Disable IPSEC encryption on this interface, whatever the policy 1040 Disable IPSEC encryption on this interface, whatever the policy
1041 1041
1042igmpv2_unsolicited_report_interval - INTEGER
1043 The interval in milliseconds in which the next unsolicited
1044 IGMPv1 or IGMPv2 report retransmit will take place.
1045 Default: 10000 (10 seconds)
1042 1046
1047igmpv3_unsolicited_report_interval - INTEGER
1048 The interval in milliseconds in which the next unsolicited
1049 IGMPv3 report retransmit will take place.
1050 Default: 1000 (1 seconds)
1043 1051
1044tag - INTEGER 1052tag - INTEGER
1045 Allows you to write a number, which can be used as required. 1053 Allows you to write a number, which can be used as required.
@@ -1331,6 +1339,16 @@ ndisc_notify - BOOLEAN
1331 1 - Generate unsolicited neighbour advertisements when device is brought 1339 1 - Generate unsolicited neighbour advertisements when device is brought
1332 up or hardware address changes. 1340 up or hardware address changes.
1333 1341
1342mldv1_unsolicited_report_interval - INTEGER
1343 The interval in milliseconds in which the next unsolicited
1344 MLDv1 report retransmit will take place.
1345 Default: 10000 (10 seconds)
1346
1347mldv2_unsolicited_report_interval - INTEGER
1348 The interval in milliseconds in which the next unsolicited
1349 MLDv2 report retransmit will take place.
1350 Default: 1000 (1 second)
1351
1334icmp/*: 1352icmp/*:
1335ratelimit - INTEGER 1353ratelimit - INTEGER
1336 Limit the maximal rates for sending ICMPv6 packets. 1354 Limit the maximal rates for sending ICMPv6 packets.
diff --git a/include/linux/ipv6.h b/include/linux/ipv6.h
index 850e95bc766c..77a478462d8e 100644
--- a/include/linux/ipv6.h
+++ b/include/linux/ipv6.h
@@ -19,6 +19,8 @@ struct ipv6_devconf {
19 __s32 rtr_solicit_interval; 19 __s32 rtr_solicit_interval;
20 __s32 rtr_solicit_delay; 20 __s32 rtr_solicit_delay;
21 __s32 force_mld_version; 21 __s32 force_mld_version;
22 __s32 mldv1_unsolicited_report_interval;
23 __s32 mldv2_unsolicited_report_interval;
22#ifdef CONFIG_IPV6_PRIVACY 24#ifdef CONFIG_IPV6_PRIVACY
23 __s32 use_tempaddr; 25 __s32 use_tempaddr;
24 __s32 temp_valid_lft; 26 __s32 temp_valid_lft;
diff --git a/include/uapi/linux/ipv6.h b/include/uapi/linux/ipv6.h
index 4bda4cf5b0f5..d07ac6903e59 100644
--- a/include/uapi/linux/ipv6.h
+++ b/include/uapi/linux/ipv6.h
@@ -160,6 +160,8 @@ enum {
160 DEVCONF_ACCEPT_DAD, 160 DEVCONF_ACCEPT_DAD,
161 DEVCONF_FORCE_TLLAO, 161 DEVCONF_FORCE_TLLAO,
162 DEVCONF_NDISC_NOTIFY, 162 DEVCONF_NDISC_NOTIFY,
163 DEVCONF_MLDV1_UNSOLICITED_REPORT_INTERVAL,
164 DEVCONF_MLDV2_UNSOLICITED_REPORT_INTERVAL,
163 DEVCONF_MAX 165 DEVCONF_MAX
164}; 166};
165 167
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 7fd8572bac80..ad12f7c43f25 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -177,6 +177,8 @@ static struct ipv6_devconf ipv6_devconf __read_mostly = {
177 .accept_redirects = 1, 177 .accept_redirects = 1,
178 .autoconf = 1, 178 .autoconf = 1,
179 .force_mld_version = 0, 179 .force_mld_version = 0,
180 .mldv1_unsolicited_report_interval = 10 * HZ,
181 .mldv2_unsolicited_report_interval = HZ,
180 .dad_transmits = 1, 182 .dad_transmits = 1,
181 .rtr_solicits = MAX_RTR_SOLICITATIONS, 183 .rtr_solicits = MAX_RTR_SOLICITATIONS,
182 .rtr_solicit_interval = RTR_SOLICITATION_INTERVAL, 184 .rtr_solicit_interval = RTR_SOLICITATION_INTERVAL,
@@ -211,6 +213,9 @@ static struct ipv6_devconf ipv6_devconf_dflt __read_mostly = {
211 .accept_ra = 1, 213 .accept_ra = 1,
212 .accept_redirects = 1, 214 .accept_redirects = 1,
213 .autoconf = 1, 215 .autoconf = 1,
216 .force_mld_version = 0,
217 .mldv1_unsolicited_report_interval = 10 * HZ,
218 .mldv2_unsolicited_report_interval = HZ,
214 .dad_transmits = 1, 219 .dad_transmits = 1,
215 .rtr_solicits = MAX_RTR_SOLICITATIONS, 220 .rtr_solicits = MAX_RTR_SOLICITATIONS,
216 .rtr_solicit_interval = RTR_SOLICITATION_INTERVAL, 221 .rtr_solicit_interval = RTR_SOLICITATION_INTERVAL,
@@ -4179,6 +4184,10 @@ static inline void ipv6_store_devconf(struct ipv6_devconf *cnf,
4179 array[DEVCONF_RTR_SOLICIT_DELAY] = 4184 array[DEVCONF_RTR_SOLICIT_DELAY] =
4180 jiffies_to_msecs(cnf->rtr_solicit_delay); 4185 jiffies_to_msecs(cnf->rtr_solicit_delay);
4181 array[DEVCONF_FORCE_MLD_VERSION] = cnf->force_mld_version; 4186 array[DEVCONF_FORCE_MLD_VERSION] = cnf->force_mld_version;
4187 array[DEVCONF_MLDV1_UNSOLICITED_REPORT_INTERVAL] =
4188 jiffies_to_msecs(cnf->mldv1_unsolicited_report_interval);
4189 array[DEVCONF_MLDV2_UNSOLICITED_REPORT_INTERVAL] =
4190 jiffies_to_msecs(cnf->mldv2_unsolicited_report_interval);
4182#ifdef CONFIG_IPV6_PRIVACY 4191#ifdef CONFIG_IPV6_PRIVACY
4183 array[DEVCONF_USE_TEMPADDR] = cnf->use_tempaddr; 4192 array[DEVCONF_USE_TEMPADDR] = cnf->use_tempaddr;
4184 array[DEVCONF_TEMP_VALID_LFT] = cnf->temp_valid_lft; 4193 array[DEVCONF_TEMP_VALID_LFT] = cnf->temp_valid_lft;
@@ -4862,6 +4871,22 @@ static struct addrconf_sysctl_table
4862 .mode = 0644, 4871 .mode = 0644,
4863 .proc_handler = proc_dointvec, 4872 .proc_handler = proc_dointvec,
4864 }, 4873 },
4874 {
4875 .procname = "mldv1_unsolicited_report_interval",
4876 .data =
4877 &ipv6_devconf.mldv1_unsolicited_report_interval,
4878 .maxlen = sizeof(int),
4879 .mode = 0644,
4880 .proc_handler = proc_dointvec_ms_jiffies,
4881 },
4882 {
4883 .procname = "mldv2_unsolicited_report_interval",
4884 .data =
4885 &ipv6_devconf.mldv2_unsolicited_report_interval,
4886 .maxlen = sizeof(int),
4887 .mode = 0644,
4888 .proc_handler = proc_dointvec_ms_jiffies,
4889 },
4865#ifdef CONFIG_IPV6_PRIVACY 4890#ifdef CONFIG_IPV6_PRIVACY
4866 { 4891 {
4867 .procname = "use_tempaddr", 4892 .procname = "use_tempaddr",
diff --git a/net/ipv6/mcast.c b/net/ipv6/mcast.c
index db25b8eb62bd..6c76df9909bf 100644
--- a/net/ipv6/mcast.c
+++ b/net/ipv6/mcast.c
@@ -108,7 +108,6 @@ static int ip6_mc_leave_src(struct sock *sk, struct ipv6_mc_socklist *iml,
108 struct inet6_dev *idev); 108 struct inet6_dev *idev);
109 109
110 110
111#define IGMP6_UNSOLICITED_IVAL (10*HZ)
112#define MLD_QRV_DEFAULT 2 111#define MLD_QRV_DEFAULT 2
113 112
114#define MLD_V1_SEEN(idev) (dev_net((idev)->dev)->ipv6.devconf_all->force_mld_version == 1 || \ 113#define MLD_V1_SEEN(idev) (dev_net((idev)->dev)->ipv6.devconf_all->force_mld_version == 1 || \
@@ -129,6 +128,18 @@ int sysctl_mld_max_msf __read_mostly = IPV6_MLD_MAX_MSF;
129 pmc != NULL; \ 128 pmc != NULL; \
130 pmc = rcu_dereference(pmc->next)) 129 pmc = rcu_dereference(pmc->next))
131 130
131static int unsolicited_report_interval(struct inet6_dev *idev)
132{
133 int iv;
134
135 if (MLD_V1_SEEN(idev))
136 iv = idev->cnf.mldv1_unsolicited_report_interval;
137 else
138 iv = idev->cnf.mldv2_unsolicited_report_interval;
139
140 return iv > 0 ? iv : 1;
141}
142
132int ipv6_sock_mc_join(struct sock *sk, int ifindex, const struct in6_addr *addr) 143int ipv6_sock_mc_join(struct sock *sk, int ifindex, const struct in6_addr *addr)
133{ 144{
134 struct net_device *dev = NULL; 145 struct net_device *dev = NULL;
@@ -2158,7 +2169,7 @@ static void igmp6_join_group(struct ifmcaddr6 *ma)
2158 2169
2159 igmp6_send(&ma->mca_addr, ma->idev->dev, ICMPV6_MGM_REPORT); 2170 igmp6_send(&ma->mca_addr, ma->idev->dev, ICMPV6_MGM_REPORT);
2160 2171
2161 delay = net_random() % IGMP6_UNSOLICITED_IVAL; 2172 delay = net_random() % unsolicited_report_interval(ma->idev);
2162 2173
2163 spin_lock_bh(&ma->mca_lock); 2174 spin_lock_bh(&ma->mca_lock);
2164 if (del_timer(&ma->mca_timer)) { 2175 if (del_timer(&ma->mca_timer)) {
@@ -2325,7 +2336,7 @@ void ipv6_mc_init_dev(struct inet6_dev *idev)
2325 setup_timer(&idev->mc_dad_timer, mld_dad_timer_expire, 2336 setup_timer(&idev->mc_dad_timer, mld_dad_timer_expire,
2326 (unsigned long)idev); 2337 (unsigned long)idev);
2327 idev->mc_qrv = MLD_QRV_DEFAULT; 2338 idev->mc_qrv = MLD_QRV_DEFAULT;
2328 idev->mc_maxdelay = IGMP6_UNSOLICITED_IVAL; 2339 idev->mc_maxdelay = unsolicited_report_interval(idev);
2329 idev->mc_v1_seen = 0; 2340 idev->mc_v1_seen = 0;
2330 write_unlock_bh(&idev->lock); 2341 write_unlock_bh(&idev->lock);
2331} 2342}