Patchwork [linux-2.6,v2] IPv6: Create temporary address if none exists.

login
register
mail settings
Submitter Glenn Wurster
Date Sept. 27, 2010, 5:04 p.m.
Message ID <20100927170430.GA7106@adams.ccsl.carleton.ca>
Download mbox | patch
Permalink /patch/65885/
State Accepted
Delegated to: David Miller
Headers show

Comments

Glenn Wurster - Sept. 27, 2010, 5:04 p.m.
If privacy extentions are enabled, but no current temporary address exists,
then create one when we get a router advertisement.

Version 2, now with 100% fewer line wraps.  Thanks to David Miller for
pointing out the line wrapping issue.

Signed-off-by: Glenn Wurster <gwurster@scs.carleton.ca>
---
 net/ipv6/addrconf.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
David Miller - Sept. 29, 2010, 5:25 a.m.
From: Glenn Wurster <gwurster@scs.carleton.ca>
Date: Mon, 27 Sep 2010 13:04:30 -0400

> If privacy extentions are enabled, but no current temporary address exists,
> then create one when we get a router advertisement.
> 
> Version 2, now with 100% fewer line wraps.  Thanks to David Miller for
> pointing out the line wrapping issue.
> 
> Signed-off-by: Glenn Wurster <gwurster@scs.carleton.ca>

The existing code is correct from what I can tell.

Variable "create" is true when "ifp == NULL" and "valid_lft != 0"

And RFC 3041 explicitly states in section 3.3:

	When a new public address is created as described in [ADDRCONF]
	(because the prefix advertised does not match the prefix of any
	address already assigned to the interface, and Valid Lifetime
	in the option is not zero), also create a new temporary address.

Your patch is going to cause us to create a temporary address even
when valid_lft is zero, which the RFC says we should not do.

That goes against what the RFC tells us to do, so I can only conclude
that your patch is not correct.

I'm not applying this, sorry.

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index ab70a3f..cfee6ae 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -2022,10 +2022,11 @@  ok:
 					ipv6_ifa_notify(0, ift);
 			}
 
-			if (create && in6_dev->cnf.use_tempaddr > 0) {
+			if ((create || list_empty(&in6_dev->tempaddr_list)) && in6_dev->cnf.use_tempaddr > 0) {
 				/*
 				 * When a new public address is created as described in [ADDRCONF],
-				 * also create a new temporary address.
+				 * also create a new temporary address. Also create a temporary
+				 * address if it's enabled but no temporary address currently exists.
 				 */
 				read_unlock_bh(&in6_dev->lock);
 				ipv6_create_tempaddr(ifp, NULL);