Re: flushing default router list upon inet6 route flush

From: Roy Marples <roy_at_marples.name>
Date: Wed, 17 Jul 2024 06:36:35 UTC
Hi Mark

 ---- On Tue, 16 Jul 2024 21:04:27 +0100  Mark Johnston  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?  Should route(8) handle this as part of a flush command?  Or
 > something else?

rc.d/rtsold should probably be fixed, but it also really the wrong solutuion.
Kernel handling of RA cannot be influenced very well from userland and as you see,
this affects the default route.

An alternative solution would be to use dhcpcd(8) from ports to manage RA instead
of the kernel. It can also handle DHCP, replacing dhclient(8) but that's up to you.
You might want to add `noipv4` to `/etc/dhcpcd.conf` until you're happy changing fully over.

dhcpcd will intelligently manage all the routes.
You can purge everything (including addresses and DNS) with `dhcpcd -k` and restore them with `dhcpcd -n`.

Good luck!

Roy