Subject: bin/33462: rtadvd(8) broken in NetBSD-current
To: None <gnats-admin@netbsd.org, netbsd-bugs@netbsd.org>
From: Matthias Scheler <tron@zhadum.org.uk>
List: netbsd-bugs
Date: 05/10/2006 22:00:00
>Number:         33462
>Category:       bin
>Synopsis:       rtadvd(8) broken in NetBSD-current
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed May 10 22:00:00 +0000 2006
>Originator:     Matthias Scheler
>Release:        NetBSD 3.99.19 2006-05-09 HEAD branch sources
>Organization:
Matthias Scheler                                  http://scheler.de/~matthias/
>Description:
After upgrading my IPv6 router from NetBSD 3.0_STABLE to 3.99.19 I noticed
that it was now longer sending out router advertisements. It turned out
that the daemon wouldn't start because of this error:

maxinterval (0) on hme0 is invalid (must be between 4 and 1800)

I have however not set "maxinterval" anyway. Looking at the source code
the error is quite obvious:


        tmp = (struct rainfo *)malloc(sizeof(*ralist));
[...]
        memset(tmp, 0, sizeof(*tmp));
[...]
        MAYHAVE(val, "maxinterval", tmp->maxinterval * 3);
        if (val < MIN_MAXINTERVAL || val > MAX_MAXINTERVAL) {
                syslog(LOG_ERR,
                       "<%s> maxinterval (%ld) on %s is invalid "
                       "(must be between %u and %u)", __func__, val,
                       intface, MIN_MAXINTERVAL, MAX_MAXINTERVAL);
                exit(1);
        }

"tmp->maxinterval" has not been changed between these two lines and
is therefore still 0 which is lower than MIN_MAXINTERVAL (4).

This bug was introduced in revision 1.22:

-	MAYHAVE(val, "maxinterval", DEF_MAXRTRADVINTERVAL);
+	MAYHAVE(val, "maxinterval", tmp->maxinterval * 3);

I don't know why this change was made but it looks incorrect to me.
"DEF_MAXRTRADVINTERVAL" is still defined in "rtadvd.h" and should
probably still be used.

>How-To-Repeat:
Start "rtadvd" with "rtadvd <interfacename>" without a configuration file
"/etc/rtadvd.conf" present.

>Fix:
rtadvd(8) built from "netbsd-3" branch sources works fine.

>Unformatted:
 System: NetBSD ivanova.zhadum.org.uk 3.99.19 NetBSD 3.99.19 (IVANOVA) #0: Tue May 9 16:34:27 BST 2006 tron@colwyn.zhadum.org.uk:/src/sys/compile/IVANOVA sparc
 Architecture: sparc
 Machine: sparc