Commit a1b4d745 authored by Herbert Xu's avatar Herbert Xu Committed by David S. Miller

[TCP]: Show all SYN_RECV sockets in /proc/net/tcp

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: default avatarHerbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 8756f2ef
...@@ -2175,8 +2175,14 @@ static void *listening_get_next(struct seq_file *seq, void *cur) ...@@ -2175,8 +2175,14 @@ static void *listening_get_next(struct seq_file *seq, void *cur)
sk = sk_next(st->syn_wait_sk); sk = sk_next(st->syn_wait_sk);
st->state = TCP_SEQ_STATE_LISTENING; st->state = TCP_SEQ_STATE_LISTENING;
read_unlock_bh(&tp->syn_wait_lock); 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); sk = sk_next(sk);
}
get_sk: get_sk:
sk_for_each_from(sk, node) { sk_for_each_from(sk, node) {
if (sk->sk_family == st->family) { if (sk->sk_family == st->family) {
...@@ -2186,6 +2192,7 @@ static void *listening_get_next(struct seq_file *seq, void *cur) ...@@ -2186,6 +2192,7 @@ static void *listening_get_next(struct seq_file *seq, void *cur)
tp = tcp_sk(sk); tp = tcp_sk(sk);
read_lock_bh(&tp->syn_wait_lock); read_lock_bh(&tp->syn_wait_lock);
if (tp->listen_opt && tp->listen_opt->qlen) { if (tp->listen_opt && tp->listen_opt->qlen) {
start_req:
st->uid = sock_i_uid(sk); st->uid = sock_i_uid(sk);
st->syn_wait_sk = sk; st->syn_wait_sk = sk;
st->state = TCP_SEQ_STATE_OPENREQ; st->state = TCP_SEQ_STATE_OPENREQ;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment