Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 17 Jul 2024 09:19:53 +0800
From:      Zhenlei Huang <zlei@FreeBSD.org>
To:        Mark Johnston <markj@freebsd.org>
Cc:        freebsd-net@freebsd.org
Subject:   Re: flushing default router list upon inet6 route flush
Message-ID:  <AB0A823A-A2D0-451B-9953-77DE1268E1E4@FreeBSD.org>
In-Reply-To: <ZpbSS6dltUcqNPeD@nuc>
References:  <ZpbSS6dltUcqNPeD@nuc>

next in thread | previous in thread | raw e-mail | index | archive | help


> On Jul 17, 2024, at 4:04 AM, Mark Johnston <markj@freebsd.org> wrote:
> 
> Hello,
> 
> When IPv6 SLAAC is configured for an interface, the kernel will update
> its default router list upon receipt of a router advertisement.  In so
> doing it may install a default route; in the kernel this happens in
> defrouter_addreq().
> 
> If one uses "route flush" or "service routing restart" to reset the
> routing tables, the default router list is not purged, so a subsequent
> RA from the original default router does not update the list, and so
> does not re-create the default route, even if one re-runs rtsol(8).
> 
> This appears to be a bug, but I'm not sure where best to fix it.  Should
> "service routing restart" invoke "ndp -R" to flush the default router
> list?

That can be a workaround, but not the ideal fix.

> Should route(8) handle this as part of a flush command?

No, I do not think so. route(8) should handle the routing / FIB parts.
IPv6 default route list is maintained as a per AF basis. Handling the
default route list via route(8), aka the userland, seems to be more a
HACK.

> Or
> something else?

I'd propose that the kernel handle this situation, so that for other cases
such as `route -6 delete default`, or route change event from NETLINK
socket, the IPv6 SLAAC default router feature can also work as expected.

To be precise, `sys/netinet6/nd6_rtr.c` listen on route events and clear
the `installed` flag on deleting the previously installed default route, or
maybe purge all default route list. Then the next time the kernel receives
a RA it re-installs the default route.

This IMO may have side effect that user may really want to delete the
default route while not providing an explicit default route. I think for that
case user should disable accepting RA on the interface ( aka
ifconfig em0 inet6 no_radr, or turn on net.inet6.ip6.no_radr globally).

How about this proposal ?


Best regards,
Zhenlei




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?AB0A823A-A2D0-451B-9953-77DE1268E1E4>