Commit 4b506af9 authored by Eric Dumazet's avatar Eric Dumazet Committed by David S. Miller

tcp: add two drop reasons for tcp_ack()

Add TCP_TOO_OLD_ACK and TCP_ACK_UNSENT_DATA drop
reasons so that tcp_rcv_established() can report
them.
Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 669da7a7
...@@ -390,6 +390,8 @@ enum skb_drop_reason { ...@@ -390,6 +390,8 @@ enum skb_drop_reason {
SKB_DROP_REASON_TCP_CLOSE, /* TCP socket in CLOSE state */ SKB_DROP_REASON_TCP_CLOSE, /* TCP socket in CLOSE state */
SKB_DROP_REASON_TCP_FASTOPEN, /* dropped by FASTOPEN request socket */ SKB_DROP_REASON_TCP_FASTOPEN, /* dropped by FASTOPEN request socket */
SKB_DROP_REASON_TCP_OLD_ACK, /* TCP ACK is old, but in window */ SKB_DROP_REASON_TCP_OLD_ACK, /* TCP ACK is old, but in window */
SKB_DROP_REASON_TCP_TOO_OLD_ACK, /* TCP ACK is too old */
SKB_DROP_REASON_TCP_ACK_UNSENT_DATA, /* TCP ACK for data we haven't sent yet */
SKB_DROP_REASON_IP_OUTNOROUTES, /* route lookup failed */ SKB_DROP_REASON_IP_OUTNOROUTES, /* route lookup failed */
SKB_DROP_REASON_BPF_CGROUP_EGRESS, /* dropped by SKB_DROP_REASON_BPF_CGROUP_EGRESS, /* dropped by
* BPF_PROG_TYPE_CGROUP_SKB * BPF_PROG_TYPE_CGROUP_SKB
......
...@@ -45,6 +45,9 @@ ...@@ -45,6 +45,9 @@
EM(SKB_DROP_REASON_TCP_CLOSE, TCP_CLOSE) \ EM(SKB_DROP_REASON_TCP_CLOSE, TCP_CLOSE) \
EM(SKB_DROP_REASON_TCP_FASTOPEN, TCP_FASTOPEN) \ EM(SKB_DROP_REASON_TCP_FASTOPEN, TCP_FASTOPEN) \
EM(SKB_DROP_REASON_TCP_OLD_ACK, TCP_OLD_ACK) \ EM(SKB_DROP_REASON_TCP_OLD_ACK, TCP_OLD_ACK) \
EM(SKB_DROP_REASON_TCP_TOO_OLD_ACK, TCP_TOO_OLD_ACK) \
EM(SKB_DROP_REASON_TCP_ACK_UNSENT_DATA, \
TCP_ACK_UNSENT_DATA) \
EM(SKB_DROP_REASON_IP_OUTNOROUTES, IP_OUTNOROUTES) \ EM(SKB_DROP_REASON_IP_OUTNOROUTES, IP_OUTNOROUTES) \
EM(SKB_DROP_REASON_BPF_CGROUP_EGRESS, \ EM(SKB_DROP_REASON_BPF_CGROUP_EGRESS, \
BPF_CGROUP_EGRESS) \ BPF_CGROUP_EGRESS) \
......
...@@ -3766,7 +3766,7 @@ static int tcp_ack(struct sock *sk, const struct sk_buff *skb, int flag) ...@@ -3766,7 +3766,7 @@ static int tcp_ack(struct sock *sk, const struct sk_buff *skb, int flag)
if (before(ack, prior_snd_una - tp->max_window)) { if (before(ack, prior_snd_una - tp->max_window)) {
if (!(flag & FLAG_NO_CHALLENGE_ACK)) if (!(flag & FLAG_NO_CHALLENGE_ACK))
tcp_send_challenge_ack(sk); tcp_send_challenge_ack(sk);
return -1; return -SKB_DROP_REASON_TCP_TOO_OLD_ACK;
} }
goto old_ack; goto old_ack;
} }
...@@ -3775,7 +3775,7 @@ static int tcp_ack(struct sock *sk, const struct sk_buff *skb, int flag) ...@@ -3775,7 +3775,7 @@ static int tcp_ack(struct sock *sk, const struct sk_buff *skb, int flag)
* this segment (RFC793 Section 3.9). * this segment (RFC793 Section 3.9).
*/ */
if (after(ack, tp->snd_nxt)) if (after(ack, tp->snd_nxt))
return -1; return -SKB_DROP_REASON_TCP_ACK_UNSENT_DATA;
if (after(ack, prior_snd_una)) { if (after(ack, prior_snd_una)) {
flag |= FLAG_SND_UNA_ADVANCED; flag |= FLAG_SND_UNA_ADVANCED;
...@@ -5962,7 +5962,8 @@ void tcp_rcv_established(struct sock *sk, struct sk_buff *skb) ...@@ -5962,7 +5962,8 @@ void tcp_rcv_established(struct sock *sk, struct sk_buff *skb)
return; return;
step5: step5:
if (tcp_ack(sk, skb, FLAG_SLOWPATH | FLAG_UPDATE_TS_RECENT) < 0) reason = tcp_ack(sk, skb, FLAG_SLOWPATH | FLAG_UPDATE_TS_RECENT);
if (reason < 0)
goto discard; goto discard;
tcp_rcv_rtt_measure_ts(sk, skb); tcp_rcv_rtt_measure_ts(sk, skb);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment