From 1942c518ca017f376b267a7c5e78c15d37202442 Mon Sep 17 00:00:00 2001 From: Pavel Emelyanov Date: Fri, 9 Dec 2011 06:23:18 +0000 Subject: 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 Signed-off-by: David S. Miller --- include/linux/inet_diag.h | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'include/linux/inet_diag.h') diff --git a/include/linux/inet_diag.h b/include/linux/inet_diag.h index eaf5865c9e8a..78972a149dff 100644 --- a/include/linux/inet_diag.h +++ b/include/linux/inet_diag.h @@ -138,9 +138,18 @@ struct inet_hashinfo; struct nlattr; struct nlmsghdr; struct sk_buff; +struct netlink_callback; struct inet_diag_handler { - struct inet_hashinfo *idiag_hashinfo; + void (*dump)(struct sk_buff *skb, + struct netlink_callback *cb, + struct inet_diag_req *r, + struct nlattr *bc); + + int (*dump_one)(struct sk_buff *in_skb, + const struct nlmsghdr *nlh, + struct inet_diag_req *req); + void (*idiag_get_info)(struct sock *sk, struct inet_diag_msg *r, void *info); @@ -152,6 +161,13 @@ int inet_sk_diag_fill(struct sock *sk, struct inet_connection_sock *icsk, struct sk_buff *skb, struct inet_diag_req *req, u32 pid, u32 seq, u16 nlmsg_flags, const struct nlmsghdr *unlh); +void inet_diag_dump_icsk(struct inet_hashinfo *h, struct sk_buff *skb, + struct netlink_callback *cb, struct inet_diag_req *r, + struct nlattr *bc); +int inet_diag_dump_one_icsk(struct inet_hashinfo *hashinfo, + struct sk_buff *in_skb, const struct nlmsghdr *nlh, + struct inet_diag_req *req); + int inet_diag_bc_sk(const struct nlattr *_bc, struct sock *sk); int inet_diag_check_cookie(struct sock *sk, struct inet_diag_req *req); -- cgit v1.2.3