* [TCP] Fixed bug that hid sockets in tcp_diag
@ 2004-10-06 3:58 Herbert Xu
2004-10-06 5:22 ` David S. Miller
0 siblings, 1 reply; 3+ messages in thread
From: Herbert Xu @ 2004-10-06 3:58 UTC (permalink / raw)
To: David S. Miller, Arnaldo Carvalho de Melo, netdev
[-- Attachment #1: Type: text/plain, Size: 504 bytes --]
Hi:
This patch squashes a bug in tcp_diag which was created when the
sk_* loops replaced the original for loops. It's a pity that these
sk_*/hlist_*/list_* loops don't take an arbitrary expression as an
argument for continue.
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: 2295 bytes --]
===== net/ipv4/tcp_diag.c 1.18 vs edited =====
--- 1.18/net/ipv4/tcp_diag.c 2004-10-04 07:26:12 +10:00
+++ edited/net/ipv4/tcp_diag.c 2004-10-06 13:43:17 +10:00
@@ -495,21 +495,22 @@
sk_for_each(sk, node, &tcp_listening_hash[i]) {
struct inet_opt *inet = inet_sk(sk);
if (num < s_num)
- continue;
+ goto next_listen;
if (!(r->tcpdiag_states&TCPF_LISTEN) ||
r->id.tcpdiag_dport)
- continue;
+ goto next_listen;
if (r->id.tcpdiag_sport != inet->sport &&
r->id.tcpdiag_sport)
- continue;
+ goto next_listen;
if (bc && !tcpdiag_bc_run(RTA_DATA(bc), RTA_PAYLOAD(bc), sk))
- continue;
+ goto next_listen;
if (tcpdiag_fill(skb, sk, r->tcpdiag_ext,
NETLINK_CB(cb->skb).pid,
cb->nlh->nlmsg_seq) <= 0) {
tcp_listen_unlock();
goto done;
}
+next_listen:
++num;
}
}
@@ -537,22 +538,23 @@
struct inet_opt *inet = inet_sk(sk);
if (num < s_num)
- continue;
+ goto next_normal;
if (!(r->tcpdiag_states & (1 << sk->sk_state)))
- continue;
+ goto next_normal;
if (r->id.tcpdiag_sport != inet->sport &&
r->id.tcpdiag_sport)
- continue;
+ goto next_normal;
if (r->id.tcpdiag_dport != inet->dport && r->id.tcpdiag_dport)
- continue;
+ goto next_normal;
if (bc && !tcpdiag_bc_run(RTA_DATA(bc), RTA_PAYLOAD(bc), sk))
- continue;
+ goto next_normal;
if (tcpdiag_fill(skb, sk, r->tcpdiag_ext,
NETLINK_CB(cb->skb).pid,
cb->nlh->nlmsg_seq) <= 0) {
read_unlock_bh(&head->lock);
goto done;
}
+next_normal:
++num;
}
@@ -562,21 +564,22 @@
struct inet_opt *inet = inet_sk(sk);
if (num < s_num)
- continue;
+ goto next_dying;
if (r->id.tcpdiag_sport != inet->sport &&
r->id.tcpdiag_sport)
- continue;
+ goto next_dying;
if (r->id.tcpdiag_dport != inet->dport &&
r->id.tcpdiag_dport)
- continue;
+ goto next_dying;
if (bc && !tcpdiag_bc_run(RTA_DATA(bc), RTA_PAYLOAD(bc), sk))
- continue;
+ goto next_dying;
if (tcpdiag_fill(skb, sk, r->tcpdiag_ext,
NETLINK_CB(cb->skb).pid,
cb->nlh->nlmsg_seq) <= 0) {
read_unlock_bh(&head->lock);
goto done;
}
+next_dying:
++num;
}
}
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [TCP] Fixed bug that hid sockets in tcp_diag
2004-10-06 3:58 [TCP] Fixed bug that hid sockets in tcp_diag Herbert Xu
@ 2004-10-06 5:22 ` David S. Miller
2004-10-06 6:02 ` Herbert Xu
0 siblings, 1 reply; 3+ messages in thread
From: David S. Miller @ 2004-10-06 5:22 UTC (permalink / raw)
To: Herbert Xu; +Cc: acme, netdev
On Wed, 6 Oct 2004 13:58:01 +1000
Herbert Xu <herbert@gondor.apana.org.au> wrote:
> This patch squashes a bug in tcp_diag which was created when the
> sk_* loops replaced the original for loops. It's a pity that these
> sk_*/hlist_*/list_* loops don't take an arbitrary expression as an
> argument for continue.
>
> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Thanks a lot for fixing this bug Herbert, patch applied.
Did you send this patch to the original bug reporter for
testing? What was the result?
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [TCP] Fixed bug that hid sockets in tcp_diag
2004-10-06 5:22 ` David S. Miller
@ 2004-10-06 6:02 ` Herbert Xu
0 siblings, 0 replies; 3+ messages in thread
From: Herbert Xu @ 2004-10-06 6:02 UTC (permalink / raw)
To: David S. Miller; +Cc: acme, netdev
On Tue, Oct 05, 2004 at 10:22:02PM -0700, David S. Miller wrote:
>
> Did you send this patch to the original bug reporter for
> testing? What was the result?
I haven't fixed his problem yet. This is just a start :)
--
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
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2004-10-06 6:02 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-10-06 3:58 [TCP] Fixed bug that hid sockets in tcp_diag Herbert Xu
2004-10-06 5:22 ` David S. Miller
2004-10-06 6:02 ` Herbert Xu
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).