diff mbox

[v2,1/7] ipv6 addrconf: enable use of proc_dointvec_minmax in addrconf_sysctl

Message ID 1474797596-13320-1-git-send-email-zenczykowski@gmail.com
State Changes Requested, archived
Delegated to: David Miller
Headers show

Commit Message

Maciej Żenczykowski Sept. 25, 2016, 9:59 a.m. UTC
From: Maciej Żenczykowski <maze@google.com>

Signed-off-by: Maciej Żenczykowski <maze@google.com>
---
 net/ipv6/addrconf.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

Comments

David Miller Sept. 25, 2016, 10:04 a.m. UTC | #1
This is missing an appropriate "[PATCH v2 0/7] ..." cover letter that
explains at a high level what this patch series is doing, why it is
doing it, and how it is doing it.

You'll have to submit a v3 with this fixed.
Maciej Żenczykowski Sept. 25, 2016, 10:52 a.m. UTC | #2
Hi,

This patch series implements RFC7559 style backoff of IPv6 router
solicitation requests.

Patches 1 and 2 are minor cleanup and stand on their own.

Patch 3 allows a (potentially) infinite number of RS'es to be sent
when the rtr_solicits sysctl is set to -1 (this depends on patch 1).

Patch 4 is just boilerplate to add a new sysctl for the maximum
backoff period.

Patch 5 implements the backoff algorithm (and depends on the previous
patches).

Patches 6 and 7 switch the defaults over to enable this by default.

[PATCH v3 1/7] ipv6 addrconf: enable use of proc_dointvec_minmax in
[PATCH v3 2/7] ipv6 addrconf: remove addrconf_sysctl_hop_limit()
[PATCH v3 3/7] ipv6 addrconf: rtr_solicits == -1 means unlimited
[PATCH v3 4/7] ipv6 addrconf: add new sysctl
[PATCH v3 5/7] ipv6 addrconf: implement RFC7559 router solicitation
[PATCH v3 6/7] ipv6 addrconf: change default
[PATCH v3 7/7] ipv6 addrconf: change default MAX_RTR_SOLICITATIONS

Changes v2->v3:
  none

Changes v1->v2:
  avoid 64-bit divisions to fix 32-bit build errors
Maciej Żenczykowski Sept. 25, 2016, 11:03 a.m. UTC | #3
Hi,

This patch series implements RFC7559 style backoff of IPv6 router
solicitation requests.

Patches 1 and 2 are minor cleanup and stand on their own.

Patch 3 allows a (potentially) infinite number of RS'es to be sent
when the rtr_solicits sysctl is set to -1 (this depends on patch 1).

Patch 4 is just boilerplate to add a new sysctl for the maximum
backoff period.

Patch 5 implements the backoff algorithm (and depends on the previous
patches).

Patches 6 and 7 switch the defaults over to enable this by default.

[PATCH v4 1/7] ipv6 addrconf: enable use of proc_dointvec_minmax in
[PATCH v4 2/7] ipv6 addrconf: remove addrconf_sysctl_hop_limit()
[PATCH v4 3/7] ipv6 addrconf: rtr_solicits == -1 means unlimited
[PATCH v4 4/7] ipv6 addrconf: add new sysctl
[PATCH v4 5/7] ipv6 addrconf: implement RFC7559 router solicitation
[PATCH v4 6/7] ipv6 addrconf: change default
[PATCH v4 7/7] ipv6 addrconf: change default MAX_RTR_SOLICITATIONS


Changes v3->v4:
  added subject line to cover letter

Changes v2->v3:
  added cover letter

Changes v1->v2:
  avoid 64-bit divisions to fix 32-bit build errors
diff mbox

Patch

diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 2f1f5d439788..11fa1a5564d4 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -6044,8 +6044,14 @@  static int __addrconf_sysctl_register(struct net *net, char *dev_name,
 
 	for (i = 0; table[i].data; i++) {
 		table[i].data += (char *)p - (char *)&ipv6_devconf;
-		table[i].extra1 = idev; /* embedded; no ref */
-		table[i].extra2 = net;
+		/* If one of these is already set, then it is not safe to
+		 * overwrite either of them: this makes proc_dointvec_minmax
+		 * usable.
+		 */
+		if (!table[i].extra1 && !table[i].extra2) {
+			table[i].extra1 = idev; /* embedded; no ref */
+			table[i].extra2 = net;
+		}
 	}
 
 	snprintf(path, sizeof(path), "net/ipv6/conf/%s", dev_name);