9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: yoann padioleau <aryx.padator@gmail.com>
To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net>
Subject: [9fans] bug in network stack regarding Ipht
Date: Mon,  8 Jun 2015 15:35:57 -0700	[thread overview]
Message-ID: <E20A10D8-82E6-4CF5-9CCD-FB140ABA4E44@gmail.com> (raw)

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.





             reply	other threads:[~2015-06-08 22:35 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-08 22:35 yoann padioleau [this message]
2015-06-09  8:07 ` cinap_lenrek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=E20A10D8-82E6-4CF5-9CCD-FB140ABA4E44@gmail.com \
    --to=aryx.padator@gmail.com \
    --cc=9fans@9fans.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).