Page MenuHomeFreeBSD

in6: Modify address prefix lifetimes when updating address lifetimes
ClosedPublic

Authored by markj on Tue, Jan 6, 4:03 PM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Jan 20, 1:02 AM
Unknown Object (File)
Mon, Jan 19, 4:32 PM
Unknown Object (File)
Sun, Jan 18, 3:15 PM
Unknown Object (File)
Thu, Jan 15, 8:41 AM
Unknown Object (File)
Tue, Jan 13, 8:33 AM
Unknown Object (File)
Mon, Jan 12, 11:48 PM
Unknown Object (File)
Sun, Jan 11, 10:41 PM
Unknown Object (File)
Sat, Jan 10, 4:01 PM

Details

Summary

When one uses SIOCAIFADDR_IN6 to add a v6 address, it's possible to set
the preferred and valid lifetimes of the address. If the address
already exists, this ioctl will recalculate and update the expiry times
based on the provided timestamps.

When adding a new address, the lifetimes are inherited by the prefix as
well, but only if we create a new prefix. If the prefix already exists,
as it will in the case where an address is being updated rather than
being added, we do not touch the prefix lifetimes at all. This means
that the original address lifetime still applies to the route associated
with that prefix, so when the prefix expires, the route goes away.

This behaviour doesn't make a lot of sense: if the admin updates an
address lifetime, we should ensure that the prefix lifetime is updated
too. Make that change, ensuring that we do not shorten the prefix
lifetime, as the prefix might be shared among multiple interface
addresses.

Add a regression test.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

It sounds reasonable to extend to prefix's lifetime.

Does this also affect those prefixes leaned from route advertisement ?
What's the desired behavior when an IPv6 router advertise shorter lifetimes ?

It sounds reasonable to extend to prefix's lifetime.

Does this also affect those prefixes leaned from route advertisement ?
What's the desired behavior when an IPv6 router advertise shorter lifetimes ?

No, this only affects the handling of the SIOCAIFADDR_IN6 ioctl. RAs can still shorten the prefix lifetime via nd6_ra_input() -> prelist_update(). I think that's reasonable: if the administrator wants exclusive control over the prefix, they can disable ACCEPT_RTADV.

This revision is now accepted and ready to land.Sun, Jan 11, 9:49 AM
pouria added a subscriber: pouria.

LGTM
also tested:

# kyua test -k /usr/tests/sys/netinet6/Kyuafile ndp
ndp:ndp_add_gu_success  ->  passed  [2.012s]
ndp:ndp_del_gu_success  ->  passed  [3.407s]
ndp:ndp_prefix_len_mismatch  ->  passed  [2.128s]
ndp:ndp_prefix_lifetime  ->  passed  [15.506s]
ndp:ndp_prefix_lifetime_extend  ->  passed  [0.078s]
ndp:ndp_slaac_default_route  ->  passed  [5.364s]

Results file id is usr_tests_sys_netinet6.20260111-141215-646648
Results saved to /root/.kyua/store/results.usr_tests_sys_netinet6.20260111-141215-646648.db

6/6 passed (0 failed)

It sounds reasonable to extend to prefix's lifetime.

Does this also affect those prefixes leaned from route advertisement ?
What's the desired behavior when an IPv6 router advertise shorter lifetimes ?

No, this only affects the handling of the SIOCAIFADDR_IN6 ioctl. RAs can still shorten the prefix lifetime via nd6_ra_input() -> prelist_update(). I think that's reasonable: if the administrator wants exclusive control over the prefix, they can disable ACCEPT_RTADV.

I was thinking about distinguishing manually added prefixes ( derived from IPv6 address via ioctl ) from those learned from IPv6 router, but I messed up so I think this can be landed as is firstly.