diff options
author | mlaier <mlaier@FreeBSD.org> | 2007-11-21 14:18:14 +0000 |
---|---|---|
committer | mlaier <mlaier@FreeBSD.org> | 2007-11-21 14:18:14 +0000 |
commit | e7409e54d4d1a91b409d9fe25dde641829a9f48a (patch) | |
tree | e03c53644239efb432201bad6804ba8dc48fc439 /sys | |
parent | 6c2f035ca3cb0e034712bf8e8b1b455f347dd374 (diff) | |
download | FreeBSD-src-e7409e54d4d1a91b409d9fe25dde641829a9f48a.zip FreeBSD-src-e7409e54d4d1a91b409d9fe25dde641829a9f48a.tar.gz |
Cleanup pf interface mangement - esp. remove EVENTHANDLER before unloading
the coresponding code. This was lost during 4.1 import.
Reported by: ru
MFC after: 3 days
Diffstat (limited to 'sys')
-rw-r--r-- | sys/contrib/pf/net/pf_if.c | 30 | ||||
-rw-r--r-- | sys/contrib/pf/net/pf_ioctl.c | 2 |
2 files changed, 31 insertions, 1 deletions
diff --git a/sys/contrib/pf/net/pf_if.c b/sys/contrib/pf/net/pf_if.c index 14db9ae..eb7f37c 100644 --- a/sys/contrib/pf/net/pf_if.c +++ b/sys/contrib/pf/net/pf_if.c @@ -162,6 +162,36 @@ pfi_initialize(void) #endif } +#ifdef __FreeBSD__ +void +pfi_cleanup(void) +{ + struct pfi_kif *p; + + PF_UNLOCK(); + EVENTHANDLER_DEREGISTER(ifnet_arrival_event, pfi_attach_cookie); + EVENTHANDLER_DEREGISTER(ifnet_departure_event, pfi_detach_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); + EVENTHANDLER_DEREGISTER(ifaddr_event, pfi_ifaddr_event_cookie); + PF_LOCK(); + + pfi_all = NULL; + while ((p = RB_MIN(pfi_ifhead, &pfi_ifs))) { + if (p->pfik_rules || p->pfik_states) { + printf("pfi_cleanup: dangling refs for %s\n", + p->pfik_name); + } + + RB_REMOVE(pfi_ifhead, &pfi_ifs, p); + free(p, PFI_MTYPE); + } + + free(pfi_buffer, PFI_MTYPE); +} +#endif + struct pfi_kif * pfi_kif_get(const char *kif_name) { diff --git a/sys/contrib/pf/net/pf_ioctl.c b/sys/contrib/pf/net/pf_ioctl.c index b87b45b..6314b4c 100644 --- a/sys/contrib/pf/net/pf_ioctl.c +++ b/sys/contrib/pf/net/pf_ioctl.c @@ -3739,7 +3739,7 @@ pf_unload(void) wakeup_one(pf_purge_thread); msleep(pf_purge_thread, &pf_task_mtx, 0, "pftmo", hz); } -/* pfi_cleanup(); */ + pfi_cleanup(); pf_osfp_flush(); pf_osfp_cleanup(); cleanup_pf_zone(); |