|
@@ -364,7 +364,7 @@ tcp_ecn_make_synack(const struct request_sock *req, struct tcphdr *th)
|
|
|
* be sent.
|
|
|
*/
|
|
|
static void tcp_ecn_send(struct sock *sk, struct sk_buff *skb,
|
|
|
- int tcp_header_len)
|
|
|
+ struct tcphdr *th, int tcp_header_len)
|
|
|
{
|
|
|
struct tcp_sock *tp = tcp_sk(sk);
|
|
|
|
|
@@ -375,7 +375,7 @@ static void tcp_ecn_send(struct sock *sk, struct sk_buff *skb,
|
|
|
INET_ECN_xmit(sk);
|
|
|
if (tp->ecn_flags & TCP_ECN_QUEUE_CWR) {
|
|
|
tp->ecn_flags &= ~TCP_ECN_QUEUE_CWR;
|
|
|
- tcp_hdr(skb)->cwr = 1;
|
|
|
+ th->cwr = 1;
|
|
|
skb_shinfo(skb)->gso_type |= SKB_GSO_TCP_ECN;
|
|
|
}
|
|
|
} else if (!tcp_ca_needs_ecn(sk)) {
|
|
@@ -383,7 +383,7 @@ static void tcp_ecn_send(struct sock *sk, struct sk_buff *skb,
|
|
|
INET_ECN_dontxmit(sk);
|
|
|
}
|
|
|
if (tp->ecn_flags & TCP_ECN_DEMAND_CWR)
|
|
|
- tcp_hdr(skb)->ece = 1;
|
|
|
+ th->ece = 1;
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -954,7 +954,7 @@ static int tcp_transmit_skb(struct sock *sk, struct sk_buff *skb, int clone_it,
|
|
|
atomic_add(skb->truesize, &sk->sk_wmem_alloc);
|
|
|
|
|
|
/* Build TCP header and checksum it. */
|
|
|
- th = tcp_hdr(skb);
|
|
|
+ th = (struct tcphdr *)skb->data;
|
|
|
th->source = inet->inet_sport;
|
|
|
th->dest = inet->inet_dport;
|
|
|
th->seq = htonl(tcb->seq);
|
|
@@ -962,14 +962,6 @@ static int tcp_transmit_skb(struct sock *sk, struct sk_buff *skb, int clone_it,
|
|
|
*(((__be16 *)th) + 6) = htons(((tcp_header_size >> 2) << 12) |
|
|
|
tcb->tcp_flags);
|
|
|
|
|
|
- if (unlikely(tcb->tcp_flags & TCPHDR_SYN)) {
|
|
|
- /* RFC1323: The window in SYN & SYN/ACK segments
|
|
|
- * is never scaled.
|
|
|
- */
|
|
|
- th->window = htons(min(tp->rcv_wnd, 65535U));
|
|
|
- } else {
|
|
|
- th->window = htons(tcp_select_window(sk));
|
|
|
- }
|
|
|
th->check = 0;
|
|
|
th->urg_ptr = 0;
|
|
|
|
|
@@ -986,9 +978,15 @@ static int tcp_transmit_skb(struct sock *sk, struct sk_buff *skb, int clone_it,
|
|
|
|
|
|
tcp_options_write((__be32 *)(th + 1), tp, &opts);
|
|
|
skb_shinfo(skb)->gso_type = sk->sk_gso_type;
|
|
|
- if (likely((tcb->tcp_flags & TCPHDR_SYN) == 0))
|
|
|
- tcp_ecn_send(sk, skb, tcp_header_size);
|
|
|
-
|
|
|
+ if (likely(!(tcb->tcp_flags & TCPHDR_SYN))) {
|
|
|
+ th->window = htons(tcp_select_window(sk));
|
|
|
+ tcp_ecn_send(sk, skb, th, tcp_header_size);
|
|
|
+ } else {
|
|
|
+ /* RFC1323: The window in SYN & SYN/ACK segments
|
|
|
+ * is never scaled.
|
|
|
+ */
|
|
|
+ th->window = htons(min(tp->rcv_wnd, 65535U));
|
|
|
+ }
|
|
|
#ifdef CONFIG_TCP_MD5SIG
|
|
|
/* Calculate the MD5 hash, as we have all we need now */
|
|
|
if (md5) {
|
|
@@ -3040,7 +3038,7 @@ struct sk_buff *tcp_make_synack(const struct sock *sk, struct dst_entry *dst,
|
|
|
skb_push(skb, tcp_header_size);
|
|
|
skb_reset_transport_header(skb);
|
|
|
|
|
|
- th = tcp_hdr(skb);
|
|
|
+ th = (struct tcphdr *)skb->data;
|
|
|
memset(th, 0, sizeof(struct tcphdr));
|
|
|
th->syn = 1;
|
|
|
th->ack = 1;
|