HomeFreeBSD

in6: Modify address prefix lifetimes when updating address lifetimes

Description

in6: Modify address prefix lifetimes when updating address lifetimes

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.

Co-authored by: Franco Fichtner <franco@opnsense.org>
Reviewed by: pouria, zlei, ae
MFC after: 2 weeks
Sponsored by: OPNsense
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D54562

(cherry picked from commit 74999aac5effb9b32d12f413ef51e87b15c8a0d8)

Details

Provenance
markjAuthored on Jan 12 2026, 1:49 PM
Reviewer
pouria
Differential Revision
D54562: in6: Modify address prefix lifetimes when updating address lifetimes
Parents
rG196a0eb2b84b: in6: Add a helper function to compute expiry times
Branches
Unknown
Tags
Unknown