diff options
Diffstat (limited to 'net/ipv4/tcp_output.c')
| -rw-r--r-- | net/ipv4/tcp_output.c | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c index 0dda86e72ad8..b4ed957f201a 100644 --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c | |||
| @@ -350,6 +350,7 @@ static inline void TCP_ECN_send(struct sock *sk, struct sk_buff *skb, | |||
| 350 | */ | 350 | */ |
| 351 | static void tcp_init_nondata_skb(struct sk_buff *skb, u32 seq, u8 flags) | 351 | static void tcp_init_nondata_skb(struct sk_buff *skb, u32 seq, u8 flags) |
| 352 | { | 352 | { |
| 353 | skb->ip_summed = CHECKSUM_PARTIAL; | ||
| 353 | skb->csum = 0; | 354 | skb->csum = 0; |
| 354 | 355 | ||
| 355 | TCP_SKB_CB(skb)->flags = flags; | 356 | TCP_SKB_CB(skb)->flags = flags; |
| @@ -667,7 +668,6 @@ static unsigned tcp_synack_options(struct sock *sk, | |||
| 667 | u8 cookie_plus = (xvp != NULL && !xvp->cookie_out_never) ? | 668 | u8 cookie_plus = (xvp != NULL && !xvp->cookie_out_never) ? |
| 668 | xvp->cookie_plus : | 669 | xvp->cookie_plus : |
| 669 | 0; | 670 | 0; |
| 670 | bool doing_ts = ireq->tstamp_ok; | ||
| 671 | 671 | ||
| 672 | #ifdef CONFIG_TCP_MD5SIG | 672 | #ifdef CONFIG_TCP_MD5SIG |
| 673 | *md5 = tcp_rsk(req)->af_specific->md5_lookup(sk, req); | 673 | *md5 = tcp_rsk(req)->af_specific->md5_lookup(sk, req); |
| @@ -680,7 +680,7 @@ static unsigned tcp_synack_options(struct sock *sk, | |||
| 680 | * rather than TS in order to fit in better with old, | 680 | * rather than TS in order to fit in better with old, |
| 681 | * buggy kernels, but that was deemed to be unnecessary. | 681 | * buggy kernels, but that was deemed to be unnecessary. |
| 682 | */ | 682 | */ |
| 683 | doing_ts &= !ireq->sack_ok; | 683 | ireq->tstamp_ok &= !ireq->sack_ok; |
| 684 | } | 684 | } |
| 685 | #else | 685 | #else |
| 686 | *md5 = NULL; | 686 | *md5 = NULL; |
| @@ -695,7 +695,7 @@ static unsigned tcp_synack_options(struct sock *sk, | |||
| 695 | opts->options |= OPTION_WSCALE; | 695 | opts->options |= OPTION_WSCALE; |
| 696 | remaining -= TCPOLEN_WSCALE_ALIGNED; | 696 | remaining -= TCPOLEN_WSCALE_ALIGNED; |
| 697 | } | 697 | } |
| 698 | if (likely(doing_ts)) { | 698 | if (likely(ireq->tstamp_ok)) { |
| 699 | opts->options |= OPTION_TS; | 699 | opts->options |= OPTION_TS; |
| 700 | opts->tsval = TCP_SKB_CB(skb)->when; | 700 | opts->tsval = TCP_SKB_CB(skb)->when; |
| 701 | opts->tsecr = req->ts_recent; | 701 | opts->tsecr = req->ts_recent; |
| @@ -703,7 +703,7 @@ static unsigned tcp_synack_options(struct sock *sk, | |||
| 703 | } | 703 | } |
| 704 | if (likely(ireq->sack_ok)) { | 704 | if (likely(ireq->sack_ok)) { |
| 705 | opts->options |= OPTION_SACK_ADVERTISE; | 705 | opts->options |= OPTION_SACK_ADVERTISE; |
| 706 | if (unlikely(!doing_ts)) | 706 | if (unlikely(!ireq->tstamp_ok)) |
| 707 | remaining -= TCPOLEN_SACKPERM_ALIGNED; | 707 | remaining -= TCPOLEN_SACKPERM_ALIGNED; |
| 708 | } | 708 | } |
| 709 | 709 | ||
| @@ -711,7 +711,7 @@ static unsigned tcp_synack_options(struct sock *sk, | |||
| 711 | * If the <SYN> options fit, the same options should fit now! | 711 | * If the <SYN> options fit, the same options should fit now! |
| 712 | */ | 712 | */ |
| 713 | if (*md5 == NULL && | 713 | if (*md5 == NULL && |
| 714 | doing_ts && | 714 | ireq->tstamp_ok && |
| 715 | cookie_plus > TCPOLEN_COOKIE_BASE) { | 715 | cookie_plus > TCPOLEN_COOKIE_BASE) { |
| 716 | int need = cookie_plus; /* has TCPOLEN_COOKIE_BASE */ | 716 | int need = cookie_plus; /* has TCPOLEN_COOKIE_BASE */ |
| 717 | 717 | ||
| @@ -860,7 +860,7 @@ static int tcp_transmit_skb(struct sock *sk, struct sk_buff *skb, int clone_it, | |||
| 860 | th->urg_ptr = htons(tp->snd_up - tcb->seq); | 860 | th->urg_ptr = htons(tp->snd_up - tcb->seq); |
| 861 | th->urg = 1; | 861 | th->urg = 1; |
| 862 | } else if (after(tcb->seq + 0xFFFF, tp->snd_nxt)) { | 862 | } else if (after(tcb->seq + 0xFFFF, tp->snd_nxt)) { |
| 863 | th->urg_ptr = 0xFFFF; | 863 | th->urg_ptr = htons(0xFFFF); |
| 864 | th->urg = 1; | 864 | th->urg = 1; |
| 865 | } | 865 | } |
| 866 | } | 866 | } |
| @@ -872,13 +872,13 @@ static int tcp_transmit_skb(struct sock *sk, struct sk_buff *skb, int clone_it, | |||
| 872 | #ifdef CONFIG_TCP_MD5SIG | 872 | #ifdef CONFIG_TCP_MD5SIG |
| 873 | /* Calculate the MD5 hash, as we have all we need now */ | 873 | /* Calculate the MD5 hash, as we have all we need now */ |
| 874 | if (md5) { | 874 | if (md5) { |
| 875 | sk->sk_route_caps &= ~NETIF_F_GSO_MASK; | 875 | sk_nocaps_add(sk, NETIF_F_GSO_MASK); |
| 876 | tp->af_specific->calc_md5_hash(opts.hash_location, | 876 | tp->af_specific->calc_md5_hash(opts.hash_location, |
| 877 | md5, sk, NULL, skb); | 877 | md5, sk, NULL, skb); |
| 878 | } | 878 | } |
| 879 | #endif | 879 | #endif |
| 880 | 880 | ||
| 881 | icsk->icsk_af_ops->send_check(sk, skb->len, skb); | 881 | icsk->icsk_af_ops->send_check(sk, skb); |
| 882 | 882 | ||
| 883 | if (likely(tcb->flags & TCPCB_FLAG_ACK)) | 883 | if (likely(tcb->flags & TCPCB_FLAG_ACK)) |
| 884 | tcp_event_ack_sent(sk, tcp_skb_pcount(skb)); | 884 | tcp_event_ack_sent(sk, tcp_skb_pcount(skb)); |
| @@ -887,9 +887,10 @@ static int tcp_transmit_skb(struct sock *sk, struct sk_buff *skb, int clone_it, | |||
| 887 | tcp_event_data_sent(tp, skb, sk); | 887 | tcp_event_data_sent(tp, skb, sk); |
| 888 | 888 | ||
| 889 | if (after(tcb->end_seq, tp->snd_nxt) || tcb->seq == tcb->end_seq) | 889 | if (after(tcb->end_seq, tp->snd_nxt) || tcb->seq == tcb->end_seq) |
| 890 | TCP_INC_STATS(sock_net(sk), TCP_MIB_OUTSEGS); | 890 | TCP_ADD_STATS(sock_net(sk), TCP_MIB_OUTSEGS, |
| 891 | tcp_skb_pcount(skb)); | ||
| 891 | 892 | ||
| 892 | err = icsk->icsk_af_ops->queue_xmit(skb, 0); | 893 | err = icsk->icsk_af_ops->queue_xmit(skb); |
| 893 | if (likely(err <= 0)) | 894 | if (likely(err <= 0)) |
| 894 | return err; | 895 | return err; |
| 895 | 896 | ||
| @@ -2484,7 +2485,7 @@ struct sk_buff *tcp_make_synack(struct sock *sk, struct dst_entry *dst, | |||
| 2484 | *tail-- ^= TCP_SKB_CB(skb)->seq + 1; | 2485 | *tail-- ^= TCP_SKB_CB(skb)->seq + 1; |
| 2485 | 2486 | ||
| 2486 | /* recommended */ | 2487 | /* recommended */ |
| 2487 | *tail-- ^= ((th->dest << 16) | th->source); | 2488 | *tail-- ^= (((__force u32)th->dest << 16) | (__force u32)th->source); |
| 2488 | *tail-- ^= (u32)(unsigned long)cvp; /* per sockopt */ | 2489 | *tail-- ^= (u32)(unsigned long)cvp; /* per sockopt */ |
| 2489 | 2490 | ||
| 2490 | sha_transform((__u32 *)&xvp->cookie_bakery[0], | 2491 | sha_transform((__u32 *)&xvp->cookie_bakery[0], |
| @@ -2502,7 +2503,7 @@ struct sk_buff *tcp_make_synack(struct sock *sk, struct dst_entry *dst, | |||
| 2502 | th->window = htons(min(req->rcv_wnd, 65535U)); | 2503 | th->window = htons(min(req->rcv_wnd, 65535U)); |
| 2503 | tcp_options_write((__be32 *)(th + 1), tp, &opts); | 2504 | tcp_options_write((__be32 *)(th + 1), tp, &opts); |
| 2504 | th->doff = (tcp_header_size >> 2); | 2505 | th->doff = (tcp_header_size >> 2); |
| 2505 | TCP_INC_STATS(sock_net(sk), TCP_MIB_OUTSEGS); | 2506 | TCP_ADD_STATS(sock_net(sk), TCP_MIB_OUTSEGS, tcp_skb_pcount(skb)); |
| 2506 | 2507 | ||
| 2507 | #ifdef CONFIG_TCP_MD5SIG | 2508 | #ifdef CONFIG_TCP_MD5SIG |
| 2508 | /* Okay, we have all we need - do the md5 hash if needed */ | 2509 | /* Okay, we have all we need - do the md5 hash if needed */ |
