netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [TCP] Show all SYN_RECV sockets in /proc/net/tcp
@ 2004-10-06  2:06 Herbert Xu
  2004-10-06  2:17 ` Arnaldo Carvalho de Melo
  2004-10-06  5:18 ` David S. Miller
  0 siblings, 2 replies; 7+ messages in thread
From: Herbert Xu @ 2004-10-06  2:06 UTC (permalink / raw)
  To: David S. Miller, netdev

[-- Attachment #1: Type: text/plain, Size: 526 bytes --]

Hi Dave:

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>

Cheers,
-- 
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

[-- Attachment #2: p --]
[-- Type: text/plain, Size: 835 bytes --]

===== net/ipv4/tcp_ipv4.c 1.99 vs edited =====
--- 1.99/net/ipv4/tcp_ipv4.c	2004-09-15 06:57:07 +10:00
+++ edited/net/ipv4/tcp_ipv4.c	2004-10-06 11:25:04 +10:00
@@ -2175,8 +2175,14 @@
 		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 @@
 	       	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;

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2004-10-06  5:18 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-10-06  2:06 [TCP] Show all SYN_RECV sockets in /proc/net/tcp Herbert Xu
2004-10-06  2:17 ` Arnaldo Carvalho de Melo
2004-10-06  2:35   ` Herbert Xu
2004-10-06  2:43     ` Arnaldo Carvalho de Melo
2004-10-06  3:58     ` Randy.Dunlap
2004-10-06  2:55   ` YOSHIFUJI Hideaki / 吉藤英明
2004-10-06  5:18 ` David S. Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).