rtadvd(8): Honor pltime/vltime in interface declarations

Currently rtadvd ignores interface pltime/vltime specifications
unless the (static) address range is also included in the config file.
This extends the validity of a pltime and/or vltime stanza in
the config file for an interface to delegated addresses from
an upstream provider.

Signed-off-by:	tickerguy <karl@denninger.net>
PR:		288426
Reviewed by:	pouria
Pull Request:	https://github.com/freebsd/freebsd-src/pull/1863
This commit is contained in:
tickerguy
2025-09-29 12:05:29 -04:00
committed by Pouria Mousavizadeh Tehrani
parent 76d756eaa6
commit 103f9883d1
+20 -2
View File
@@ -1107,6 +1107,7 @@ get_prefix(struct rainfo *rai)
ifi = rai->rai_ifinfo;
for (ifa = ifap; ifa; ifa = ifa->ifa_next) {
int64_t val64;
int plen;
if (strcmp(ifa->ifa_name, ifi->ifi_ifname) != 0)
@@ -1155,9 +1156,26 @@ get_prefix(struct rainfo *rai)
"<%s> add %s/%d to prefix list on %s",
__func__, ntopbuf, pfx->pfx_prefixlen, ifi->ifi_ifname);
MAYHAVE(val64, "vltime", DEF_ADVVALIDLIFETIME);
if (val64 < 0 || val64 > 0xffffffff) {
syslog(LOG_WARNING,
"<%s> vltime (%" PRIu64 ") for %s/%d on %s "
"is out of range, use default value instead.", __func__,
val64, ntopbuf, pfx->pfx_prefixlen, ifi->ifi_ifname);
pfx->pfx_validlifetime = DEF_ADVVALIDLIFETIME;
} else
pfx->pfx_validlifetime = val64;
MAYHAVE(val64, "pltime", DEF_ADVPREFERREDLIFETIME);
if (val64 < 0 || val64 > 0xffffffff) {
syslog(LOG_WARNING,
"<%s> pltime (%" PRIu64 ") for %s/%d on %s "
"is out of range, use default value instead.", __func__,
val64, ntopbuf, pfx->pfx_prefixlen, ifi->ifi_ifname);
pfx->pfx_preflifetime = DEF_ADVPREFERREDLIFETIME;
} else
pfx->pfx_preflifetime = val64;
/* set other fields with protocol defaults */
pfx->pfx_validlifetime = DEF_ADVVALIDLIFETIME;
pfx->pfx_preflifetime = DEF_ADVPREFERREDLIFETIME;
pfx->pfx_onlinkflg = 1;
pfx->pfx_autoconfflg = 1;
pfx->pfx_origin = PREFIX_FROM_KERNEL;