FreeBSD/sys/netpfil/ipfw/ip_fw2.c
/*
 * Called for the removal of each instance.
 */
Called for the removal of each instance.
Called for the removal of each instance .
static int
vnet_ipfw_uninit(const void *unused)
{
	struct ip_fw *reap;
	struct ip_fw_chain *chain = &V_layer3_chain;
	int i, last;
	V_ipfw_vnet_ready = 0; 
	(void)ipfw_attach_hooks(0 );
	V_ip_fw_ctl_ptr = NULL;
	ipfw_log_bpf(0); 
	last = IS_DEFAULT_VNET(curvnet) ? 1 : 0;
	IPFW_UH_WLOCK(chain);
	IPFW_UH_WUNLOCK(chain);
	ipfw_dyn_uninit(0);	
	IPFW_UH_WLOCK(chain);
	reap = NULL;
	IPFW_WLOCK(chain);
	for (i = 0; i < chain->n_rules; i++)
		ipfw_reap_add(chain, &reap, chain->map[i]);
	free(chain->map, M_IPFW);
#ifdef LINEAR_SKIPTO
	ipfw_destroy_skipto_cache(chain);
#endif
	IPFW_WUNLOCK(chain);
	IPFW_UH_WUNLOCK(chain);
	ipfw_destroy_tables(chain, last);
	ipfw_eaction_uninit(chain, last);
	if (reap != NULL)
		ipfw_reap_rules(reap);
	vnet_ipfw_iface_destroy(chain);
	ipfw_destroy_srv(chain);
	IPFW_LOCK_DESTROY(chain);
	ipfw_dyn_uninit(1);	
	ipfw_destroy_counters();
	ipfw_destroy_obj_rewriter();
	return (0);
}
static int vnet_ipfw_uninit ( const void * unused ) { struct ip_fw * reap ; struct ip_fw_chain * chain = & V_layer3_chain ; int i , last ; V_ipfw_vnet_ready = 0 ; ( void ) ipfw_attach_hooks ( 0 ) ; V_ip_fw_ctl_ptr = NULL ; ipfw_log_bpf ( 0 ) ; last = IS_DEFAULT_VNET ( curvnet ) ? 1 : 0 ; IPFW_UH_WLOCK ( chain ) ; IPFW_UH_WUNLOCK ( chain ) ; ipfw_dyn_uninit ( 0 ) ; IPFW_UH_WLOCK ( chain ) ; reap = NULL ; IPFW_WLOCK ( chain ) ; for ( i = 0 ; i < chain -> n_rules ; i ++ ) ipfw_reap_add ( chain , & reap , chain -> map [ i ] ) ; free ( chain -> map , M_IPFW ) ; #ifdef LINEAR_SKIPTO ipfw_destroy_skipto_cache ( chain ) ; #endif IPFW_WUNLOCK ( chain ) ; IPFW_UH_WUNLOCK ( chain ) ; ipfw_destroy_tables ( chain , last ) ; ipfw_eaction_uninit ( chain , last ) ; if ( reap != NULL ) ipfw_reap_rules ( reap ) ; vnet_ipfw_iface_destroy ( chain ) ; ipfw_destroy_srv ( chain ) ; IPFW_LOCK_DESTROY ( chain ) ; ipfw_dyn_uninit ( 1 ) ; ipfw_destroy_counters ( ) ; ipfw_destroy_obj_rewriter ( ) ; return ( 0 ) ; }
Called for the removal of each instance.
Called for the removal of each instance .
/* tell new callers to go away */ /*
	 * disconnect from ipv4, ipv6, layer2 and sockopt.
	 * Then grab, release and grab again the WLOCK so we make
	 * sure the update is propagated and nobody will be in.
	 */ /* detach */ /* uninit */ /* run the callout_drain */ /* free the remaining parts */