--- linux/net/ipv4/tcp_ipv4.c.orig 2004-12-15 12:30:11.723133016 +0200 +++ linux/net/ipv4/tcp_ipv4.c 2004-12-15 12:30:31.212170232 +0200 @@ -50,6 +50,8 @@ * YOSHIFUJI Hideaki @USAGI and: Support IPV6_V6ONLY socket option, which * Alexey Kuznetsov allow both IPv4 and IPv6 sockets to bind * a single port at the same time. + * Ilya Pashkovsky : allow reuse of port with single listener + * remove boolean sk_reuse > 1 check */ #include @@ -193,7 +195,8 @@ static inline int tcp_bind_conflict(stru !sk2->sk_bound_dev_if || sk->sk_bound_dev_if == sk2->sk_bound_dev_if)) { if (!reuse || !sk2->sk_reuse || - sk2->sk_state == TCP_LISTEN) { + (sk2->sk_state == TCP_LISTEN && + sk->sk_state == TCP_LISTEN)) { const u32 sk2_rcv_saddr = tcp_v4_rcv_saddr(sk2); if (!sk2_rcv_saddr || !sk_rcv_saddr || sk2_rcv_saddr == sk_rcv_saddr) @@ -259,8 +262,6 @@ static int tcp_v4_get_port(struct sock * goto tb_not_found; tb_found: if (!hlist_empty(&tb->owners)) { - if (sk->sk_reuse > 1) - goto success; if (tb->fastreuse > 0 && sk->sk_reuse && sk->sk_state != TCP_LISTEN) { goto success; --- linux/net/ipv6/tcp_ipv6.c.orig 2004-12-15 12:31:41.888425808 +0200 +++ linux/net/ipv6/tcp_ipv6.c 2004-12-15 01:42:08.603265728 +0200 @@ -18,6 +18,7 @@ * Alexey Kuznetsov allow both IPv4 and IPv6 sockets to bind * a single port at the same time. * YOSHIFUJI Hideaki @USAGI: convert /proc/net/tcp6 to seq_file. + * Ilya Pashkovsky : allow reuse of port with single listener * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -111,7 +112,8 @@ static inline int tcp_v6_bind_conflict(s !sk2->sk_bound_dev_if || sk->sk_bound_dev_if == sk2->sk_bound_dev_if) && (!sk->sk_reuse || !sk2->sk_reuse || - sk2->sk_state == TCP_LISTEN) && + (sk2->sk_state == TCP_LISTEN && + sk->sk_state == TCP_LISTEN)) && ipv6_rcv_saddr_equal(sk, sk2)) break; }