Bug 200382

Summary: Loading netgraph via bsnmpd, etc can cause domain to be registered after domain_finalize has been called
Product: Base System Reporter: Enji Cooper <ngie>
Component: kernAssignee: freebsd-net (Nobody) <net>
Status: Closed Works As Intended    
Severity: Affects Some People CC: eugen
Priority: ---    
Version: CURRENT   
Hardware: Any   
OS: Any   
See Also: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=73321

Description Enji Cooper freebsd_committer freebsd_triage 2015-05-22 04:17:19 UTC
We have a bug open at $work where we loaded netgraph modules after boot and it consistently prints out the warning shown here: https://svnweb.freebsd.org/base/head/sys/kern/uipc_domain.c?annotate=275329#l236

230 #ifdef notyet
231         KASSERT(domain_init_status < 2,
232             ("attempt to domain_add(%s) after domainfinalize()",
233             dp->dom_name));
234 #else
235         if (domain_init_status >= 2)
236                 printf("WARNING: attempt to domain_add(%s) after "
237                     "domainfinalize()\n", dp->dom_name);
238 #endif

This may or may not have been made worse with the commit done in r195837 to make the domains register more lazily, depending on whether or not the VNET was initialized.

This should repro the issue seen here:

- Build/install bsnmpd with WITH_NETGRAPH=yes (I think this is the default).
- Disable bsnmpd.
- Build netgraph as modules; don't load them at boot.
- Start bsnmpd after boot with forcestart.
Comment 1 Enji Cooper freebsd_committer freebsd_triage 2015-05-22 04:23:01 UTC
I'm not entirely sure if bsnmpd will load netgraph automatically, BUT if you load netgraph before you start bsnmpd, it might also repro this issue...
Comment 2 Eugene Grosbein freebsd_committer freebsd_triage 2017-06-11 15:48:35 UTC
(In reply to Ngie Cooper from comment #1)

Have you considered loading netgraph early by means of loader.conf?
Comment 3 Mark Linimon freebsd_committer freebsd_triage 2017-06-26 00:20:03 UTC
Canonicalize assignment.
Comment 4 Eugene Grosbein freebsd_committer freebsd_triage 2018-04-23 19:36:23 UTC
Feedback timeout. Also, we have enough ways to eliminate this cosmetic problem easiest of which are netgraph_load="YES" in /boot/loader.conf or kld_list="netgraph" in /etc/rc.conf