Page MenuHomeFreeBSD

pf: Register the netlink family only while the vnets are set up
ClosedPublic

Authored by rcm on Mon, Oct 12, 3:40 PM.
Tags
None
Referenced Files
F175839730: D60651.diff
Tue, Oct 13, 7:20 PM
F175813991: D60651.id189612.diff
Tue, Oct 13, 2:27 PM
F175797363: D60651.id.diff
Tue, Oct 13, 10:44 AM
F175794146: D60651.id189612.diff
Tue, Oct 13, 10:07 AM
F175791298: D60651.id189612.diff
Tue, Oct 13, 9:35 AM
F175775731: D60651.id189612.diff
Tue, Oct 13, 6:32 AM
F175774342: D60651.diff
Tue, Oct 13, 6:13 AM
F175769371: D60651.diff
Tue, Oct 13, 5:09 AM

Details

Summary

pf_modevent() registers the generic netlink family at MOD_LOAD, before
vnet_pf_init() has set up the state hashes and locks the handlers use,
and pf_unload() unregisters it after vnet_pf_uninit() has torn them
down. Sending PFNL_CMD_GETSTATES while pf loads or unloads panics in
pf_handle_getstates() on a NULL or freed V_pf_idhash.

Register the family from a SYSINIT ordered after vnet_pf_init(), and
unregister it from the matching SYSUNINIT, before vnet_pf_uninit().

Fixes: 2cef62886dc7 ("pf: convert state retrieval to netlink")
MFC after: 1 week
Sponsored by: Rubicon Communications, LLC ("Netgate")

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable