The node goes away when last session disconnects or when disconnected from

the ethernet node.
This commit is contained in:
Julian Elischer 1999-10-27 11:48:35 +00:00
parent 8876b55d7b
commit 04853d8a82

View File

@ -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);