* Shutdown node */
| 815 | * Shutdown node |
| 816 | */ |
| 817 | static int |
| 818 | ng_bridge_shutdown(node_p node) |
| 819 | { |
| 820 | const priv_p priv = NG_NODE_PRIVATE(node); |
| 821 | |
| 822 | /* |
| 823 | * Shut down everything including the timer. Even if the |
| 824 | * callout has already been dequeued and is about to be |
| 825 | * run, ng_bridge_timeout() won't be fired as the node |
| 826 | * is already marked NGF_INVALID, so we're safe to free |
| 827 | * the node now. |
| 828 | */ |
| 829 | KASSERT(priv->numLinks == 0 && priv->numHosts == 0, |
| 830 | ("%s: numLinks=%d numHosts=%d", |
| 831 | __func__, priv->numLinks, priv->numHosts)); |
| 832 | ng_uncallout(&priv->timer, node); |
| 833 | NG_NODE_SET_PRIVATE(node, NULL); |
| 834 | NG_NODE_UNREF(node); |
| 835 | free(priv->tab, M_NETGRAPH_BRIDGE); |
| 836 | free(priv, M_NETGRAPH_BRIDGE); |
| 837 | return (0); |
| 838 | } |
| 839 | |
| 840 | /* |
| 841 | * Hook disconnection. |
nothing calls this directly
no test coverage detected