提交 c9da99e6 编写于 作者: P Pavel Emelyanov 提交者: David S. Miller

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: NPavel Emelyanov <xemul@parallels.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 885ee74d
......@@ -46,4 +46,9 @@ struct unix_diag_vfs {
__u32 udiag_vfs_dev;
};
struct unix_diag_rqlen {
__u32 udiag_rqueue;
__u32 udiag_wqueue;
};
#endif
......@@ -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:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册