summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPavel Emelyanov <xemul@parallels.com>2011-12-30 00:54:39 +0000
committerDavid S. Miller <davem@davemloft.net>2011-12-30 16:46:02 -0500
commitc9da99e6475f92653139e43f3c30c0cd011a0fd8 (patch)
treed78e4097afdcba4a3a4dd2303cc8bd475331b75a
parent885ee74d5d3058e4a904671ed7929c9540c95fa5 (diff)
downloadlinux-3.10-c9da99e6475f92653139e43f3c30c0cd011a0fd8.tar.gz
linux-3.10-c9da99e6475f92653139e43f3c30c0cd011a0fd8.tar.bz2
linux-3.10-c9da99e6475f92653139e43f3c30c0cd011a0fd8.zip
unix_diag: Fixup RQLEN extension report
While it's not too late fix the recently added RQLEN diag extension to report rqlen and wqlen in the same way as TCP does. I.e. for listening sockets the ack backlog length (which is the input queue length for socket) in rqlen and the max ack backlog length in wqlen, and what the CINQ/OUTQ ioctls do for established. Signed-off-by: Pavel Emelyanov <xemul@parallels.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--include/linux/unix_diag.h5
-rw-r--r--net/unix/diag.c13
2 files changed, 17 insertions, 1 deletions
diff --git a/include/linux/unix_diag.h b/include/linux/unix_diag.h
index 93fdb782468..b1d2bf16b33 100644
--- a/include/linux/unix_diag.h
+++ b/include/linux/unix_diag.h
@@ -46,4 +46,9 @@ struct unix_diag_vfs {
__u32 udiag_vfs_dev;
};
+struct unix_diag_rqlen {
+ __u32 udiag_rqueue;
+ __u32 udiag_wqueue;
+};
+
#endif
diff --git a/net/unix/diag.c b/net/unix/diag.c
index 98945f29da4..6b7697fd911 100644
--- a/net/unix/diag.c
+++ b/net/unix/diag.c
@@ -101,7 +101,18 @@ rtattr_failure:
static int sk_diag_show_rqlen(struct sock *sk, struct sk_buff *nlskb)
{
- RTA_PUT_U32(nlskb, UNIX_DIAG_RQLEN, sk->sk_receive_queue.qlen);
+ struct unix_diag_rqlen *rql;
+
+ rql = UNIX_DIAG_PUT(nlskb, UNIX_DIAG_RQLEN, sizeof(*rql));
+
+ if (sk->sk_state == TCP_LISTEN) {
+ rql->udiag_rqueue = sk->sk_receive_queue.qlen;
+ rql->udiag_wqueue = sk->sk_max_ack_backlog;
+ } else {
+ rql->udiag_rqueue = (__u32)unix_inq_len(sk);
+ rql->udiag_wqueue = (__u32)unix_outq_len(sk);
+ }
+
return 0;
rtattr_failure: