void ipfw_destroy_tables(struct ip_fw_chain *ch) { uint16_t tbl; /* Flush all tables */ for (tbl = 0; tbl < V_fw_tables_max; tbl++) ipfw_flush_table(ch, tbl); /* Free pointers itself */ free(ch->tables, M_IPFW); free(ch->xtables, M_IPFW); free(ch->tabletype, M_IPFW); }
void ipfw_destroy_tables(struct ip_fw_chain *ch) { uint16_t tbl; struct radix_node_head *rnh; IPFW_WLOCK_ASSERT(ch); for (tbl = 0; tbl < IPFW_TABLES_MAX; tbl++) { ipfw_flush_table(ch, tbl); rnh = ch->tables[tbl]; rn_detachhead((void **)&rnh); } }
int ipfw_init_tables(struct ip_fw_chain *ch) { int i; uint16_t j; for (i = 0; i < IPFW_TABLES_MAX; i++) { if (!rn_inithead((void **)&ch->tables[i], KEY_OFS)) { for (j = 0; j < i; j++) { (void) ipfw_flush_table(ch, j); } return (ENOMEM); } } return (0); }