netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ipv6: do not add link-local address if one already exists
@ 2014-08-10 19:56 Roy Marples
  2014-08-10 20:37 ` Hannes Frederic Sowa
  2014-08-11  0:27 ` YOSHIFUJI Hideaki
  0 siblings, 2 replies; 7+ messages in thread
From: Roy Marples @ 2014-08-10 19:56 UTC (permalink / raw)
  To: netdev
  Cc: David S. Miller" <davem@davemloft.net>, Alexey Kuznetsov <kuznet@ms2.inr.ac.ru>, Hideaki YOSHIFUJI <yoshfuji@linux-ipv6.org>, Patrick McHardy

[-- Attachment #1: Type: text/plain, Size: 510 bytes --]

Hi

Currently the kernel will always add an IPv6 link-local address
based on the hardware address when the interface is brought up.
This is probably based on the assumption that userland would
never add one before the interface is brought up.

However, one at least one userland application (dhcpcd) does this so
it can implement RFC7217 which can be used for link-local addresses
as well.

Attached is a patch which checks to see if a link-local address exists
before indiscriminately adding one.

Thanks

Roy

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: linux-ipv6-onelladdr.diff --]
[-- Type: text/x-diff; name=linux-ipv6-onelladdr.diff, Size: 598 bytes --]

This allows userland to set a possibly different link-local address
like say one based on RFC7217.

Signed-off-by: Roy Marples <roy@marples.name>

--- net/ipv6/addrconf.c.orig	2014-08-10 19:39:50.377073417 +0000
+++ net/ipv6/addrconf.c	2014-08-10 20:19:03.139002051 +0000
@@ -2751,6 +2751,11 @@ static void addrconf_dev_config(struct n
 	if (IS_ERR(idev))
 		return;
 
+	/* If we already have a link-local address, don't bother
+	 * adding a new one. */
+	if (ipv6_get_lladdr(dev, &addr, 0) == 0)
+		return;
+
 	memset(&addr, 0, sizeof(struct in6_addr));
 	addr.s6_addr32[0] = htonl(0xFE800000);
 

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2014-08-13 17:10 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-08-10 19:56 [PATCH] ipv6: do not add link-local address if one already exists Roy Marples
2014-08-10 20:37 ` Hannes Frederic Sowa
2014-08-11  0:05   ` Roy Marples
2014-08-11  0:11     ` Hannes Frederic Sowa
2014-08-11 21:22       ` Roy Marples
2014-08-13 17:10         ` Jiri Pirko
2014-08-11  0:27 ` YOSHIFUJI Hideaki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).