PERFORCE change 167264 for review

Julian Elischer julian at elischer.org
Wed Aug 12 22:18:52 UTC 2009


Marko Zec wrote:
> http://perforce.freebsd.org/chv.cgi?CH=167264
> 
> Change 167264 by zec at zec_tpx32 on 2009/08/12 22:02:24
> 
> 	Release resources / memory when vnets are destroyed.
> 
> Affected files ...
> 
> .. //depot/projects/vimage-commit2/src/sys/netinet/ip_divert.c#39 edit
> 
> Differences ...
> 
> ==== //depot/projects/vimage-commit2/src/sys/netinet/ip_divert.c#39 (text+ko) ====
> 
> @@ -185,6 +185,17 @@
>  	uma_zone_set_max(V_divcbinfo.ipi_zone, maxsockets);
>  }
>  
> +static void
> +div_destroy(void)
> +{
> +
> +	INP_INFO_LOCK_DESTROY(&V_divcbinfo);
> +	uma_zdestroy(V_divcbinfo.ipi_zone);
> +	hashdestroy(V_divcbinfo.ipi_hashbase, M_PCB, V_divcbinfo.ipi_hashmask);
> +	hashdestroy(V_divcbinfo.ipi_porthashbase, M_PCB,
> +	    V_divcbinfo.ipi_porthashmask);
> +}
> +
>  /*
>   * IPPROTO_DIVERT is not in the real IP protocol number space; this
>   * function should never be called.  Just in case, drop any packets.
> @@ -716,6 +727,9 @@
>  	.pr_ctlinput =		div_ctlinput,
>  	.pr_ctloutput =		ip_ctloutput,
>  	.pr_init =		div_init,
> +#ifdef VIMAGE
> +	.pr_destroy =		div_destroy,
> +#endif
>  	.pr_usrreqs =		&div_usrreqs
>  };
>  
> @@ -775,8 +789,7 @@
>  		ip_divert_ptr = NULL;
>  		err = pf_proto_unregister(PF_INET, IPPROTO_DIVERT, SOCK_RAW);
>  		INP_INFO_WUNLOCK(&V_divcbinfo);
> -		INP_INFO_LOCK_DESTROY(&V_divcbinfo);
> -		uma_zdestroy(V_divcbinfo.ipi_zone);
> +		div_destroy();
>  		EVENTHANDLER_DEREGISTER(maxsockets_change, ip_divert_event_tag);
>  		break;
>  #endif /* !VIMAGE */



to avoid this problem Robert added:
VNET_DOMAIN_SET(inet)

which does this for domains. and he uses elsewhere.







More information about the p4-projects mailing list