summaryrefslogtreecommitdiffstats
path: root/sys/netgraph/ng_socket.c
diff options
context:
space:
mode:
authorglebius <glebius@FreeBSD.org>2010-03-12 15:04:59 +0000
committerglebius <glebius@FreeBSD.org>2010-03-12 15:04:59 +0000
commite93d3296963195868bf04a7a6820ceef4c6a679d (patch)
tree608f4dd8db5f440fa1f16dda8e93c606342dccf2 /sys/netgraph/ng_socket.c
parentaad46e823b4427474c2bf12ea7446b15d1dc6835 (diff)
downloadFreeBSD-src-e93d3296963195868bf04a7a6820ceef4c6a679d.zip
FreeBSD-src-e93d3296963195868bf04a7a6820ceef4c6a679d.tar.gz
Now fix functionality of 'netstat -f netgraph' that hasn't worked
starting from netgraph import in 1999. netstat(8) used pointer to node as node address, oops. That didn't work, we need the node ID in brackets to successfully address a node. We can't look into ng_node, due to inability to include netgraph/netgraph.h in userland code. So let the node make a hint for a userland, storing the node ID in its private data. MFC after: 2 weeks
Diffstat (limited to 'sys/netgraph/ng_socket.c')
-rw-r--r--sys/netgraph/ng_socket.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/sys/netgraph/ng_socket.c b/sys/netgraph/ng_socket.c
index efee333..28e4f0e 100644
--- a/sys/netgraph/ng_socket.c
+++ b/sys/netgraph/ng_socket.c
@@ -552,6 +552,9 @@ ng_attach_cntl(struct socket *so)
return (error);
}
+ /* Store a hint for netstat(1). */
+ priv->node_id = priv->node->nd_ID;
+
/* Link the node and the private data. */
NG_NODE_SET_PRIVATE(priv->node, priv);
NG_NODE_REF(priv->node);
OpenPOWER on IntegriCloud