The branch main has been updated by pouria:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=103f9883d1ed7431c432caa6ab9c61cd4d0831d0

commit 103f9883d1ed7431c432caa6ab9c61cd4d0831d0
Author:     tickerguy <[email protected]>
AuthorDate: 2025-09-29 16:05:29 +0000
Commit:     Pouria Mousavizadeh Tehrani <[email protected]>
CommitDate: 2026-05-06 19:19:13 +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 <[email protected]>
    PR:             288426
    Reviewed by:    pouria
    Pull Request:   https://github.com/freebsd/freebsd-src/pull/1863
---
 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 8b7079c17822..df4473841312 100644
--- a/usr.sbin/rtadvd/config.c
+++ b/usr.sbin/rtadvd/config.c
@@ -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;

Reply via email to