netlink: add unregister call in cleanup

For protocols that use netlink (generic and route for now), the unint
handler seems to have forgotten to call unregister, which will cause
the assertion the next time the module is loaded.

This patch adds unregister call to netlink_unregister_proto() for those
handlers to avoid bad things happen.

Reviewed-by: melifaro
Fixes: 7e5bf68495 ("netlink: add netlink support")
Pull-request: https://github.com/freebsd/freebsd-src/pull/781
Signed-off-by: Lin Ma <linma@zju.edu.cn>
This commit is contained in:
Lin Ma 2023-06-19 17:32:59 +08:00 committed by Ed Maste
parent 366ef17bb6
commit 4bdf7f6951
2 changed files with 2 additions and 0 deletions

View File

@ -296,6 +296,7 @@ SYSINIT(genl_load_all, SI_SUB_PROTO_DOMAIN, SI_ORDER_THIRD, genl_load_all, NULL)
static void
genl_unload(void *u __unused)
{
netlink_unregister_proto(NETLINK_GENERIC);
EVENTHANDLER_DEREGISTER(genl_family_event, family_event_tag);
genl_unregister_family(CTRL_FAMILY_NAME);
NET_EPOCH_WAIT();

View File

@ -134,6 +134,7 @@ static void
rtnl_unload(void *u __unused)
{
netlink_callback_p = nlbridge_orig_p;
netlink_unregister_proto(NETLINK_ROUTE);
rtnl_ifaces_destroy();
rtnl_neighs_destroy();