summaryrefslogtreecommitdiffstats
path: root/sys/netgraph/ng_echo.c
diff options
context:
space:
mode:
authorjulian <julian@FreeBSD.org>2001-01-06 00:46:47 +0000
committerjulian <julian@FreeBSD.org>2001-01-06 00:46:47 +0000
commitf0c46a9d00fc9fe4644cef5784e76b360f5036c7 (patch)
tree561902279f2f361f3e137f7fc029ce2714981289 /sys/netgraph/ng_echo.c
parente06f071f56cf6badae9215f8a14ccc66a3fc0f5a (diff)
downloadFreeBSD-src-f0c46a9d00fc9fe4644cef5784e76b360f5036c7.zip
FreeBSD-src-f0c46a9d00fc9fe4644cef5784e76b360f5036c7.tar.gz
Rewrite of netgraph to start getting ready for SMP.
This version is functional and is aproaching solid.. notice I said APROACHING. There are many node types I cannot test I have tested: echo hole ppp socket vjc iface tee bpf async tty The rest compile and "Look" right. More changes to follow. DEBUGGING is enabled in this code to help if people have problems.
Diffstat (limited to 'sys/netgraph/ng_echo.c')
-rw-r--r--sys/netgraph/ng_echo.c39
1 files changed, 23 insertions, 16 deletions
diff --git a/sys/netgraph/ng_echo.c b/sys/netgraph/ng_echo.c
index 6c46341..337df72 100644
--- a/sys/netgraph/ng_echo.c
+++ b/sys/netgraph/ng_echo.c
@@ -55,6 +55,7 @@
#include <netgraph/ng_echo.h>
/* Netgraph methods */
+static ng_constructor_t nge_cons;
static ng_rcvmsg_t nge_rcvmsg;
static ng_rcvdata_t nge_rcvdata;
static ng_disconnect_t nge_disconnect;
@@ -64,7 +65,7 @@ static struct ng_type typestruct = {
NG_ABI_VERSION,
NG_ECHO_NODE_TYPE,
NULL,
- NULL,
+ nge_cons,
nge_rcvmsg,
NULL,
NULL,
@@ -76,33 +77,37 @@ static struct ng_type typestruct = {
};
NETGRAPH_INIT(echo, &typestruct);
+static int
+nge_cons(node_p node)
+{
+ return (0);
+}
+
/*
* Receive control message. We just bounce it back as a reply.
*/
static int
-nge_rcvmsg(node_p node, struct ng_mesg *msg, const char *retaddr,
- struct ng_mesg **rptr, hook_p lasthook)
+nge_rcvmsg(node_p node, item_p item, hook_p lasthook)
{
- if (rptr) {
- msg->header.flags |= NGF_RESP;
- *rptr = msg;
- } else {
- FREE(msg, M_NETGRAPH);
- }
- return (0);
+ struct ng_mesg *msg;
+ int error = 0;
+
+ NGI_GET_MSG(item, msg);
+ msg->header.flags |= NGF_RESP;
+ NG_RESPOND_MSG(error, node, item, msg);
+ return (error);
}
/*
* Receive data
*/
static int
-nge_rcvdata(hook_p hook, struct mbuf *m, meta_p meta,
- struct mbuf **ret_m, meta_p *ret_meta, struct ng_mesg **resp)
+nge_rcvdata(hook_p hook, item_p item)
{
int error = 0;
- NG_SEND_DATA(error, hook, m, meta);
- return (error);
+ NG_FWD_DATA(error, item, hook);
+ return (0);
}
/*
@@ -111,8 +116,10 @@ nge_rcvdata(hook_p hook, struct mbuf *m, meta_p meta,
static int
nge_disconnect(hook_p hook)
{
- if (hook->node->numhooks == 0)
- ng_rmnode(hook->node);
+ if ((hook->node->numhooks == 0)
+ && ((hook->node->flags & NG_INVALID) == 0)) {
+ ng_rmnode_self(hook->node);
+ }
return (0);
}
OpenPOWER on IntegriCloud