aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/tcp_diag.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/ipv4/tcp_diag.c')
-rw-r--r--net/ipv4/tcp_diag.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/net/ipv4/tcp_diag.c b/net/ipv4/tcp_diag.c
index 5f4c74f45e82..4288ecfec9a7 100644
--- a/net/ipv4/tcp_diag.c
+++ b/net/ipv4/tcp_diag.c
@@ -66,10 +66,10 @@ static int tcpdiag_fill(struct sk_buff *skb, struct sock *sk,
66 if (ext & (1<<(TCPDIAG_INFO-1))) 66 if (ext & (1<<(TCPDIAG_INFO-1)))
67 info = TCPDIAG_PUT(skb, TCPDIAG_INFO, sizeof(*info)); 67 info = TCPDIAG_PUT(skb, TCPDIAG_INFO, sizeof(*info));
68 68
69 if (ext & (1<<(TCPDIAG_CONG-1))) { 69 if ((ext & (1 << (TCPDIAG_CONG - 1))) && icsk->icsk_ca_ops) {
70 size_t len = strlen(tp->ca_ops->name); 70 size_t len = strlen(icsk->icsk_ca_ops->name);
71 strcpy(TCPDIAG_PUT(skb, TCPDIAG_CONG, len+1), 71 strcpy(TCPDIAG_PUT(skb, TCPDIAG_CONG, len+1),
72 tp->ca_ops->name); 72 icsk->icsk_ca_ops->name);
73 } 73 }
74 } 74 }
75 r->tcpdiag_family = sk->sk_family; 75 r->tcpdiag_family = sk->sk_family;
@@ -136,18 +136,17 @@ static int tcpdiag_fill(struct sk_buff *skb, struct sock *sk,
136 r->tcpdiag_expires = EXPIRES_IN_MS(icsk->icsk_timeout); 136 r->tcpdiag_expires = EXPIRES_IN_MS(icsk->icsk_timeout);
137 } else if (icsk->icsk_pending == ICSK_TIME_PROBE0) { 137 } else if (icsk->icsk_pending == ICSK_TIME_PROBE0) {
138 r->tcpdiag_timer = 4; 138 r->tcpdiag_timer = 4;
139 r->tcpdiag_retrans = tp->probes_out; 139 r->tcpdiag_retrans = icsk->icsk_probes_out;
140 r->tcpdiag_expires = EXPIRES_IN_MS(icsk->icsk_timeout); 140 r->tcpdiag_expires = EXPIRES_IN_MS(icsk->icsk_timeout);
141 } else if (timer_pending(&sk->sk_timer)) { 141 } else if (timer_pending(&sk->sk_timer)) {
142 r->tcpdiag_timer = 2; 142 r->tcpdiag_timer = 2;
143 r->tcpdiag_retrans = tp->probes_out; 143 r->tcpdiag_retrans = icsk->icsk_probes_out;
144 r->tcpdiag_expires = EXPIRES_IN_MS(sk->sk_timer.expires); 144 r->tcpdiag_expires = EXPIRES_IN_MS(sk->sk_timer.expires);
145 } else { 145 } else {
146 r->tcpdiag_timer = 0; 146 r->tcpdiag_timer = 0;
147 r->tcpdiag_expires = 0; 147 r->tcpdiag_expires = 0;
148 } 148 }
149#undef EXPIRES_IN_MS 149#undef EXPIRES_IN_MS
150
151 r->tcpdiag_rqueue = tp->rcv_nxt - tp->copied_seq; 150 r->tcpdiag_rqueue = tp->rcv_nxt - tp->copied_seq;
152 r->tcpdiag_wqueue = tp->write_seq - tp->snd_una; 151 r->tcpdiag_wqueue = tp->write_seq - tp->snd_una;
153 r->tcpdiag_uid = sock_i_uid(sk); 152 r->tcpdiag_uid = sock_i_uid(sk);
@@ -163,8 +162,9 @@ static int tcpdiag_fill(struct sk_buff *skb, struct sock *sk,
163 if (info) 162 if (info)
164 tcp_get_info(sk, info); 163 tcp_get_info(sk, info);
165 164
166 if (sk->sk_state < TCP_TIME_WAIT && tp->ca_ops->get_info) 165 if (sk->sk_state < TCP_TIME_WAIT &&
167 tp->ca_ops->get_info(tp, ext, skb); 166 icsk->icsk_ca_ops && icsk->icsk_ca_ops->get_info)
167 icsk->icsk_ca_ops->get_info(sk, ext, skb);
168 168
169 nlh->nlmsg_len = skb->tail - b; 169 nlh->nlmsg_len = skb->tail - b;
170 return skb->len; 170 return skb->len;