9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] bug in network stack regarding Ipht
@ 2015-06-08 22:35 yoann padioleau
  2015-06-09  8:07 ` cinap_lenrek
  0 siblings, 1 reply; 2+ messages in thread
From: yoann padioleau @ 2015-06-08 22:35 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

Hi,

I think I’ve found a bug in the network stack.
in 9/ip/ip.h there is
struct Ipht
{
	Lock;
	Iphash	*tab[Nipht];
};

where Night is 521,

but then in 9/ip/ipaux.c there is

ulong
iphash(uchar *sa, ushort sp, uchar *da, ushort dp)
{
	return ((sa[IPaddrlen-1]<<24) ^ (sp << 16) ^ (da[IPaddrlen-1]<<8) ^ dp ) % Nhash;
}

where Nhash is just 64,

so lots of entries in Ipht.tab will never be used. This slows down every ip+port lookups in the UDP and TCP code.





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

* Re: [9fans] bug in network stack regarding Ipht
  2015-06-08 22:35 [9fans] bug in network stack regarding Ipht yoann padioleau
@ 2015-06-09  8:07 ` cinap_lenrek
  0 siblings, 0 replies; 2+ messages in thread
From: cinap_lenrek @ 2015-06-09  8:07 UTC (permalink / raw)
  To: 9fans

good catch!

--
cinap



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

end of thread, other threads:[~2015-06-09  8:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-08 22:35 [9fans] bug in network stack regarding Ipht yoann padioleau
2015-06-09  8:07 ` cinap_lenrek

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).