Skip to content

Commit

Permalink
unix_diag: Fixup RQLEN extension report
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
xemul authored and davem330 committed Dec 30, 2011
1 parent 885ee74 commit c9da99e
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
5 changes: 5 additions & 0 deletions include/linux/unix_diag.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,9 @@ struct unix_diag_vfs {
__u32 udiag_vfs_dev;
};

struct unix_diag_rqlen {
__u32 udiag_rqueue;
__u32 udiag_wqueue;
};

#endif
13 changes: 12 additions & 1 deletion net/unix/diag.c
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,18 @@ static int sk_diag_dump_icons(struct sock *sk, struct sk_buff *nlskb)

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:
Expand Down

0 comments on commit c9da99e

Please sign in to comment.