Re: git: 607f6be6ec19 - main - rtadvd: Fix validation of the MTU parameter when parsing config

From: Mark Johnston <markj_at_freebsd.org>
Date: Wed, 01 Apr 2026 16:03:14 UTC
On Wed, Apr 01, 2026 at 03:25:44PM +0000, Bjoern A. Zeeb wrote:
> On Wed, 1 Apr 2026, Mark Johnston wrote:
> 
> > The branch main has been updated by markj:
> > 
> > URL: https://cgit.FreeBSD.org/src/commit/?id=607f6be6ec19f49ff595226afe1c8aa6515c59a0
> > 
> > commit 607f6be6ec19f49ff595226afe1c8aa6515c59a0
> > Author:     Mark Johnston <markj@FreeBSD.org>
> > AuthorDate: 2026-04-01 12:14:24 +0000
> > Commit:     Mark Johnston <markj@FreeBSD.org>
> > CommitDate: 2026-04-01 12:19:35 +0000
> > 
> >    rtadvd: Fix validation of the MTU parameter when parsing config
> > 
> >    MFC after:      1 week
> > ---
> > usr.sbin/rtadvd/config.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/usr.sbin/rtadvd/config.c b/usr.sbin/rtadvd/config.c
> > index 83b2efb68303..c0af8f76ca49 100644
> > --- a/usr.sbin/rtadvd/config.c
> > +++ b/usr.sbin/rtadvd/config.c
> > @@ -619,7 +619,7 @@ getconfig_free_pfx:
> > 		get_prefix(rai);
> > 
> > 	MAYHAVE(val64, "mtu", 0);
> > -	if (val < 0 || val64 > 0xffffffff) {
> > +	if (val64 < 0 || val64 > 0xffffffff) {
> 
> Forgive me for asking, but would a reasonable check possibly cap this
> right away at 0xffff as I cannot see us having interfaces with an
> MTU larger than that.
> We just removed IPv6 Jumbograms (or still in review?) for similar reasons?

The code does this several lines later, after truncating the value to a
32-bit integer.

> > 		syslog(LOG_ERR,
> > 		    "<%s> mtu (%" PRIu64 ") on %s out of range",
> > 		    __func__, val64, ifi->ifi_ifname);
> > 
> > 
> 
> -- 
> Bjoern A. Zeeb                                                     r15:7