Re: [PATCH net 1/2] net/ipv6: delete temporary address if mngtmpaddr is removed or un-mngtmpaddr

From: Hangbin Liu
Date: Tue Nov 19 2024 - 02:52:40 EST


On Fri, Nov 15, 2024 at 12:46:27PM -0800, Sam Edwards wrote:
> Hi Hangbin,
>
> It took me a while to grasp but the problem seems to be a confusion
> about what it means to set a temporary's lifetimes to 0/0:
> 1) "The mngtmpaddrs has gone away; this temporary is slated for
> deletion by addrconf_verify_rtnl()"
> 2) "This temporary address itself shall no longer be used, regenerate
> it immediately."
>
> The existing behavior makes sense for the #2 case, but not for the #1
> case. It seems sensible to me to keep the #2 behavior as-is, because
> userspace might be setting a 0/0 lifetime to forcibly rotate the
> temporary.
>
> So it sounds like (at least) one of three fixes is in order:
> a) Make ipv6_create_tempaddr() verify that the `ifp` is (still)
> alive+mngtmpaddrs, returning with an error code if not.
> b) Look at the 3 callsites for ipv6_create_tempaddr() and add the
> above verifications before calling.
> c) Add a function that calls ipv6_del_addr(temp) for every temporary
> with a specified ifpub, and use it instead of manage_tempaddrs(..., 0,
> 0, false, ...) when deleting/unflagging a mngtmpaddrs.
>
> Personally I like option C the best. What are your thoughts?

Hi Sam,

Thanks for the comments. I have no preference. Let me try option C
and update the test case first.

Hangbin