diff options
Diffstat (limited to 'net/ipv4/tcp_diag.c')
-rw-r--r-- | net/ipv4/tcp_diag.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/net/ipv4/tcp_diag.c b/net/ipv4/tcp_diag.c index 79b34a0f4a4a..479f34946177 100644 --- a/net/ipv4/tcp_diag.c +++ b/net/ipv4/tcp_diag.c | |||
@@ -19,13 +19,14 @@ | |||
19 | static void tcp_diag_get_info(struct sock *sk, struct inet_diag_msg *r, | 19 | static void tcp_diag_get_info(struct sock *sk, struct inet_diag_msg *r, |
20 | void *_info) | 20 | void *_info) |
21 | { | 21 | { |
22 | const struct tcp_sock *tp = tcp_sk(sk); | ||
23 | struct tcp_info *info = _info; | 22 | struct tcp_info *info = _info; |
24 | 23 | ||
25 | if (sk->sk_state == TCP_LISTEN) { | 24 | if (sk->sk_state == TCP_LISTEN) { |
26 | r->idiag_rqueue = sk->sk_ack_backlog; | 25 | r->idiag_rqueue = sk->sk_ack_backlog; |
27 | r->idiag_wqueue = sk->sk_max_ack_backlog; | 26 | r->idiag_wqueue = sk->sk_max_ack_backlog; |
28 | } else { | 27 | } else if (sk->sk_type == SOCK_STREAM) { |
28 | const struct tcp_sock *tp = tcp_sk(sk); | ||
29 | |||
29 | r->idiag_rqueue = max_t(int, tp->rcv_nxt - tp->copied_seq, 0); | 30 | r->idiag_rqueue = max_t(int, tp->rcv_nxt - tp->copied_seq, 0); |
30 | r->idiag_wqueue = tp->write_seq - tp->snd_una; | 31 | r->idiag_wqueue = tp->write_seq - tp->snd_una; |
31 | } | 32 | } |
@@ -50,6 +51,7 @@ static const struct inet_diag_handler tcp_diag_handler = { | |||
50 | .dump_one = tcp_diag_dump_one, | 51 | .dump_one = tcp_diag_dump_one, |
51 | .idiag_get_info = tcp_diag_get_info, | 52 | .idiag_get_info = tcp_diag_get_info, |
52 | .idiag_type = IPPROTO_TCP, | 53 | .idiag_type = IPPROTO_TCP, |
54 | .idiag_info_size = sizeof(struct tcp_info), | ||
53 | }; | 55 | }; |
54 | 56 | ||
55 | static int __init tcp_diag_init(void) | 57 | static int __init tcp_diag_init(void) |