--XuV1QlJbYrcVoo+x
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

Jason DiCioccio (geniusj / bluenugget.net) wrote:

> Under FreeBSD 5.0-RELEASE running ruby 1.6.8, the following code:
> 
> ----
> require 'socket'
> 
> server = TCPServer.new(9999)
> client = server.accept
> ----
> 
> only seems to bind to port 9999 on ipv6 interfaces.
> 
> % netstat -an | grep 9999
> tcp6       0      0  *.9999                 *.*                    LISTEN
> %
> 
> It works, however, when I specify a host to bind to.  It only fails when 
> trying to use INADDR_ANY..
> 
> I cannot tell for sure whether this is due to changes in FreeBSD, ruby, or 
> a combination of both.  However, my guess would be ruby since I have many 
> daemons binding to INADDR_ANY and running fine.  Is anyone else running BSD 
> (or perhaps other OS') with IPv6 support still in the kernel able to 
> duplicate this problem?

You no doubt have sysctl net.inet6.ip6.v6only = 1

BEWARE THE SECURITY CONSEQUENCES OF CHANGING THIS TO 0

By changing it to '0', you will be able to listen on both tcp4 and tcp6

-- 
Eric Hodel - drbrain / segment7.net - http://segment7.net
All messages signed with fingerprint:
FEC2 57F1 D465 EB15 5D6E  7C11 332A 551C 796C 9F04


--XuV1QlJbYrcVoo+x
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.0 (FreeBSD)

iD8DBQE+L5J8MypVHHlsnwQRAlEzAKCavxecKm/1NituOyjCifLVpeJ3FgCfb8Fm
63mzwHHv0CZ9rr4jmE6ERDIAm
-----END PGP SIGNATURE-----

--XuV1QlJbYrcVoo+x--