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.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
index 7d2dc015cd19..6451b83d81e9 100644
--- a/net/ipv4/tcp_output.c
+++ b/net/ipv4/tcp_output.c
@@ -2944,7 +2944,7 @@ int tcp_send_synack(struct sock *sk)
2944struct sk_buff *tcp_make_synack(const struct sock *sk, struct dst_entry *dst, 2944struct sk_buff *tcp_make_synack(const struct sock *sk, struct dst_entry *dst,
2945 struct request_sock *req, 2945 struct request_sock *req,
2946 struct tcp_fastopen_cookie *foc, 2946 struct tcp_fastopen_cookie *foc,
2947 bool attach_req) 2947 enum tcp_synack_type synack_type)
2948{ 2948{
2949 struct inet_request_sock *ireq = inet_rsk(req); 2949 struct inet_request_sock *ireq = inet_rsk(req);
2950 const struct tcp_sock *tp = tcp_sk(sk); 2950 const struct tcp_sock *tp = tcp_sk(sk);
@@ -2964,14 +2964,22 @@ struct sk_buff *tcp_make_synack(const struct sock *sk, struct dst_entry *dst,
2964 /* Reserve space for headers. */ 2964 /* Reserve space for headers. */
2965 skb_reserve(skb, MAX_TCP_HEADER); 2965 skb_reserve(skb, MAX_TCP_HEADER);
2966 2966
2967 if (attach_req) { 2967 switch (synack_type) {
2968 case TCP_SYNACK_NORMAL:
2968 skb_set_owner_w(skb, req_to_sk(req)); 2969 skb_set_owner_w(skb, req_to_sk(req));
2969 } else { 2970 break;
2971 case TCP_SYNACK_COOKIE:
2972 /* Under synflood, we do not attach skb to a socket,
2973 * to avoid false sharing.
2974 */
2975 break;
2976 case TCP_SYNACK_FASTOPEN:
2970 /* sk is a const pointer, because we want to express multiple 2977 /* sk is a const pointer, because we want to express multiple
2971 * cpu might call us concurrently. 2978 * cpu might call us concurrently.
2972 * sk->sk_wmem_alloc in an atomic, we can promote to rw. 2979 * sk->sk_wmem_alloc in an atomic, we can promote to rw.
2973 */ 2980 */
2974 skb_set_owner_w(skb, (struct sock *)sk); 2981 skb_set_owner_w(skb, (struct sock *)sk);
2982 break;
2975 } 2983 }
2976 skb_dst_set(skb, dst); 2984 skb_dst_set(skb, dst);
2977 2985
@@ -3516,7 +3524,7 @@ int tcp_rtx_synack(const struct sock *sk, struct request_sock *req)
3516 int res; 3524 int res;
3517 3525
3518 tcp_rsk(req)->txhash = net_tx_rndhash(); 3526 tcp_rsk(req)->txhash = net_tx_rndhash();
3519 res = af_ops->send_synack(sk, NULL, &fl, req, NULL, true); 3527 res = af_ops->send_synack(sk, NULL, &fl, req, NULL, TCP_SYNACK_NORMAL);
3520 if (!res) { 3528 if (!res) {
3521 TCP_INC_STATS_BH(sock_net(sk), TCP_MIB_RETRANSSEGS); 3529 TCP_INC_STATS_BH(sock_net(sk), TCP_MIB_RETRANSSEGS);
3522 NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_TCPSYNRETRANS); 3530 NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_TCPSYNRETRANS);