summaryrefslogtreecommitdiff
path: root/net/dccp/diag.c
diff options
context:
space:
mode:
authorPavel Emelyanov <xemul@parallels.com>2011-12-09 06:23:18 +0000
committerDavid S. Miller <davem@davemloft.net>2011-12-09 14:14:08 -0500
commit1942c518ca017f376b267a7c5e78c15d37202442 (patch)
tree9ead5443adf15f2264240c928ff2514349fdcade /net/dccp/diag.c
parent3c4d05c8056724aff3abc20650807dd828fded54 (diff)
downloadlwn-1942c518ca017f376b267a7c5e78c15d37202442.tar.gz
lwn-1942c518ca017f376b267a7c5e78c15d37202442.zip
inet_diag: Generalize inet_diag dump and get_exact calls
Introduce two callbacks in inet_diag_handler -- one for dumping all sockets (with filters) and the other one for dumping a single sk. Replace direct calls to icsk handlers with indirect calls to callbacks provided by handlers. Make existing TCP and DCCP handlers use provided helpers for icsk-s. The UDP diag module will provide its own. Signed-off-by: Pavel Emelyanov <xemul@parallels.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/dccp/diag.c')
-rw-r--r--net/dccp/diag.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/net/dccp/diag.c b/net/dccp/diag.c
index 9343f52db284..e29214d193d6 100644
--- a/net/dccp/diag.c
+++ b/net/dccp/diag.c
@@ -48,8 +48,21 @@ static void dccp_diag_get_info(struct sock *sk, struct inet_diag_msg *r,
dccp_get_info(sk, _info);
}
+static void dccp_diag_dump(struct sk_buff *skb, struct netlink_callback *cb,
+ struct inet_diag_req *r, struct nlattr *bc)
+{
+ inet_diag_dump_icsk(&dccp_hashinfo, skb, cb, r, bc);
+}
+
+static int dccp_diag_dump_one(struct sk_buff *in_skb, const struct nlmsghdr *nlh,
+ struct inet_diag_req *req)
+{
+ return inet_diag_dump_one_icsk(&dccp_hashinfo, in_skb, nlh, req);
+}
+
static const struct inet_diag_handler dccp_diag_handler = {
- .idiag_hashinfo = &dccp_hashinfo,
+ .dump = dccp_diag_dump,
+ .dump_one = dccp_diag_dump_one,
.idiag_get_info = dccp_diag_get_info,
.idiag_type = IPPROTO_DCCP,
};