diff options
Diffstat (limited to 'net/ipv4/tcp_output.c')
-rw-r--r-- | net/ipv4/tcp_output.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c index 5c08ea20a18d..b4f3ffe1b3b4 100644 --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c | |||
@@ -201,6 +201,7 @@ void tcp_select_initial_window(int __space, __u32 mss, | |||
201 | * See RFC1323 for an explanation of the limit to 14 | 201 | * See RFC1323 for an explanation of the limit to 14 |
202 | */ | 202 | */ |
203 | space = max_t(u32, sysctl_tcp_rmem[2], sysctl_rmem_max); | 203 | space = max_t(u32, sysctl_tcp_rmem[2], sysctl_rmem_max); |
204 | space = min_t(u32, space, *window_clamp); | ||
204 | while (space > 65535 && (*rcv_wscale) < 14) { | 205 | while (space > 65535 && (*rcv_wscale) < 14) { |
205 | space >>= 1; | 206 | space >>= 1; |
206 | (*rcv_wscale)++; | 207 | (*rcv_wscale)++; |
@@ -466,7 +467,8 @@ static int tcp_transmit_skb(struct sock *sk, struct sk_buff *skb, int clone_it, | |||
466 | if (skb->len != tcp_header_size) | 467 | if (skb->len != tcp_header_size) |
467 | tcp_event_data_sent(tp, skb, sk); | 468 | tcp_event_data_sent(tp, skb, sk); |
468 | 469 | ||
469 | TCP_INC_STATS(TCP_MIB_OUTSEGS); | 470 | if (after(tcb->end_seq, tp->snd_nxt) || tcb->seq == tcb->end_seq) |
471 | TCP_INC_STATS(TCP_MIB_OUTSEGS); | ||
470 | 472 | ||
471 | err = icsk->icsk_af_ops->queue_xmit(skb, 0); | 473 | err = icsk->icsk_af_ops->queue_xmit(skb, 0); |
472 | if (likely(err <= 0)) | 474 | if (likely(err <= 0)) |
@@ -2157,10 +2159,9 @@ int tcp_connect(struct sock *sk) | |||
2157 | skb_shinfo(buff)->gso_size = 0; | 2159 | skb_shinfo(buff)->gso_size = 0; |
2158 | skb_shinfo(buff)->gso_type = 0; | 2160 | skb_shinfo(buff)->gso_type = 0; |
2159 | buff->csum = 0; | 2161 | buff->csum = 0; |
2162 | tp->snd_nxt = tp->write_seq; | ||
2160 | TCP_SKB_CB(buff)->seq = tp->write_seq++; | 2163 | TCP_SKB_CB(buff)->seq = tp->write_seq++; |
2161 | TCP_SKB_CB(buff)->end_seq = tp->write_seq; | 2164 | TCP_SKB_CB(buff)->end_seq = tp->write_seq; |
2162 | tp->snd_nxt = tp->write_seq; | ||
2163 | tp->pushed_seq = tp->write_seq; | ||
2164 | 2165 | ||
2165 | /* Send it off. */ | 2166 | /* Send it off. */ |
2166 | TCP_SKB_CB(buff)->when = tcp_time_stamp; | 2167 | TCP_SKB_CB(buff)->when = tcp_time_stamp; |
@@ -2170,6 +2171,12 @@ int tcp_connect(struct sock *sk) | |||
2170 | sk_charge_skb(sk, buff); | 2171 | sk_charge_skb(sk, buff); |
2171 | tp->packets_out += tcp_skb_pcount(buff); | 2172 | tp->packets_out += tcp_skb_pcount(buff); |
2172 | tcp_transmit_skb(sk, buff, 1, GFP_KERNEL); | 2173 | tcp_transmit_skb(sk, buff, 1, GFP_KERNEL); |
2174 | |||
2175 | /* We change tp->snd_nxt after the tcp_transmit_skb() call | ||
2176 | * in order to make this packet get counted in tcpOutSegs. | ||
2177 | */ | ||
2178 | tp->snd_nxt = tp->write_seq; | ||
2179 | tp->pushed_seq = tp->write_seq; | ||
2173 | TCP_INC_STATS(TCP_MIB_ACTIVEOPENS); | 2180 | TCP_INC_STATS(TCP_MIB_ACTIVEOPENS); |
2174 | 2181 | ||
2175 | /* Timer for repeating the SYN until an answer. */ | 2182 | /* Timer for repeating the SYN until an answer. */ |