Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 20 May 2016 15:40:05 +0400
From:      aler <aler@playground.ru>
To:        freebsd-net@freebsd.org
Subject:   connect() EADDRINUSE
Message-ID:  <1a502a88-29df-fc93-d3f1-b8d2f0da15cc@playground.ru>

next in thread | raw e-mail | index | archive | help
Port autoselection on connect() without bind() (or with bind() with zero 
sin_port) sometimes works wronly and gives already busy local port 
number that will lead to EADDRINUSE on connection attempt. This all 
happens when jails used.

How to fix:

src/sys/netinet/in_pcb.c, in_pcb_lport() function

calls to in_pcblookup_local() should have last argument NULL, not cred

that's because here we are not about getting some access but about 
avoiding port number conflicts, so all inpcb's should be taken in account


This all applies to FreeBSD 10.x




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1a502a88-29df-fc93-d3f1-b8d2f0da15cc>