git: 18caefe84708 - stable/15 - rtadvd(8): Honor pltime/vltime in interface declarations

From: Pouria Mousavizadeh Tehrani <pouria_at_FreeBSD.org>
Date: Thu, 07 May 2026 19:06:06 UTC
The branch stable/15 has been updated by pouria:

URL: https://cgit.FreeBSD.org/src/commit/?id=18caefe847086a9e89812db600c852b225467090

commit 18caefe847086a9e89812db600c852b225467090
Author:     tickerguy <karl@denninger.net>
AuthorDate: 2025-09-29 16:05:29 +0000
Commit:     Pouria Mousavizadeh Tehrani <pouria@FreeBSD.org>
CommitDate: 2026-05-07 19:04:43 +0000

    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
    
    (cherry picked from commit 103f9883d1ed7431c432caa6ab9c61cd4d0831d0)
---
 usr.sbin/rtadvd/config.c | 22 ++++++++++++++++++++--
 1 file changed, 20 insertions(+), 2 deletions(-)

diff --git a/usr.sbin/rtadvd/config.c b/usr.sbin/rtadvd/config.c
index 628ca3be886f..c02997337da3 100644
--- a/usr.sbin/rtadvd/config.c
+++ b/usr.sbin/rtadvd/config.c
@@ -1095,6 +1095,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)
@@ -1143,9 +1144,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;