summaryrefslogtreecommitdiffstats
path: root/sys/netgraph/ng_tee.c
diff options
context:
space:
mode:
authorjulian <julian@FreeBSD.org>2004-05-29 07:21:46 +0000
committerjulian <julian@FreeBSD.org>2004-05-29 07:21:46 +0000
commit14e22ae790f0931cfc80145d29b654521b3a3a10 (patch)
tree67609d746180f3ac3b3714e8dcaba00a354b8f02 /sys/netgraph/ng_tee.c
parent9fc4e00a1cc5858d10a3b68a9861213b649ccb04 (diff)
downloadFreeBSD-src-14e22ae790f0931cfc80145d29b654521b3a3a10.zip
FreeBSD-src-14e22ae790f0931cfc80145d29b654521b3a3a10.tar.gz
Add a new netgraph method to allow restoration of some
behaviour lost in the change from 4.x style netgraph tee nodes. Alter the tee node to use the new method. Document the behaviour. Step the ABI version number... old netgraph klds will refuse to load. Better than just crashing. Submitted by: Gleb Smirnoff <glebius@cell.sick.ru>
Diffstat (limited to 'sys/netgraph/ng_tee.c')
-rw-r--r--sys/netgraph/ng_tee.c28
1 files changed, 20 insertions, 8 deletions
diff --git a/sys/netgraph/ng_tee.c b/sys/netgraph/ng_tee.c
index 1f6fb9a..d7d19d5 100644
--- a/sys/netgraph/ng_tee.c
+++ b/sys/netgraph/ng_tee.c
@@ -79,6 +79,7 @@ typedef struct privdata *sc_p;
/* Netgraph methods */
static ng_constructor_t ngt_constructor;
static ng_rcvmsg_t ngt_rcvmsg;
+static ng_close_t ngt_close;
static ng_shutdown_t ngt_shutdown;
static ng_newhook_t ngt_newhook;
static ng_rcvdata_t ngt_rcvdata;
@@ -132,6 +133,7 @@ static struct ng_type ng_tee_typestruct = {
.name = NG_TEE_NODE_TYPE,
.constructor = ngt_constructor,
.rcvmsg = ngt_rcvmsg,
+ .close = ngt_close,
.shutdown = ngt_shutdown,
.newhook = ngt_newhook,
.rcvdata = ngt_rcvdata,
@@ -358,15 +360,25 @@ ngt_rcvdata(hook_p hook, item_p item)
}
/*
- * Shutdown processing
- *
- * This is tricky. If we have both a left and right hook, then we
- * probably want to extricate ourselves and leave the two peers
- * still linked to each other. Otherwise we should just shut down as
- * a normal node would.
+ * We are going to be shut down soon
*
- * To keep the scope of info correct the routine to "extract" a node
- * from two links is in ng_base.c.
+ * If we have both a left and right hook, then we probably want to extricate
+ * ourselves and leave the two peers still linked to each other. Otherwise we
+ * should just shut down as a normal node would.
+ */
+static int
+ngt_close(node_p node)
+{
+ const sc_p privdata = NG_NODE_PRIVATE(node);
+
+ if (privdata->left.hook && privdata->right.hook)
+ ng_bypass(privdata->left.hook, privdata->right.hook);
+
+ return (0);
+}
+
+/*
+ * Shutdown processing
*/
static int
ngt_shutdown(node_p node)
OpenPOWER on IntegriCloud