]> git.hungrycats.org Git - linux/commitdiff
[TCP]: Show all SYN_RECV sockets in /proc/net/tcp
authorHerbert Xu <herbert@gondor.apan.org.au>
Tue, 5 Oct 2004 14:58:06 +0000 (07:58 -0700)
committerDavid S. Miller <davem@nuts.davemloft.net>
Tue, 5 Oct 2004 14:58:06 +0000 (07:58 -0700)
I was fixing the tcp_diag so that it shows SYN_RECV sockets properly.
I found that /proc/net/tcp didn't do it correctly either.  So here is
a small patch to fix /proc/net/tcp.

The logic in there stinks though so I'd love to see a rewrite.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv4/tcp_ipv4.c

index b98a14863fd4041dbf6215a4b18a08e85449fef1..58d715d71da979485639a3fe48a4faf5a984f79a 100644 (file)
@@ -2175,8 +2175,14 @@ get_req:
                sk        = sk_next(st->syn_wait_sk);
                st->state = TCP_SEQ_STATE_LISTENING;
                read_unlock_bh(&tp->syn_wait_lock);
-       } else
+       } else {
+               tp = tcp_sk(sk);
+               read_lock_bh(&tp->syn_wait_lock);
+               if (tp->listen_opt && tp->listen_opt->qlen)
+                       goto start_req;
+               read_unlock_bh(&tp->syn_wait_lock);
                sk = sk_next(sk);
+       }
 get_sk:
        sk_for_each_from(sk, node) {
                if (sk->sk_family == st->family) {
@@ -2186,6 +2192,7 @@ get_sk:
                tp = tcp_sk(sk);
                read_lock_bh(&tp->syn_wait_lock);
                if (tp->listen_opt && tp->listen_opt->qlen) {
+start_req:
                        st->uid         = sock_i_uid(sk);
                        st->syn_wait_sk = sk;
                        st->state       = TCP_SEQ_STATE_OPENREQ;