netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] ipv6: addrconf: fix generation of new temporary addresses
@ 2017-02-06 17:34 Marcus Huewe
  2017-02-08 16:55 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Marcus Huewe @ 2017-02-06 17:34 UTC (permalink / raw)
  To: davem, kuznet, jmorris, yoshfuji, kaber; +Cc: netdev

Under some circumstances it is possible that no new temporary addresses
will be generated.

For instance, addrconf_prefix_rcv_add_addr() indirectly calls
ipv6_create_tempaddr(), which creates a tentative temporary address and
starts dad. Next, addrconf_prefix_rcv_add_addr() indirectly calls
addrconf_verify_rtnl(). Now, assume that the previously created temporary
address has the least preferred lifetime among all existing addresses and
is still tentative (that is, dad is still running). Hence, the next run of
addrconf_verify_rtnl() is performed when the preferred lifetime of the
temporary address ends. If dad succeeds before the next run, the temporary
address becomes deprecated during the next run, but no new temporary
address is generated.

In order to fix this, schedule the next addrconf_verify_rtnl() run slightly
before the temporary address becomes deprecated, if dad succeeded.

Signed-off-by: Marcus Huewe <suse-tux@gmx.de>
---
 net/ipv6/addrconf.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index f60e88e56255..27a5cc3d375d 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -4009,6 +4009,12 @@ static void addrconf_dad_completed(struct inet6_ifaddr *ifp, bool bump_id)
 
 	if (bump_id)
 		rt_genid_bump_ipv6(dev_net(dev));
+
+	/* Make sure that a new temporary address will be created
+	 * before this temporary address becomes deprecated.
+	 */
+	if (ifp->flags & IFA_F_TEMPORARY)
+		addrconf_verify_rtnl();
 }
 
 static void addrconf_dad_run(struct inet6_dev *idev)
-- 
2.11.0

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

* Re: [PATCH net] ipv6: addrconf: fix generation of new temporary addresses
  2017-02-06 17:34 [PATCH net] ipv6: addrconf: fix generation of new temporary addresses Marcus Huewe
@ 2017-02-08 16:55 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2017-02-08 16:55 UTC (permalink / raw)
  To: suse-tux; +Cc: kuznet, jmorris, yoshfuji, kaber, netdev

From: Marcus Huewe <suse-tux@gmx.de>
Date: Mon, 6 Feb 2017 18:34:56 +0100

> Under some circumstances it is possible that no new temporary addresses
> will be generated.
> 
> For instance, addrconf_prefix_rcv_add_addr() indirectly calls
> ipv6_create_tempaddr(), which creates a tentative temporary address and
> starts dad. Next, addrconf_prefix_rcv_add_addr() indirectly calls
> addrconf_verify_rtnl(). Now, assume that the previously created temporary
> address has the least preferred lifetime among all existing addresses and
> is still tentative (that is, dad is still running). Hence, the next run of
> addrconf_verify_rtnl() is performed when the preferred lifetime of the
> temporary address ends. If dad succeeds before the next run, the temporary
> address becomes deprecated during the next run, but no new temporary
> address is generated.
> 
> In order to fix this, schedule the next addrconf_verify_rtnl() run slightly
> before the temporary address becomes deprecated, if dad succeeded.
> 
> Signed-off-by: Marcus Huewe <suse-tux@gmx.de>

Applied, thank you.

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

end of thread, other threads:[~2017-02-08 16:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-02-06 17:34 [PATCH net] ipv6: addrconf: fix generation of new temporary addresses Marcus Huewe
2017-02-08 16:55 ` David Miller

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).