[TCP]: Fix logic breakage due to DSACK separation

Commit 6f74651ae626ec672028587bc700538076dfbefb is found guilty
of breaking DSACK counting, which should be done only for the
SACK block reported by the DSACK instead of every SACK block
that is received along with DSACK information.

Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@helsinki.fi>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by Ilpo Järvinen and committed by David S. Miller 7769f406 b9ce204f

+5 -4
+5 -4
net/ipv4/tcp_input.c
··· 953 953 int prior_fackets; 954 954 u32 lost_retrans = 0; 955 955 int flag = 0; 956 - int dup_sack = 0; 956 + int found_dup_sack = 0; 957 957 int cached_fack_count; 958 958 int i; 959 959 int first_sack_index; ··· 964 964 965 965 /* Check for D-SACK. */ 966 966 if (before(ntohl(sp[0].start_seq), TCP_SKB_CB(ack_skb)->ack_seq)) { 967 - dup_sack = 1; 967 + found_dup_sack = 1; 968 968 tp->rx_opt.sack_ok |= 4; 969 969 NET_INC_STATS_BH(LINUX_MIB_TCPDSACKRECV); 970 970 } else if (num_sacks > 1 && 971 971 !after(ntohl(sp[0].end_seq), ntohl(sp[1].end_seq)) && 972 972 !before(ntohl(sp[0].start_seq), ntohl(sp[1].start_seq))) { 973 - dup_sack = 1; 973 + found_dup_sack = 1; 974 974 tp->rx_opt.sack_ok |= 4; 975 975 NET_INC_STATS_BH(LINUX_MIB_TCPDSACKOFORECV); 976 976 } 977 977 978 978 /* D-SACK for already forgotten data... 979 979 * Do dumb counting. */ 980 - if (dup_sack && 980 + if (found_dup_sack && 981 981 !after(ntohl(sp[0].end_seq), prior_snd_una) && 982 982 after(ntohl(sp[0].end_seq), tp->undo_marker)) 983 983 tp->undo_retrans--; ··· 1058 1058 __u32 start_seq = ntohl(sp->start_seq); 1059 1059 __u32 end_seq = ntohl(sp->end_seq); 1060 1060 int fack_count; 1061 + int dup_sack = (found_dup_sack && (i == first_sack_index)); 1061 1062 1062 1063 skb = cached_skb; 1063 1064 fack_count = cached_fack_count;