1 #include <linux/types.h>
3 #include <linux/sock_diag.h>
6 #include <linux/module.h>
11 static int sk_diag_dump_name(
struct sock *
sk,
struct sk_buff *nlskb)
19 addr->
name->sun_path);
22 static int sk_diag_dump_vfs(
struct sock *sk,
struct sk_buff *nlskb)
29 .udiag_vfs_dev = dentry->
d_sb->s_dev,
38 static int sk_diag_dump_peer(
struct sock *sk,
struct sk_buff *nlskb)
56 static int sk_diag_dump_icons(
struct sock *sk,
struct sk_buff *nlskb)
97 static int sk_diag_show_rqlen(
struct sock *sk,
struct sk_buff *nlskb)
123 rep = nlmsg_data(nlh);
131 sk_diag_dump_name(sk, skb))
135 sk_diag_dump_vfs(sk, skb))
139 sk_diag_dump_peer(sk, skb))
143 sk_diag_dump_icons(sk, skb))
147 sk_diag_show_rqlen(sk, skb))
154 return nlmsg_end(skb, nlh);
157 nlmsg_cancel(skb, nlh);
173 return sk_diag_fill(sk, skb, req, portid, seq, flags, sk_ino);
180 struct net *
net = sock_net(skb->
sk);
182 req = nlmsg_data(cb->
nlh);
184 s_slot = cb->
args[0];
185 num = s_num = cb->
args[1];
187 spin_lock(&unix_table_lock);
196 if (!net_eq(sock_net(sk), net))
202 if (sk_diag_dump(sk, skb, req,
212 spin_unlock(&unix_table_lock);
219 static struct sock *unix_lookup_by_ino(
int ino)
224 spin_lock(&unix_table_lock);
231 spin_unlock(&unix_table_lock);
237 spin_unlock(&unix_table_lock);
241 static int unix_diag_get_exact(
struct sk_buff *in_skb,
248 unsigned int extra_len;
249 struct net *net = sock_net(in_skb->
sk);
270 err = sk_diag_fill(sk, rep, req,
NETLINK_CB(in_skb).portid,
294 struct net *net = sock_net(skb->
sk);
296 if (nlmsg_len(h) < hdrlen)
301 .dump = unix_diag_dump,
303 return netlink_dump_start(net->
diag_nlsk, skb, h, &c);
305 return unix_diag_get_exact(skb, h, nlmsg_data(h));
310 .dump = unix_diag_handler_dump,
313 static int __init unix_diag_init(
void)
318 static void __exit unix_diag_exit(
void)