static int ipf_modunload(void) { int error, i; if (fr_refcnt) return EBUSY; if (fr_running >= 0) { ipf_pfil_unhook(); ipf_event_dereg(); WRITE_ENTER(&ipf_global); error = ipfdetach(); RWLOCK_EXIT(&ipf_global); if (error != 0) return error; } else error = 0; RW_DESTROY(&ipf_global); RW_DESTROY(&ipf_mutex); RW_DESTROY(&ipf_frcache); fr_running = -2; for (i = 0; ipf_devfiles[i]; i++) { if (ipf_devs[i] != NULL) destroy_dev(ipf_devs[i]); } printf("%s unloaded\n", ipfilter_version); return error; }
static int if_ipl_lkmunload(struct lkm_table *lkmtp, int cmd) { int error = 0; if (fr_running > 0) { error = ipfdetach(); if (error == 0) fr_running = -1; } if (error == 0) printf("%s unloaded\n", ipfilter_version); return (error); }
static void vnet_ipf_uninit(void) { if (V_ipfmain.ipf_refcnt) return; if (V_ipfmain.ipf_running >= 0) { if (ipfdetach(&V_ipfmain) != 0) return; ipf_destroy_all(&V_ipfmain); } V_ipfmain.ipf_running = -2; }
static int ipf_modunload() { int error, i; if (ipfmain.ipf_refcnt) return EBUSY; if (ipf_fbsd_sysctl_destroy(&ipfmain) != 0) return EIO; error = ipf_pfil_unhook(); if (error != 0) return error; if (ipfmain.ipf_running >= 0) { error = ipfdetach(&ipfmain); if (error != 0) return error; ipf_fbsd_sysctl_destroy(&ipfmain); ipf_destroy_all(&ipfmain); ipf_unload_all(); } else error = 0; ipfmain.ipf_running = -2; for (i = 0; ipf_devfiles[i]; i++) { if (ipf_devs[i] != NULL) destroy_dev(ipf_devs[i]); } printf("%s unloaded\n", ipfilter_version); return error; }