aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/tcp_output.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/ipv4/tcp_output.c')
-rw-r--r--net/ipv4/tcp_output.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
index 5c08ea20a18d..507adefbc17c 100644
--- a/net/ipv4/tcp_output.c
+++ b/net/ipv4/tcp_output.c
@@ -466,7 +466,8 @@ static int tcp_transmit_skb(struct sock *sk, struct sk_buff *skb, int clone_it,
466 if (skb->len != tcp_header_size) 466 if (skb->len != tcp_header_size)
467 tcp_event_data_sent(tp, skb, sk); 467 tcp_event_data_sent(tp, skb, sk);
468 468
469 TCP_INC_STATS(TCP_MIB_OUTSEGS); 469 if (after(tcb->end_seq, tp->snd_nxt) || tcb->seq == tcb->end_seq)
470 TCP_INC_STATS(TCP_MIB_OUTSEGS);
470 471
471 err = icsk->icsk_af_ops->queue_xmit(skb, 0); 472 err = icsk->icsk_af_ops->queue_xmit(skb, 0);
472 if (likely(err <= 0)) 473 if (likely(err <= 0))
@@ -2157,10 +2158,9 @@ int tcp_connect(struct sock *sk)
2157 skb_shinfo(buff)->gso_size = 0; 2158 skb_shinfo(buff)->gso_size = 0;
2158 skb_shinfo(buff)->gso_type = 0; 2159 skb_shinfo(buff)->gso_type = 0;
2159 buff->csum = 0; 2160 buff->csum = 0;
2161 tp->snd_nxt = tp->write_seq;
2160 TCP_SKB_CB(buff)->seq = tp->write_seq++; 2162 TCP_SKB_CB(buff)->seq = tp->write_seq++;
2161 TCP_SKB_CB(buff)->end_seq = tp->write_seq; 2163 TCP_SKB_CB(buff)->end_seq = tp->write_seq;
2162 tp->snd_nxt = tp->write_seq;
2163 tp->pushed_seq = tp->write_seq;
2164 2164
2165 /* Send it off. */ 2165 /* Send it off. */
2166 TCP_SKB_CB(buff)->when = tcp_time_stamp; 2166 TCP_SKB_CB(buff)->when = tcp_time_stamp;
@@ -2170,6 +2170,12 @@ int tcp_connect(struct sock *sk)
2170 sk_charge_skb(sk, buff); 2170 sk_charge_skb(sk, buff);
2171 tp->packets_out += tcp_skb_pcount(buff); 2171 tp->packets_out += tcp_skb_pcount(buff);
2172 tcp_transmit_skb(sk, buff, 1, GFP_KERNEL); 2172 tcp_transmit_skb(sk, buff, 1, GFP_KERNEL);
2173
2174 /* We change tp->snd_nxt after the tcp_transmit_skb() call
2175 * in order to make this packet get counted in tcpOutSegs.
2176 */
2177 tp->snd_nxt = tp->write_seq;
2178 tp->pushed_seq = tp->write_seq;
2173 TCP_INC_STATS(TCP_MIB_ACTIVEOPENS); 2179 TCP_INC_STATS(TCP_MIB_ACTIVEOPENS);
2174 2180
2175 /* Timer for repeating the SYN until an answer. */ 2181 /* Timer for repeating the SYN until an answer. */