Skip to contentSkip to conversation

net: ipv6: Add a sysctl to make optimistic addresses useful candidates

PATCH Applied Erik Kline 4 participants 6 messages Oct 28, 2014 – Oct 29, 2014 1 message not in the archive

Subsystems (4)

v2 of 3 Applied Latest is v3 →

lore
Share & tools
lore

Erik Kline

author
#0 lore raw

PATCH v2 1/1 net: ipv6: Add a sysctl to make optimistic addresses useful candidates

Add a sysctl that causes an interface's optimistic addresses to be considered equivalent to other non-deprecated addresses for source address selection purposes. Preferred addresses will still take precedence over optimistic addresses, subject to other ranking in the source address selection algorithm.

This is useful where different interfaces are connected to different networks from different ISPs (e.g., a cell network and a home wifi network).

The current behaviour complies with RFC 3484/6724, and it makes sense if the host has only one interface, or has multiple interfaces on the same network (same or cooperating administrative domain(s), but not in the multiple distinct networks case.

For example, if a mobile device has an IPv6 address on an LTE network and then connects to IPv6-enabled wifi, while the wifi IPv6 address is undergoing DAD, IPv6 connections will try use the wifi default route with the LTE IPv6 address, and will get stuck until they time out.

Also, because optimistic nodes can receive frames, issue an RTM_NEWADDR as soon as DAD starts (with the IFA_F_OPTIMSTIC flag appropriately set). A second RTM_NEWADDR is sent if DAD completes (the address flags have changed), otherwise an RTM_DELADDR is sent.

Also: add an entry in ip-sysctl.txt for optimistic_dad.

---
 Documentation/networking/ip-sysctl.txt | 13 ++++++++++
 include/linux/ipv6.h                   |  1 +
 include/uapi/linux/ipv6.h              |  1 +
 net/ipv6/addrconf.c                    | 46 ++++++++++++++++++++++++++++++++--
 4 files changed, 59 insertions(+), 2 deletions(-)
Documentation/networking/ip-sysctl.txt +13 -0
index 0307e28..e03cf49 100644
@@ -1452,6 +1452,19 @@ suppress_frag_ndisc - INTEGER
 	1 - (default) discard fragmented neighbor discovery packets
 	0 - allow fragmented neighbor discovery packets
 
+optimistic_dad - BOOLEAN
+	Whether to perform Optimistic Duplicate Address Detection (RFC 4429).
+		0: disabled (default)
+		1: enabled
+
+use_optimistic - BOOLEAN
+	If enabled, do not classify optimistic addresses as deprecated during
+	source address selection.  Preferred addresses will still be chosen
+	before optimistic addresses, subject to other ranking in the source
+	address selection algorithm.
+		0: disabled (default)
+		1: enabled
+
 icmp/*:
 ratelimit - INTEGER
 	Limit the maximal rates for sending ICMPv6 packets.
include/linux/ipv6.h +1 -0
index ff56053..7121a2e 100644
@@ -42,6 +42,7 @@ struct ipv6_devconf {
 	__s32		accept_ra_from_local;
 #ifdef CONFIG_IPV6_OPTIMISTIC_DAD
 	__s32		optimistic_dad;
+	__s32		use_optimistic;
 #endif
 #ifdef CONFIG_IPV6_MROUTE
 	__s32		mc_forwarding;
include/uapi/linux/ipv6.h +1 -0
index efa2666..e863d08 100644
@@ -164,6 +164,7 @@ enum {
 	DEVCONF_MLDV2_UNSOLICITED_REPORT_INTERVAL,
 	DEVCONF_SUPPRESS_FRAG_NDISC,
 	DEVCONF_ACCEPT_RA_FROM_LOCAL,
+	DEVCONF_USE_OPTIMISTIC,
 	DEVCONF_MAX
 };
 
net/ipv6/addrconf.c +44 -2

92 lines not on this page · raw message

Signature · 1 line
2.1.0.rc2.206.gedb03e5
Acked-by on v2 1/1
#1 lore raw
Quoted 7 lines · Erik Kline

Add a sysctl that causes an interface's optimistic addresses to be considered equivalent to other non-deprecated addresses for source address selection purposes. Preferred addresses will still take precedence over optimistic addresses, subject to other ranking in the source address selection algorithm.
...

A message that is not in the archive (sent off-list or not yet received): CAAedzxptbKLrO_0uPVqXiqOACqNNj9BeeakgB3+t+XxemeN3Sw@mail.gmail.com

author
#3 lore raw

(resending; sorry for the dup; my text mail setting was defeated)-:

Quoted 27 lines · Erik Kline

Hannes,

Given that we spoke about this reduction in the number of netlink messages earlier, do you still think it's an issue?

The end result here is that for listeners on netlink sockets on systems that
(a) have optimistic dad built-in, (b) have optimistic dad enabled, and (c) have use_optimistic set: they'll 2 notifications (with different flags) for automatically added addresses on these interfaces.

(Personally, given that we appear to send an RTM_NEWADDR when the address gets deprecated (I think), I think sending one on every flag change of interest is in keeping with existing behaviour.)

Quoted 11 lines · Lorenzo Colitti
Quoted 7 lines · Erik Kline

Add a sysctl that causes an interface's optimistic addresses to be considered equivalent to other non-deprecated addresses for source address selection purposes. Preferred addresses will still take precedence over optimistic addresses, subject to other ranking in the source address selection algorithm.
...

#4 lore raw
In reply to a message not in the archive

Hi Erik,

Quoted 2 lines · Erik Kline

Given that we spoke about this reduction in the number of netlink messages earlier, do you still think it's an issue?

No, it would be nice to have but as this is just a minor detail and complexity would be too high I am fine with your current solution.

Quoted 4 lines

The end result here is that for listeners on netlink sockets on systems that (a) have optimistic dad built-in, (b) have optimistic dad enabled, and
(c) have use_optimistic set: they'll 2 notifications (with different flags) for automatically added addresses on these interfaces.

Ack, I see.

Quoted 3 lines

(Personally, given that we appear to send an RTM_NEWADDR when the address gets deprecated (I think), I think sending one on every flag change of interest is in keeping with existing behaviour.)

It does make sense, I have no objections.

Bye,
Hannes

Acked-by on v2 1/1
#5 lore raw
In reply to Erik Kline
Quoted 35 lines · Erik Kline

Add a sysctl that causes an interface's optimistic addresses to be considered equivalent to other non-deprecated addresses for source address selection purposes. Preferred addresses will still take precedence over optimistic addresses, subject to other ranking in the source address selection algorithm.

This is useful where different interfaces are connected to different networks from different ISPs (e.g., a cell network and a home wifi network).

The current behaviour complies with RFC 3484/6724, and it makes sense if the host has only one interface, or has multiple interfaces on the same network (same or cooperating administrative domain(s), but not in the multiple distinct networks case.

For example, if a mobile device has an IPv6 address on an LTE network and then connects to IPv6-enabled wifi, while the wifi IPv6 address is undergoing DAD, IPv6 connections will try use the wifi default route with the LTE IPv6 address, and will get stuck until they time out.

Also, because optimistic nodes can receive frames, issue an RTM_NEWADDR as soon as DAD starts (with the IFA_F_OPTIMSTIC flag appropriately set). A second RTM_NEWADDR is sent if DAD completes (the address flags have changed), otherwise an RTM_DELADDR is sent.

Also: add an entry in ip-sysctl.txt for optimistic_dad.

---

[...]

net/ipv6/addrconf.c static inline int ipv6_saddr_preferred(int type) · line 1206

Quoted 4 lines
net/ipv6/addrconf.c +4 -0
+static inline bool ipv6_use_optimistic_addr(struct inet6_dev *idev)
+{
+#ifdef CONFIG_IPV6_OPTIMISTIC_DAD
+	return idev && idev->cnf.optimistic_dad && idev->cnf.use_optimistic;

Just a small nit: is this idev != NULL check necessary?

Otherwise:

Thanks,
Hannes

maintainer Applied
#6 lore raw
In reply to Erik Kline

From: Erik Kline <[email protected]>
Date: Tue, 28 Oct 2014 18:11:14 +0900

Quoted 28 lines

Add a sysctl that causes an interface's optimistic addresses to be considered equivalent to other non-deprecated addresses for source address selection purposes. Preferred addresses will still take precedence over optimistic addresses, subject to other ranking in the source address selection algorithm.

This is useful where different interfaces are connected to different networks from different ISPs (e.g., a cell network and a home wifi network).

The current behaviour complies with RFC 3484/6724, and it makes sense if the host has only one interface, or has multiple interfaces on the same network (same or cooperating administrative domain(s), but not in the multiple distinct networks case.

For example, if a mobile device has an IPv6 address on an LTE network and then connects to IPv6-enabled wifi, while the wifi IPv6 address is undergoing DAD, IPv6 connections will try use the wifi default route with the LTE IPv6 address, and will get stuck until they time out.

Also, because optimistic nodes can receive frames, issue an RTM_NEWADDR as soon as DAD starts (with the IFA_F_OPTIMSTIC flag appropriately set). A second RTM_NEWADDR is sent if DAD completes (the address flags have changed), otherwise an RTM_DELADDR is sent.

Quoted 3 lines

Also: add an entry in ip-sysctl.txt for optimistic_dad.

Applied, if the idev != NULL check proves to be unnecessary we can kill it in a follow-on patch.

Thanks.