View | Details | Raw Unified | Return to bug 236383
Collapse All | Expand All

(-)sys/netgraph/ng_iface.c (-5 / +16 lines)
Lines 745-761 Link Here
745
ng_iface_shutdown(node_p node)
745
ng_iface_shutdown(node_p node)
746
{
746
{
747
	const priv_p priv = NG_NODE_PRIVATE(node);
747
	const priv_p priv = NG_NODE_PRIVATE(node);
748
	struct ifnet *ifp;
748
749
750
	PRIV_WLOCK(priv);
751
	KASSERT(priv->ifp != NULL,
752
		("%s: node %p: priv->ifp == NULL", __func__, node));
753
754
	ifp = priv->ifp;
755
	priv->ifp = NULL;
756
	PRIV_WUNLOCK(priv);
757
758
	if (ifp == NULL)
759
		return (0);
760
749
	/*
761
	/*
750
	 * The ifnet may be in a different vnet than the netgraph node, 
762
	 * The ifnet may be in a different vnet than the netgraph node, 
751
	 * hence we have to change the current vnet context here.
763
	 * hence we have to change the current vnet context here.
752
	 */
764
	 */
753
	CURVNET_SET_QUIET(priv->ifp->if_vnet);
765
	CURVNET_SET_QUIET(ifp->if_vnet);
754
	bpfdetach(priv->ifp);
766
	bpfdetach(ifp);
755
	if_detach(priv->ifp);
767
	if_detach(ifp);
756
	if_free(priv->ifp);
768
	if_free(ifp);
757
	CURVNET_RESTORE();
769
	CURVNET_RESTORE();
758
	priv->ifp = NULL;
759
	free_unr(V_ng_iface_unit, priv->unit);
770
	free_unr(V_ng_iface_unit, priv->unit);
760
	rm_destroy(&priv->lock);
771
	rm_destroy(&priv->lock);
761
	free(priv, M_NETGRAPH_IFACE);
772
	free(priv, M_NETGRAPH_IFACE);

Return to bug 236383