Skip to content

Commit 8536975

Browse files
guangmuzhudavem330
authored andcommitted
tcp: Fix highest_sack and highest_sack_seq
>From commit 50895b9 ("tcp: highest_sack fix"), the logic about setting tp->highest_sack to the head of the send queue was removed. Of course the logic is error prone, but it is logical. Before we remove the pointer to the highest sack skb and use the seq instead, we need to set tp->highest_sack to NULL when there is no skb after the last sack, and then replace NULL with the real skb when new skb inserted into the rtx queue, because the NULL means the highest sack seq is tp->snd_nxt. If tp->highest_sack is NULL and new data sent, the next ACK with sack option will increase tp->reordering unexpectedly. This patch sets tp->highest_sack to the tail of the rtx queue if it's NULL and new data is sent. The patch keeps the rule that the highest_sack can only be maintained by sack processing, except for this only case. Fixes: 50895b9 ("tcp: highest_sack fix") Signed-off-by: Cambda Zhu <[email protected]> Signed-off-by: Eric Dumazet <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent a33121e commit 8536975

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

net/ipv4/tcp_output.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,9 @@ static void tcp_event_new_data_sent(struct sock *sk, struct sk_buff *skb)
7272
__skb_unlink(skb, &sk->sk_write_queue);
7373
tcp_rbtree_insert(&sk->tcp_rtx_queue, skb);
7474

75+
if (tp->highest_sack == NULL)
76+
tp->highest_sack = skb;
77+
7578
tp->packets_out += tcp_skb_pcount(skb);
7679
if (!prior_packets || icsk->icsk_pending == ICSK_TIME_LOSS_PROBE)
7780
tcp_rearm_rto(sk);

0 commit comments

Comments
 (0)