MCPcopy Create free account
hub / github.com/F-Stack/f-stack / ng_iface_shutdown

Function ng_iface_shutdown

freebsd/netgraph/ng_iface.c:742–763  ·  view source on GitHub ↗

* Shutdown and remove the node and its associated interface. */

Source from the content-addressed store, hash-verified

740 * Shutdown and remove the node and its associated interface.
741 */
742static int
743ng_iface_shutdown(node_p node)
744{
745 const priv_p priv = NG_NODE_PRIVATE(node);
746
747 /*
748 * The ifnet may be in a different vnet than the netgraph node,
749 * hence we have to change the current vnet context here.
750 */
751 CURVNET_SET_QUIET(priv->ifp->if_vnet);
752 bpfdetach(priv->ifp);
753 if_detach(priv->ifp);
754 if_free(priv->ifp);
755 CURVNET_RESTORE();
756 priv->ifp = NULL;
757 free_unr(V_ng_iface_unit, priv->unit);
758 rm_destroy(&priv->lock);
759 free(priv, M_NETGRAPH_IFACE);
760 NG_NODE_SET_PRIVATE(node, NULL);
761 NG_NODE_UNREF(node);
762 return (0);
763}
764
765/*
766 * Hook disconnection. Note that we do *not* shutdown when all

Callers

nothing calls this directly

Calls 6

bpfdetachFunction · 0.85
if_detachFunction · 0.85
if_freeFunction · 0.85
free_unrFunction · 0.85
rm_destroyFunction · 0.50
freeFunction · 0.50

Tested by

no test coverage detected