lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20120118155742.5ed38f98@asterix.rh>
Date:	Wed, 18 Jan 2012 15:57:42 -0200
From:	Flavio Leitner <fbl@...hat.com>
To:	Eric Dumazet <eric.dumazet@...il.com>
Cc:	netdev <netdev@...r.kernel.org>,
	Marcelo Leitner <mleitner@...hat.com>
Subject: Re: bind()/inet_csk_get_port() fails when no port is requested

On Wed, 18 Jan 2012 18:36:59 +0100
Eric Dumazet <eric.dumazet@...il.com> wrote:

> Le mercredi 18 janvier 2012 à 15:11 -0200, Flavio Leitner a écrit :
> > Hi folks,
> > 
> > It has been reported to me that bind() fails when you leave
> > the port up to the kernel to choose and succeed when you
> > request a certain port in the same conditions.
> > 
> > For example, let's restrict the ephemeral port range to 3 ports only:
> > # echo "32768 32770" > /proc/sys/net/ipv4/ip_local_port_range
> > 
> > Assuming the system has two IP addresses: 172.31.1.6/24 and
> > 192.168.100.6/24 then run the following python script which
> > allocates all ephemeral ports using one IP address and then
> > try to bind another one using another IP address.
> > 
> ...
> > Conclusion: When using ephemeral ports, inet_csk_get_port()
> > fails without checking if a conflict had happened. When using
> > fixed ports on the other hand, inet_csk_get_port() works
> > as expected.
> > 
> > I will attach a quick hack to illustrate what I am thinking.
> > The idea is to check all ports first and if it fails, then
> > try again looking for a port that doesn't conflict. So, for
> > most cases, the algorithm is the same, but when the system
> > ran out of ports, there is a hope :-)
> > 
> > Is there a reason to behave like that? or is this a real bug?
> > Sounds like a FAQ, but I am not finding an explanation for this
> > on the net yet.
> > 
> 
> Hi Flavio
> 
> This seems a very good idea.
> 
> Only drawback is when table is really full, we'll scan it twice.
> 

That's right. Maybe checking for conflicts in the first round
helps, but it would add a cost for the average case scenario.

But first, I'd like to know if this is a bug before spending
more time working on it. Maybe there is a reason for behaving
like that.

thanks!
fbl
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ