--- fwsync/driver/fwsync.c 2022/08/18 13:02:13 1.11 +++ fwsync/driver/fwsync.c 2022/08/26 13:33:43 1.12.2.1 @@ -184,18 +184,20 @@ fwsync_destroy(struct ip_fw_chain *ch, ip_fw3_opheader n = (int*) (oh + 1); if (*n & CFG_SYNC_EDGE) { + if (fws_ctx.config & CTX_EDGE_ONLINE) { + ipfw_unregister_state_sync(); + ipfw_unregister_alias_sync(); + } + + callout_drain(&fws_co); + fws_cfg.cfg.on &= ~CFG_SYNC_EDGE; fws_cfg.cfg.edge = 0; fws_cfg.cfg.addrs = 0; memset(fws_cfg.cfg_addr, 0, sizeof fws_cfg.cfg_addr[0]); - if (fws_ctx.config & CTX_EDGE_ONLINE) { - callout_drain(&fws_co); - ipfw_unregister_state_sync(); - ipfw_unregister_alias_sync(); - soshutdown(fws_ctx.sockz[CFG_SYNC_ADDR_EDGE], SHUT_RD); - soclose(fws_ctx.sockz[CFG_SYNC_ADDR_EDGE]); - } + soshutdown(fws_ctx.sockz[CFG_SYNC_ADDR_EDGE], SHUT_RD); + soclose(fws_ctx.sockz[CFG_SYNC_ADDR_EDGE]); } if (*n & CFG_SYNC_COLLECTOR) { if (fws_ctx.config & (CTX_COLLECTOR_1_ONLINE | CTX_COLLECTOR_2_ONLINE)) { @@ -217,6 +219,8 @@ fwsync_destroy(struct ip_fw_chain *ch, ip_fw3_opheader } fws_ctx.config ^= fws_ctx.config; + + memset(&fws_acct, 0, sizeof fws_acct); return 0; }