tcp: fix tcp_ofo_queue() to avoid including too much DUP SACK range
Subsystems (3)
PATCH 1/1 tcp: fix tcp_ofo_queue() to avoid including too much DUP SACK range
If the new coming segment covers more than one skbs in the ofo queue, and which seq is equal to rcv_nxt , then the sequence range that is not duplicated will be sent as DUP SACK, the detail as below, in step6, the {501,2001} range is clearly including too much DUP SACK range:
1. client.43629 > server.8080: Flags [.], seq 501:1001, ack 1325288529, win 20000, length 500: HTTP
2. server.8080 > client.43629: Flags [.], ack 1, win 65535, options [nop,nop,TS val 269383721 ecr 200,nop,nop,sack 1 {501:1001}], length 0
3. Iclient.43629 > server.8080: Flags [.], seq 1501:2001, ack 1325288529, win 20000, length 500: HTTP
4. server.8080 > client.43629: Flags [.], ack 1, win 65535, options [nop,nop,TS val 269383721 ecr 200,nop,nop,sack 2 {1501:2001} {501:1001}], length 0
5. client.43629 > server.8080: Flags [.], seq 1:2001,
ack 1325288529, win 20000, length 2000: HTTP
6. server.8080 > client.43629: Flags [.], ack 2001, win 65535, options [nop,nop,TS val 269383722 ecr 200,nop,nop,sack 1 {501:2001}], length 0
After this fix, the step6 is as below:
6. server.8080 > client.43629: Flags [.], ack 2001, win 65535, options [nop,nop,TS val 269383722 ecr 200,nop,nop,sack 1 {501:1001}], length 0
---
v1: add more information in commit message
--- net/ipv4/tcp_input.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/ipv4/tcp_input.c +1 -1
@@ -4846,7 +4846,7 @@ static void tcp_ofo_queue(struct sock *sk)if (before (TCP_SKB_CB (skb)->seq, dsack_high)) {__u32 dsack = dsack_high;if (before (TCP_SKB_CB (skb)->end_seq, dsack_high)) - dsack_high =TCP_SKB_CB (skb)->end_seq; + dsack =TCP_SKB_CB (skb)->end_seq;tcp_dsack_extend (sk,TCP_SKB_CB (skb)->seq, dsack); } p =rb_next (p);
Signature · 1 line
2.43.0
Quoted 21 lines · xin.guo
If the new coming segment covers more than one skbs in the ofo queue, and which seq is equal to
rcv_nxt, then the sequence range that is not duplicated will be sent as DUP SACK, the detail as below, in step6, the {501,2001} range is clearly including too much DUP SACK range:
1. client.43629 > server.8080: Flags [.], seq 501:1001, ack 1325288529, win 20000, length 500: HTTP
2. server.8080 > client.43629: Flags [.], ack 1, win 65535, options [nop,nop,TS val 269383721 ecr 200,nop,nop,sack 1 {501:1001}], length 0
3. Iclient.43629 > server.8080: Flags [.], seq 1501:2001, ack 1325288529, win 20000, length 500: HTTP
4. server.8080 > client.43629: Flags [.], ack 1, win 65535, options [nop,nop,TS val 269383721 ecr 200,nop,nop,sack 2 {1501:2001} {501:1001}], length 0
5. client.43629 > server.8080: Flags [.], seq 1:2001,
ack 1325288529, win 20000, length 2000: HTTP
6. server.8080 > client.43629: Flags [.], ack 2001, win 65535, options [nop,nop,TS val 269383722 ecr 200,nop,nop,sack 1 {501:2001}], length 0
Quoted 4 lines
After this fix, the step6 is as below:
6. server.8080 > client.43629: Flags [.], ack 2001, win 65535, options [nop,nop,TS val 269383722 ecr 200,nop,nop,sack 1 {501:1001}], length 0
I am not convinced this is the expected output ?
If this is a DUP SACK, it should be :
Flags [.], ack 2001, win 65535, ... sack 2 {1501:2001} {501:1001} ....
Quoted 13 lines
Signed-off-by xin.guo <[email protected]>---
v1: add more information in commit message--- net/ipv4/tcp_input.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)net/ipv4/tcp_input.c +0
-0
net/ipv4/tcp_input.c static void tcp_ofo_queue(struct sock *sk) · line 4850
Quoted 6 lines
net/ipv4/tcp_input.c +1
-1@@ -4846,7 +4846,7 @@ static void tcp_ofo_queue(struct sock *sk)if (before (TCP_SKB_CB (skb)->seq, dsack_high)) {__u32 dsack = dsack_high;if (before (TCP_SKB_CB (skb)->end_seq, dsack_high)) - dsack_high =TCP_SKB_CB (skb)->end_seq; + dsack =TCP_SKB_CB (skb)->end_seq;tcp_dsack_extend (sk,TCP_SKB_CB (skb)->seq, dsack);
At a first glance, bug is in tcp_dsack_extend()
Quoted 30 lines · Eric Dumazet
Quoted 21 lines · xin.guo
If the new coming segment covers more than one skbs in the ofo queue, and which seq is equal to
rcv_nxt, then the sequence range that is not duplicated will be sent as DUP SACK, the detail as below, in step6, the {501,2001} range is clearly including too much DUP SACK range:
1. client.43629 > server.8080: Flags [.], seq 501:1001, ack 1325288529, win 20000, length 500: HTTP
2. server.8080 > client.43629: Flags [.], ack 1, win 65535, options [nop,nop,TS val 269383721 ecr 200,nop,nop,sack 1 {501:1001}], length 0
3. Iclient.43629 > server.8080: Flags [.], seq 1501:2001, ack 1325288529, win 20000, length 500: HTTP
4. server.8080 > client.43629: Flags [.], ack 1, win 65535, options [nop,nop,TS val 269383721 ecr 200,nop,nop,sack 2 {1501:2001} {501:1001}], length 0
5. client.43629 > server.8080: Flags [.], seq 1:2001,
ack 1325288529, win 20000, length 2000: HTTP
6. server.8080 > client.43629: Flags [.], ack 2001, win 65535, options [nop,nop,TS val 269383722 ecr 200,nop,nop,sack 1 {501:2001}], length 0Quoted 4 lines
After this fix, the step6 is as below:
6. server.8080 > client.43629: Flags [.], ack 2001, win 65535, options [nop,nop,TS val 269383722 ecr 200,nop,nop,sack 1 {501:1001}], length 0I am not convinced this is the expected output ?
Quoted 8 lines
If this is a DUP SACK, it should be :
Flags [.], ack 2001, win 65535, ... sack 2 {1501:2001} {501:1001} ....
At a first glance, bug is in
tcp_dsack_extend()
After more thoughts and RFC 2883 read, I think your patch is correct.
I will include it in a series with two packetdrill tests, and another fix. I will add appropriate Fixes: tag
Thanks !
Thanks Eric, have a nice day.
Regards
Guo Xin.
Quoted 47 lines · Eric Dumazet
Quoted 30 lines · Eric Dumazet
Quoted 21 lines · xin.guo
If the new coming segment covers more than one skbs in the ofo queue, and which seq is equal to
rcv_nxt, then the sequence range that is not duplicated will be sent as DUP SACK, the detail as below, in step6, the {501,2001} range is clearly including too much DUP SACK range:
1. client.43629 > server.8080: Flags [.], seq 501:1001, ack 1325288529, win 20000, length 500: HTTP
2. server.8080 > client.43629: Flags [.], ack 1, win 65535, options [nop,nop,TS val 269383721 ecr 200,nop,nop,sack 1 {501:1001}], length 0
3. Iclient.43629 > server.8080: Flags [.], seq 1501:2001, ack 1325288529, win 20000, length 500: HTTP
4. server.8080 > client.43629: Flags [.], ack 1, win 65535, options [nop,nop,TS val 269383721 ecr 200,nop,nop,sack 2 {1501:2001} {501:1001}], length 0
5. client.43629 > server.8080: Flags [.], seq 1:2001,
ack 1325288529, win 20000, length 2000: HTTP
6. server.8080 > client.43629: Flags [.], ack 2001, win 65535, options [nop,nop,TS val 269383722 ecr 200,nop,nop,sack 1 {501:2001}], length 0Quoted 4 lines
After this fix, the step6 is as below:
6. server.8080 > client.43629: Flags [.], ack 2001, win 65535, options [nop,nop,TS val 269383722 ecr 200,nop,nop,sack 1 {501:1001}], length 0I am not convinced this is the expected output ?
Quoted 8 lines
If this is a DUP SACK, it should be :
Flags [.], ack 2001, win 65535, ... sack 2 {1501:2001} {501:1001} ....
At a first glance, bug is in
tcp_dsack_extend()After more thoughts and RFC 2883 read, I think your patch is correct.
I will include it in a series with two packetdrill tests, and another fix. I will add appropriate Fixes: tag
Thanks !