NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

bin/51994: rtadvd: fix the default value of rltime



>Number:         51994
>Category:       bin
>Synopsis:       rtadvd: fix the default value of rltime
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Feb 23 02:25:00 +0000 2017
>Originator:     Ryota Ozaki
>Release:        6, 7, current
>Organization:
>Environment:
NetBSD bpv4 7.99.60 NetBSD 7.99.60 (BPV4_NFS) #11: Wed Feb 22 11:51:06 JST 2017  ozaki-r@rangeley:(hidden) amd64
>Description:
According to rtadvd.conf(5), the default value of rltime is 1800 seconds.
However the default value is set as maxinterval * 3.

The default value of maxinterval is 600, so if maxinterval isn't set, rltime
becomes 1800 correctly just in luck. However if maxinterval is set to
a some value other than 600, the default value of rltime wouldn't be 1800.
>How-To-Repeat:
Run rtadvd with setting maxinterval to a some value other than 600.
See the router lifetime field of a RA sent from the rtadvd (e.g., by tcpdump -vvv).
>Fix:
diff --git a/usr.sbin/rtadvd/config.c b/usr.sbin/rtadvd/config.c
index 5ef9e0c..5e39ac8 100644
--- a/usr.sbin/rtadvd/config.c
+++ b/usr.sbin/rtadvd/config.c
@@ -305,7 +305,7 @@ getconfig(const char *intface, int exithard)
                goto errexit;
        }
 
-       MAYHAVE(val, "rltime", tmp->maxinterval * 3);
+       MAYHAVE(val, "rltime", DEF_ADVROUTERLIFETIME);
        if (val && (val < tmp->maxinterval || val > MAXROUTERLIFETIME)) {
                syslog(LOG_ERR,
                       "<%s> router lifetime (%d) on %s is invalid "
diff --git a/usr.sbin/rtadvd/rtadvd.h b/usr.sbin/rtadvd/rtadvd.h
index ad6fe86..21dbe49 100644
--- a/usr.sbin/rtadvd/rtadvd.h
+++ b/usr.sbin/rtadvd/rtadvd.h
@@ -52,6 +52,7 @@ extern struct sockaddr_in6 sin6_sitelocal_allrouters;
 #define DEF_ADVCURHOPLIMIT 64
 #define DEF_ADVVALIDLIFETIME 2592000
 #define DEF_ADVPREFERREDLIFETIME 604800
+#define DEF_ADVROUTERLIFETIME 1800
 
 #define MAXROUTERLIFETIME 9000
 #define MIN_MAXINTERVAL 4



Home | Main Index | Thread Index | Old Index