* Shutdown and remove the node and its associated interface. */
| 740 | * Shutdown and remove the node and its associated interface. |
| 741 | */ |
| 742 | static int |
| 743 | ng_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 |