Skip to content

Commit c9da99e

Browse files
xemuldavem330
authored andcommitted
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>
1 parent 885ee74 commit c9da99e

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

include/linux/unix_diag.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,4 +46,9 @@ struct unix_diag_vfs {
4646
__u32 udiag_vfs_dev;
4747
};
4848

49+
struct unix_diag_rqlen {
50+
__u32 udiag_rqueue;
51+
__u32 udiag_wqueue;
52+
};
53+
4954
#endif

net/unix/diag.c

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,18 @@ static int sk_diag_dump_icons(struct sock *sk, struct sk_buff *nlskb)
101101

102102
static int sk_diag_show_rqlen(struct sock *sk, struct sk_buff *nlskb)
103103
{
104-
RTA_PUT_U32(nlskb, UNIX_DIAG_RQLEN, sk->sk_receive_queue.qlen);
104+
struct unix_diag_rqlen *rql;
105+
106+
rql = UNIX_DIAG_PUT(nlskb, UNIX_DIAG_RQLEN, sizeof(*rql));
107+
108+
if (sk->sk_state == TCP_LISTEN) {
109+
rql->udiag_rqueue = sk->sk_receive_queue.qlen;
110+
rql->udiag_wqueue = sk->sk_max_ack_backlog;
111+
} else {
112+
rql->udiag_rqueue = (__u32)unix_inq_len(sk);
113+
rql->udiag_wqueue = (__u32)unix_outq_len(sk);
114+
}
115+
105116
return 0;
106117

107118
rtattr_failure:

0 commit comments

Comments
 (0)