[Bug 287887] /etc/rc.d/defaultroute wastes 30 seconds of boot time

From: <bugzilla-noreply_at_freebsd.org>
Date: Sat, 28 Jun 2025 22:19:54 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=287887

            Bug ID: 287887
           Summary: /etc/rc.d/defaultroute wastes 30 seconds of boot time
           Product: Base System
           Version: 14.3-RELEASE
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: conf
          Assignee: bugs@FreeBSD.org
          Reporter: Igor.Gusarov@kaspersky.com

`/etc/rc.d/defaultroute` script assumes that DHCP, if used, is always employed
to obtain the default route for the host. However, this assumption isn't always
the case. For example:

1) DHCP could be used to configure only internal (downstream) network
interfaces;

2) Some DHCP interfaces (either external or internal) could be configured to
operate in FIBs other than the default FIB 0, in which case default route
obtained for those FIB would still evade `/etc/rc.d/defaultroute` script.

while the actual default route in FIB 0 is configured statically, via
'defaultroute' parameter in rc.conf.

In both cases, `/etc/rc.d/defaultroute` script will hopelessly wait 30 seconds
for the default route to appear, effectively wasting that time because the
actual default route would be added later by `/etc/rc.d/routing` script which
is (at this momemnt) not guaranteed to run before `/etc/rc.d/defaultroute`
script.

I suggest introducing one more rcorder dependency, so that
`/etc/rc.d/defaultroute` script would REQUIRE `/etc/rc.d/routing` script. The
latter is the one responsible for setting up the static default route.

The patch is:

--- defaultroute.orig   2021-04-09 09:17:30.000000000 +0300
+++ defaultroute        2025-06-29 00:54:57.721431000 +0300
@@ -6,7 +6,7 @@
 #

 # PROVIDE: defaultroute
-# REQUIRE: devd netif stf
+# REQUIRE: devd netif stf routing
 # KEYWORD: nojailvnet

-- 
You are receiving this mail because:
You are the assignee for the bug.