diff options
author | glebius <glebius@FreeBSD.org> | 2012-01-23 15:39:45 +0000 |
---|---|---|
committer | glebius <glebius@FreeBSD.org> | 2012-01-23 15:39:45 +0000 |
commit | d5bb5249b28f8b367e607754ee57bb2949cff37d (patch) | |
tree | a6f32c6090209a268cc6b156f6907e9958f4e977 /sys/netgraph | |
parent | 6fbf18d42fa659fa2045199fee26d791fa06a136 (diff) | |
download | FreeBSD-src-d5bb5249b28f8b367e607754ee57bb2949cff37d.zip FreeBSD-src-d5bb5249b28f8b367e607754ee57bb2949cff37d.tar.gz |
In ng_socket(4) expose less kernel internals to userland. This commit
breaks ABI, but makes probability of ABI breakage in future less.
Diffstat (limited to 'sys/netgraph')
-rw-r--r-- | sys/netgraph/ng_socket.c | 19 | ||||
-rw-r--r-- | sys/netgraph/ng_socketvar.h | 14 |
2 files changed, 16 insertions, 17 deletions
diff --git a/sys/netgraph/ng_socket.c b/sys/netgraph/ng_socket.c index d53787f..7276d37 100644 --- a/sys/netgraph/ng_socket.c +++ b/sys/netgraph/ng_socket.c @@ -162,6 +162,19 @@ static struct mtx ngsocketlist_mtx; #define TRAP_ERROR #endif +/* Per-node private data */ +struct ngsock { + struct ng_node *node; /* the associated netgraph node */ + struct ngpcb *datasock; /* optional data socket */ + struct ngpcb *ctlsock; /* optional control socket */ + int flags; + int refs; + struct mtx mtx; /* mtx to wait on */ + int error; /* place to store error */ +}; + +#define NGS_FLAG_NOLINGER 1 /* close with last hook */ + /*************************************************************** Control sockets ***************************************************************/ @@ -535,9 +548,7 @@ ng_attach_cntl(struct socket *so) pcbp->sockdata = priv; priv->refs++; priv->node = node; - - /* Store a hint for netstat(1). */ - priv->node_id = priv->node->nd_ID; + pcbp->node_id = node->nd_ID; /* hint for netstat(1) */ /* Link the node and the private data. */ NG_NODE_SET_PRIVATE(priv->node, priv); @@ -608,6 +619,7 @@ ng_detach_common(struct ngpcb *pcbp, int which) panic("%s", __func__); } pcbp->sockdata = NULL; + pcbp->node_id = 0; ng_socket_free_priv(priv); } @@ -698,6 +710,7 @@ ng_connect_data(struct sockaddr *nam, struct ngpcb *pcbp) mtx_lock(&priv->mtx); priv->datasock = pcbp; pcbp->sockdata = priv; + pcbp->node_id = priv->node->nd_ID; /* hint for netstat(1) */ priv->refs++; mtx_unlock(&priv->mtx); NG_FREE_ITEM(item); /* drop the reference to the node */ diff --git a/sys/netgraph/ng_socketvar.h b/sys/netgraph/ng_socketvar.h index c1e59dc..59080d2 100644 --- a/sys/netgraph/ng_socketvar.h +++ b/sys/netgraph/ng_socketvar.h @@ -50,20 +50,6 @@ struct ngpcb { struct ngsock *sockdata; /* netgraph info */ LIST_ENTRY(ngpcb) socks; /* linked list of sockets */ int type; /* NG_CONTROL or NG_DATA */ -}; - -/* Per-node private data */ -struct ngsock { - struct ng_node *node; /* the associated netgraph node */ - struct ngpcb *datasock; /* optional data socket */ - struct ngpcb *ctlsock; /* optional control socket */ - int flags; - int refs; - struct mtx mtx; /* mtx to wait on */ - int error; /* place to store error */ ng_ID_t node_id; /* a hint for netstat(1) to find the node */ }; -#define NGS_FLAG_NOLINGER 1 /* close with last hook */ - #endif /* _NETGRAPH_NG_SOCKETVAR_H_ */ - |