tcp_yeah: don't set ssthresh below 2
[pandora-kernel.git] / net / ipv4 / inet_connection_sock.c
index c14d88a..907ef2c 100644 (file)
@@ -647,6 +647,22 @@ void inet_csk_destroy_sock(struct sock *sk)
 }
 EXPORT_SYMBOL(inet_csk_destroy_sock);
 
+/* This function allows to force a closure of a socket after the call to
+ * tcp/dccp_create_openreq_child().
+ */
+void inet_csk_prepare_forced_close(struct sock *sk)
+{
+       /* sk_clone_lock locked the socket and set refcnt to 2 */
+       bh_unlock_sock(sk);
+       sock_put(sk);
+
+       /* The below has to be done to allow calling inet_csk_destroy_sock */
+       sock_set_flag(sk, SOCK_DEAD);
+       percpu_counter_inc(sk->sk_prot->orphan_count);
+       inet_sk(sk)->inet_num = 0;
+}
+EXPORT_SYMBOL(inet_csk_prepare_forced_close);
+
 int inet_csk_listen_start(struct sock *sk, const int nr_table_entries)
 {
        struct inet_sock *inet = inet_sk(sk);