diff options
-rw-r--r-- | include/linux/unix_diag.h | 2 | ||||
-rw-r--r-- | net/unix/diag.c | 20 |
2 files changed, 14 insertions, 8 deletions
diff --git a/include/linux/unix_diag.h b/include/linux/unix_diag.h index a5ce0f325745..93fdb782468a 100644 --- a/include/linux/unix_diag.h +++ b/include/linux/unix_diag.h | |||
@@ -18,6 +18,7 @@ struct unix_diag_req { | |||
18 | #define UDIAG_SHOW_PEER 0x00000004 /* show peer socket info */ | 18 | #define UDIAG_SHOW_PEER 0x00000004 /* show peer socket info */ |
19 | #define UDIAG_SHOW_ICONS 0x00000008 /* show pending connections */ | 19 | #define UDIAG_SHOW_ICONS 0x00000008 /* show pending connections */ |
20 | #define UDIAG_SHOW_RQLEN 0x00000010 /* show skb receive queue len */ | 20 | #define UDIAG_SHOW_RQLEN 0x00000010 /* show skb receive queue len */ |
21 | #define UDIAG_SHOW_MEMINFO 0x00000020 /* show memory info of a socket */ | ||
21 | 22 | ||
22 | struct unix_diag_msg { | 23 | struct unix_diag_msg { |
23 | __u8 udiag_family; | 24 | __u8 udiag_family; |
@@ -35,6 +36,7 @@ enum { | |||
35 | UNIX_DIAG_PEER, | 36 | UNIX_DIAG_PEER, |
36 | UNIX_DIAG_ICONS, | 37 | UNIX_DIAG_ICONS, |
37 | UNIX_DIAG_RQLEN, | 38 | UNIX_DIAG_RQLEN, |
39 | UNIX_DIAG_MEMINFO, | ||
38 | 40 | ||
39 | UNIX_DIAG_MAX, | 41 | UNIX_DIAG_MAX, |
40 | }; | 42 | }; |
diff --git a/net/unix/diag.c b/net/unix/diag.c index c5bdbcb1c30b..98945f29da4f 100644 --- a/net/unix/diag.c +++ b/net/unix/diag.c | |||
@@ -127,23 +127,27 @@ static int sk_diag_fill(struct sock *sk, struct sk_buff *skb, struct unix_diag_r | |||
127 | sock_diag_save_cookie(sk, rep->udiag_cookie); | 127 | sock_diag_save_cookie(sk, rep->udiag_cookie); |
128 | 128 | ||
129 | if ((req->udiag_show & UDIAG_SHOW_NAME) && | 129 | if ((req->udiag_show & UDIAG_SHOW_NAME) && |
130 | sk_diag_dump_name(sk, skb)) | 130 | sk_diag_dump_name(sk, skb)) |
131 | goto nlmsg_failure; | 131 | goto nlmsg_failure; |
132 | 132 | ||
133 | if ((req->udiag_show & UDIAG_SHOW_VFS) && | 133 | if ((req->udiag_show & UDIAG_SHOW_VFS) && |
134 | sk_diag_dump_vfs(sk, skb)) | 134 | sk_diag_dump_vfs(sk, skb)) |
135 | goto nlmsg_failure; | 135 | goto nlmsg_failure; |
136 | 136 | ||
137 | if ((req->udiag_show & UDIAG_SHOW_PEER) && | 137 | if ((req->udiag_show & UDIAG_SHOW_PEER) && |
138 | sk_diag_dump_peer(sk, skb)) | 138 | sk_diag_dump_peer(sk, skb)) |
139 | goto nlmsg_failure; | 139 | goto nlmsg_failure; |
140 | 140 | ||
141 | if ((req->udiag_show & UDIAG_SHOW_ICONS) && | 141 | if ((req->udiag_show & UDIAG_SHOW_ICONS) && |
142 | sk_diag_dump_icons(sk, skb)) | 142 | sk_diag_dump_icons(sk, skb)) |
143 | goto nlmsg_failure; | 143 | goto nlmsg_failure; |
144 | 144 | ||
145 | if ((req->udiag_show & UDIAG_SHOW_RQLEN) && | 145 | if ((req->udiag_show & UDIAG_SHOW_RQLEN) && |
146 | sk_diag_show_rqlen(sk, skb)) | 146 | sk_diag_show_rqlen(sk, skb)) |
147 | goto nlmsg_failure; | ||
148 | |||
149 | if ((req->udiag_show & UDIAG_SHOW_MEMINFO) && | ||
150 | sock_diag_put_meminfo(sk, skb, UNIX_DIAG_MEMINFO)) | ||
147 | goto nlmsg_failure; | 151 | goto nlmsg_failure; |
148 | 152 | ||
149 | nlh->nlmsg_len = skb_tail_pointer(skb) - b; | 153 | nlh->nlmsg_len = skb_tail_pointer(skb) - b; |
@@ -191,9 +195,9 @@ static int unix_diag_dump(struct sk_buff *skb, struct netlink_callback *cb) | |||
191 | if (!(req->udiag_states & (1 << sk->sk_state))) | 195 | if (!(req->udiag_states & (1 << sk->sk_state))) |
192 | goto next; | 196 | goto next; |
193 | if (sk_diag_dump(sk, skb, req, | 197 | if (sk_diag_dump(sk, skb, req, |
194 | NETLINK_CB(cb->skb).pid, | 198 | NETLINK_CB(cb->skb).pid, |
195 | cb->nlh->nlmsg_seq, | 199 | cb->nlh->nlmsg_seq, |
196 | NLM_F_MULTI) < 0) | 200 | NLM_F_MULTI) < 0) |
197 | goto done; | 201 | goto done; |
198 | next: | 202 | next: |
199 | num++; | 203 | num++; |