* Re: [PATCH 2.6.21-rc5-rt12] IPV6: Flag bit of ebitmask is not set in __inet6_hash.
[not found] <461543B5.6080605@ncos.nec.co.jp>
@ 2007-04-05 19:07 ` Ingo Molnar
2007-04-05 20:11 ` David Miller
2007-04-06 23:05 ` Masayuki Nakagawa
0 siblings, 2 replies; 3+ messages in thread
From: Ingo Molnar @ 2007-04-05 19:07 UTC (permalink / raw)
To: Masayuki Nakagawa; +Cc: linux-kernel, Adrian Bunk, David S. Miller
* Masayuki Nakagawa <nakagawa.msy@ncos.nec.co.jp> wrote:
> I found an issue with -rt patch. It is that netstat doesn't show IPv6
> sockets in ESTABLISHED state. This issue happens because a flag bit of
> ebitmask is not set when the IPv6 socket connection is established.
>
> The fix is to set the flag bit in __inet6_hash().
thanks. I'm wondering, should this fix be done in mainline too? -rt12 is
based on Linus' -git kernel from yesterday.
Ingo
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 2.6.21-rc5-rt12] IPV6: Flag bit of ebitmask is not set in __inet6_hash.
2007-04-05 19:07 ` [PATCH 2.6.21-rc5-rt12] IPV6: Flag bit of ebitmask is not set in __inet6_hash Ingo Molnar
@ 2007-04-05 20:11 ` David Miller
2007-04-06 23:05 ` Masayuki Nakagawa
1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2007-04-05 20:11 UTC (permalink / raw)
To: mingo; +Cc: nakagawa.msy, linux-kernel, bunk
From: Ingo Molnar <mingo@elte.hu>
Date: Thu, 5 Apr 2007 21:07:14 +0200
> * Masayuki Nakagawa <nakagawa.msy@ncos.nec.co.jp> wrote:
>
> > I found an issue with -rt patch. It is that netstat doesn't show IPv6
> > sockets in ESTABLISHED state. This issue happens because a flag bit of
> > ebitmask is not set when the IPv6 socket connection is established.
> >
> > The fix is to set the flag bit in __inet6_hash().
>
> thanks. I'm wondering, should this fix be done in mainline too? -rt12 is
> based on Linus' -git kernel from yesterday.
I don't see any of this bitmap stuff in my net-2.6.22 tree.
Also, because I figured that the patch was some -rt specific
fix I deleted the original patch so I can't even double check.
:-)
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 2.6.21-rc5-rt12] IPV6: Flag bit of ebitmask is not set in __inet6_hash.
2007-04-05 19:07 ` [PATCH 2.6.21-rc5-rt12] IPV6: Flag bit of ebitmask is not set in __inet6_hash Ingo Molnar
2007-04-05 20:11 ` David Miller
@ 2007-04-06 23:05 ` Masayuki Nakagawa
1 sibling, 0 replies; 3+ messages in thread
From: Masayuki Nakagawa @ 2007-04-06 23:05 UTC (permalink / raw)
To: Ingo Molnar
Cc: Masayuki Nakagawa, linux-kernel, Adrian Bunk, David S. Miller,
linux-rt-users, Mark Huth, dwalker
Ingo-san
This is a RT specific issue, and this fix is not needed in mainline.
When searching in-use sockets via netstat, RT uses a bitmap(ebitmask)
for fast search.
Non-RT doesn't use the bitmap.
Following patch is abstracted from RT patch(patch-2.6.21-rc5-rt12).
----------------------- Abstracted from RT patch
----------------------------
Index: linux/include/net/inet_hashtables.h
===================================================================
--- linux.orig/include/net/inet_hashtables.h
+++ linux/include/net/inet_hashtables.h
@@ -101,6 +101,7 @@ struct inet_hashinfo {
* TIME_WAIT sockets use a separate chain (twchain).
*/
struct inet_ehash_bucket *ehash;
+ unsigned long *ebitmask;
/* Ok, let's try this, I give up, we do need a local binding
* TCP hash as well as the others for fast bind/connect.
@@ -135,6 +136,13 @@ static inline struct inet_ehash_bucket *
return &hashinfo->ehash[hash & (hashinfo->ehash_size - 1)];
}
snip...
static inline void __inet_hash(struct inet_hashinfo *hashinfo,
struct sock *sk, const int listen_possible)
{
struct hlist_head *list;
rwlock_t *lock;
+ unsigned long *bitmask = NULL;
+ unsigned int index = 0;
BUG_TRAP(sk_unhashed(sk));
if (listen_possible && sk->sk_state == TCP_LISTEN) {
@@ -221,12 +243,15 @@ static inline void __inet_hash(struct in
} else {
struct inet_ehash_bucket *head;
sk->sk_hash = inet_sk_ehashfn(sk);
+ index = inet_ehash_index(hashinfo, sk->sk_hash);
head = inet_ehash_bucket(hashinfo, sk->sk_hash);
list = &head->chain;
lock = &head->lock;
+ bitmask = hashinfo->ebitmask;
write_lock(lock);
}
__sk_add_node(sk, list);
+ __inet_hash_setbit(bitmask, index);
sock_prot_inc_use(sk->sk_prot);
write_unlock(lock);
if (listen_possible && sk->sk_state == TCP_LISTEN)
-------------------------------------------------------------------------------
You can see that a flag bit is set properly into the bitmap in
__inet_hash(). This function is
called when IPv4 connection is established.
But when IPv6 connection is established, a flag bit is NOT set into the
bitmap, because
the code setting a flag bit is missing in __inet6_hash(). Therefore it
is impossible to find the
IPv6 sockets in established state, when searching in-use sockets via
netstat.
In the same way as __inet_hash(), setting a flag bit is needed in
__inet6_hash().
Thanks,
Masayuki Nakagawa
Ingo Molnar wrote:
> * Masayuki Nakagawa <nakagawa.msy@ncos.nec.co.jp> wrote:
>
>
>> I found an issue with -rt patch. It is that netstat doesn't show IPv6
>> sockets in ESTABLISHED state. This issue happens because a flag bit of
>> ebitmask is not set when the IPv6 socket connection is established.
>>
>> The fix is to set the flag bit in __inet6_hash().
>>
>
> thanks. I'm wondering, should this fix be done in mainline too? -rt12 is
> based on Linus' -git kernel from yesterday.
>
> Ingo
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2007-04-06 23:05 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <461543B5.6080605@ncos.nec.co.jp>
2007-04-05 19:07 ` [PATCH 2.6.21-rc5-rt12] IPV6: Flag bit of ebitmask is not set in __inet6_hash Ingo Molnar
2007-04-05 20:11 ` David Miller
2007-04-06 23:05 ` Masayuki Nakagawa
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®