Not only flush the ipfw tables when unloading ipfw or tearing

down a virtual netowrk stack, but also free the Radix Node Head.

Sponsored by:	ISPsystem
Reviewed by:	julian
MFC after:	5 days
This commit is contained in:
Bjoern A. Zeeb 2010-03-07 15:37:58 +00:00
parent 0019284ae8
commit e253cdd07c
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=204837
5 changed files with 17 additions and 5 deletions

View File

@ -1161,7 +1161,6 @@ rn_inithead(head, off)
return (1);
}
#ifdef VIMAGE
int
rn_detachhead(void **head)
{
@ -1177,7 +1176,6 @@ rn_detachhead(void **head)
*head = NULL;
return (1);
}
#endif
void
rn_init(int maxk)

View File

@ -162,9 +162,7 @@ struct radix_node_head {
void rn_init(int);
int rn_inithead(void **, int);
#ifdef VIMAGE
int rn_detachhead(void **);
#endif
int rn_refines(void *, void *);
struct radix_node
*rn_addmask(void *, int, int),

View File

@ -2392,7 +2392,7 @@ vnet_ipfw_uninit(const void *unused)
IPFW_WLOCK(chain);
ipfw_dyn_uninit(0); /* run the callout_drain */
ipfw_flush_tables(chain);
ipfw_destroy_tables(chain);
reap = NULL;
for (i = 0; i < chain->n_rules; i++) {
rule = chain->map[i];

View File

@ -272,6 +272,7 @@ struct radix_node;
int ipfw_lookup_table(struct ip_fw_chain *ch, uint16_t tbl, in_addr_t addr,
uint32_t *val);
int ipfw_init_tables(struct ip_fw_chain *ch);
void ipfw_destroy_tables(struct ip_fw_chain *ch);
int ipfw_flush_table(struct ip_fw_chain *ch, uint16_t tbl);
void ipfw_flush_tables(struct ip_fw_chain *ch);
int ipfw_add_table_entry(struct ip_fw_chain *ch, uint16_t tbl, in_addr_t addr,

View File

@ -203,6 +203,21 @@ ipfw_init_tables(struct ip_fw_chain *ch)
return (0);
}
void
ipfw_destroy_tables(struct ip_fw_chain *ch)
{
int tbl;
struct radix_node_head *rnh;
IPFW_WLOCK_ASSERT(ch);
ipfw_flush_tables(ch);
for (tbl = 0; tbl < IPFW_TABLES_MAX; tbl++) {
rnh = ch->tables[tbl];
rn_detachhead((void **)&rnh);
}
}
int
ipfw_lookup_table(struct ip_fw_chain *ch, uint16_t tbl, in_addr_t addr,
uint32_t *val)