commit f3bd2023c3c13a5cf9400cce397607afdb9c62d5 Author: Dan Ponte Date: Thu May 25 15:20:14 2023 -0400 rtadvd: add deprecation of addresses on shutdown diff --git a/usr.sbin/rtadvd/config.c b/usr.sbin/rtadvd/config.c index f857889332a4..66c54821ae1d 100644 --- a/usr.sbin/rtadvd/config.c +++ b/usr.sbin/rtadvd/config.c @@ -379,6 +379,12 @@ getconfig(struct ifinfo *ifi) else rai->rai_advifprefix = 1; + /* deprecate on shutdown? */ + if (agetflag("nodeprecate")) + rai->rai_deprecate = 0; + else + rai->rai_deprecate = 1; + /* get interface information */ if (agetflag("nolladdr")) rai->rai_advlinkopt = 0; diff --git a/usr.sbin/rtadvd/rtadvd.c b/usr.sbin/rtadvd/rtadvd.c index 391c95c9bd48..acf03b6c00d8 100644 --- a/usr.sbin/rtadvd/rtadvd.c +++ b/usr.sbin/rtadvd/rtadvd.c @@ -369,6 +369,7 @@ rtadvd_shutdown(void) { struct ifinfo *ifi; struct rainfo *rai; + struct prefix *prefix; struct rdnss *rdn; struct dnssl *dns; @@ -411,6 +412,12 @@ rtadvd_shutdown(void) TAILQ_FOREACH(rai, &railist, rai_next) { rai->rai_lifetime = 0; + if (rai->rai_deprecate) { + TAILQ_FOREACH(prefix, &rai->rai_prefix, pfx_next) { + prefix->pfx_validlifetime = 0; + prefix->pfx_preflifetime = 0; + } + } TAILQ_FOREACH(rdn, &rai->rai_rdnss, rd_next) rdn->rd_ltime = 0; TAILQ_FOREACH(dns, &rai->rai_dnssl, dn_next) diff --git a/usr.sbin/rtadvd/rtadvd.conf.5 b/usr.sbin/rtadvd/rtadvd.conf.5 index d4a0c0258915..ade8f13829bd 100644 --- a/usr.sbin/rtadvd/rtadvd.conf.5 +++ b/usr.sbin/rtadvd/rtadvd.conf.5 @@ -430,6 +430,19 @@ DNS search list entries. The default value is 3/2 of the interval time. .El .Pp +The following item controls prefix deprecation on +.Nm rtadvd +shutdown. +.Bl -tag -width indent +.It Cm \&nodeprecate +(bool) By default +.Pc , +.Xr rtadvd 8 +will deprecate prefixes on shutdown. If this capability exists, +.Xr rtadvd 8 +will not deprecate addresses on shutdown. +.El +.Pp You can also refer one line from another by using .Cm tc capability. diff --git a/usr.sbin/rtadvd/rtadvd.h b/usr.sbin/rtadvd/rtadvd.h index 885d2fbb3c80..68d9748d0ee1 100644 --- a/usr.sbin/rtadvd/rtadvd.h +++ b/usr.sbin/rtadvd/rtadvd.h @@ -189,6 +189,7 @@ struct rainfo { int rai_advlinkopt; /* bool: whether include link-layer addr opt */ int rai_advifprefix; /* bool: gather IF prefixes? */ + int rai_deprecate; /* bool: deprecate on shutdown */ /* Router configuration variables */ uint16_t rai_lifetime; /* AdvDefaultLifetime */