Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
[linux-block.git] / net / ipv4 / tcp_ipv4.c
index 4c43365c374c8bf868fc0b862333244ca26d5016..e22439f05e46a7908b94da7b41958f771faf1dea 100644 (file)
@@ -480,7 +480,7 @@ void tcp_v4_err(struct sk_buff *icmp_skb, u32 info)
                                               TCP_TIMEOUT_INIT;
                icsk->icsk_rto = inet_csk_rto_backoff(icsk, TCP_RTO_MAX);
 
-               skb = tcp_write_queue_head(sk);
+               skb = tcp_rtx_queue_head(sk);
                BUG_ON(!skb);
 
                tcp_mstamp_refresh(tp);
@@ -1783,8 +1783,9 @@ do_time_wait:
                        refcounted = false;
                        goto process;
                }
-               /* Fall through to ACK */
        }
+               /* to ACK */
+               /* fall through */
        case TCP_TW_ACK:
                tcp_v4_timewait_ack(sk, skb);
                break;
@@ -1896,6 +1897,7 @@ void tcp_v4_destroy_sock(struct sock *sk)
 
        /* If socket is aborted during connect operation */
        tcp_free_fastopen_req(tp);
+       tcp_fastopen_destroy_cipher(sk);
        tcp_saved_syn_free(tp);
 
        sk_sockets_allocated_dec(sk);
@@ -2477,6 +2479,11 @@ static int __net_init tcp_sk_init(struct net *net)
        net->ipv4.sysctl_tcp_window_scaling = 1;
        net->ipv4.sysctl_tcp_timestamps = 1;
 
+       net->ipv4.sysctl_tcp_fastopen = TFO_CLIENT_ENABLE;
+       spin_lock_init(&net->ipv4.tcp_fastopen_ctx_lock);
+       net->ipv4.sysctl_tcp_fastopen_blackhole_timeout = 60 * 60;
+       atomic_set(&net->ipv4.tfo_active_disable_times, 0);
+
        return 0;
 fail:
        tcp_sk_exit(net);
@@ -2486,7 +2493,12 @@ fail:
 
 static void __net_exit tcp_sk_exit_batch(struct list_head *net_exit_list)
 {
+       struct net *net;
+
        inet_twsk_purge(&tcp_hashinfo, AF_INET);
+
+       list_for_each_entry(net, net_exit_list, exit_list)
+               tcp_fastopen_ctx_destroy(net);
 }
 
 static struct pernet_operations __net_initdata tcp_sk_ops = {