pf: deregister the ifnet_rename_event handler on unload

pfi_initialize() registers pfi_rename_ifnet_event() on
ifnet_rename_event, but pfi_cleanup() never deregisters it.  After
"kldunload pf", the next interface rename calls through a stale
pointer into the unloaded module:

kldload pf
kldunload pf
ifconfig epair create
ifconfig epair0a name foo

Reviewed by:	kp
Approved by:	kp (mentor)
Fixes:		349fcf079c ("net: add ifnet_rename_event EVENTHANDLER(9) for interface renaming")
Sponsored by:	Rubicon Communications, LLC ("Netgate")
This commit is contained in:
R. Christian McDonald committed 2026-09-29 15:19:19 -04:00
1 parent f15642e24d
commit 57f9bad918
1 file changed
+1
+1
View File
@@ -221,6 +221,7 @@ pfi_cleanup(void)
EVENTHANDLER_DEREGISTER(ifnet_arrival_event, pfi_attach_cookie);
EVENTHANDLER_DEREGISTER(ifnet_departure_event, pfi_detach_cookie);
EVENTHANDLER_DEREGISTER(ifnet_rename_event, pfi_rename_cookie);
EVENTHANDLER_DEREGISTER(group_attach_event, pfi_attach_group_cookie);
EVENTHANDLER_DEREGISTER(group_change_event, pfi_change_group_cookie);
EVENTHANDLER_DEREGISTER(group_detach_event, pfi_detach_group_cookie);