All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ido Schimmel <idosch@nvidia.com>
To: Fernando Fernandez Mancera <fmancera@suse.de>
Cc: netdev@vger.kernel.org, linux-kselftest@vger.kernel.org,
	horms@kernel.org, pabeni@redhat.com, kuba@kernel.org,
	edumazet@google.com, dsahern@kernel.org, davem@davemloft.net,
	"Łukasz Stelmach" <steelman@post.pl>
Subject: Re: [PATCH 1/2 net v4] ipv6: addrconf: fix temp address generation after prefix deprecation
Date: Fri, 15 May 2026 16:49:04 +0300	[thread overview]
Message-ID: <20260515134904.GA64208@shredder> (raw)
In-Reply-To: <2e046948-aa98-4159-b1c1-46368f034027@suse.de>

On Thu, May 14, 2026 at 06:00:13PM +0200, Fernando Fernandez Mancera wrote:
> Hi Ido, yes this looks good but I am afraid of using time_after(). Sure, a
> temporary address should never be older than 2 ~ 7 days. Yet, we allow
> configuring it up to 2147483647 (68~ years). And that might cause problems
> in 32-bit systems.
> 
> I think we either limit this configuration on sysctl directly or we need to
> support this nonsense.. another option would be to move inet6_ifaddr out of
> jiffies which is something that I recently added to my TODO list. But that
> is a bigger change I do not want to bundle with this one.
> 
> I noticed that ipv6_add_addr() do:
> 
> list_add(&ifa->tmp_list, &idev->tempaddr_list);
> 
> Doesn't it mean the first address that matches the base prefix is indeed the
> most recent one? I tried a bit and it seems we can use just the first match
> :)

It's very unlikely that jiffies is going to be a problem given that
these are temporary addresses. A lifetime of months / years defeats the
purpose...

I'm OK with relying on the list order, but lets add a comment in
ipv6_add_addr() just before the address is added to the list.

> In addition, I didn't check with Sashiko but it is likely going to complain
> about a race condition for a RA arriving right after we have spawned an
> address but it has not been added to the tempaddr list. Therefore we would
> have two addresses.. anyway, that race is quite unlikely. I also have
> planned work on that are to reduce the multiple race windows, currently
> there are plenty. I suggest to acknowledge such race condition for now and
> improve the code base for the reported scenario.

One possible solution is to encode the regeneration state in the
regeneration counter of temporary addresses. Currently it's essentially
a boolean. We can have:

0 - Pre-regeneration.
1 - Regeneration in progress.
2 - Regeneration done (might have failed).

And only reset the state if regeneration was already done.

> I propose this small change to your proposed diff, I acknowledge that it is
> a bit fragile tho (maybe a comment at ipv6_add_addr() is worth to avoid
> breaking this accidentally):

Yes, comments where we add to the list and where we derive the newest
address based on the order should make this clear.

  reply	other threads:[~2026-05-15 13:49 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-11 12:26 [PATCH 1/2 net v4] ipv6: addrconf: fix temp address generation after prefix deprecation Fernando Fernandez Mancera
2026-05-11 12:26 ` [PATCH 2/2 net v4] selftests: fib_tests: add temporary IPv6 address renewal test Fernando Fernandez Mancera
2026-05-11 17:01   ` Breno Leitao
2026-05-12  0:08     ` Jakub Kicinski
2026-05-12  8:08       ` Breno Leitao
2026-05-12 23:56         ` Jakub Kicinski
2026-05-13  8:42           ` Breno Leitao
2026-05-12 18:24 ` [PATCH 1/2 net v4] ipv6: addrconf: fix temp address generation after prefix deprecation Fernando Fernandez Mancera
2026-05-13 14:35   ` Ido Schimmel
2026-05-14 16:00     ` Fernando Fernandez Mancera
2026-05-15 13:49       ` Ido Schimmel [this message]
2026-05-13  0:01 ` Jakub Kicinski
2026-05-13  7:17   ` Ido Schimmel
2026-05-13  7:48     ` Fernando Fernandez Mancera

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260515134904.GA64208@shredder \
    --to=idosch@nvidia.com \
    --cc=davem@davemloft.net \
    --cc=dsahern@kernel.org \
    --cc=edumazet@google.com \
    --cc=fmancera@suse.de \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=steelman@post.pl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.