From 04853d8a8266f41a2164c6b4eb5ec6a2cbf195f9 Mon Sep 17 00:00:00 2001 From: Julian Elischer Date: Wed, 27 Oct 1999 11:48:35 +0000 Subject: [PATCH] The node goes away when last session disconnects or when disconnected from the ethernet node. --- sys/netgraph/ng_pppoe.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/sys/netgraph/ng_pppoe.c b/sys/netgraph/ng_pppoe.c index 2d3bb62000a8..8312c09f51e0 100644 --- a/sys/netgraph/ng_pppoe.c +++ b/sys/netgraph/ng_pppoe.c @@ -1253,12 +1253,14 @@ ng_pppoe_disconnect(hook_p hook) node_p node = hook->node; priv_p privp = node->private; sessp sp; + int hooks; AAA if (hook->private == &privp->debug_hook) { privp->debug_hook = NULL; } else if (hook->private == &privp->ethernet_hook) { privp->ethernet_hook = NULL; + ng_rmnode(node); } else { sp = hook->private; if (sp->state != PPPOE_SNONE ) { @@ -1302,6 +1304,13 @@ AAA } FREE(sp, M_NETGRAPH); hook->private = NULL; + /* work out how many session hooks there are + /* Node goes away on last session hook removal */ + hooks = node->numhooks; /* this one already not counted */ + if (privp->ethernet_hook) hooks -= 1; + if (privp->debug) hooks -= 1; + if (hooks == 0) + ng_rmnode(node); } if (node->numhooks == 0) ng_rmnode(node);