WaterSweet / mochiweb

Automatically exported from code.google.com/p/mochiweb
Other
0 stars 0 forks source link

mochiweb only listens on ipv4 even when ipv6 is available and detected #51

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. start a mochiweb server on a host configured with both ipv4 and ipv6
2. check address bindings with "netstat -tln"

What is the expected output? What do you see instead?

tcp6       0      0 :::8000                 :::*                    LISTEN

would indicate listening on *both* v4 and v6, but instead

tcp        0      0 0.0.0.0:8000            0.0.0.0:*               LISTEN

indicating v4 only bind is shown.

What version of the product are you using? On what operating system?

svn checkout done on 1st december 2009, running on erlang/otp 13.b.2
running on debian linux.

I believe the attached patch fixes this issue. It seems gen_tcp_listen
expects only the inet6 option for binding both v4 and v6.

Original issue reported on code.google.com by linzber...@gmail.com on 1 Dec 2009 at 4:13

Attachments:

GoogleCodeExporter commented 8 years ago
r118

Original comment by bob.ippo...@gmail.com on 2 Jan 2010 at 8:34

GoogleCodeExporter commented 8 years ago
For the record, this bug fix makes mochiweb to only listen on IPv6 when no IP 
is set
on a pristine FreeBSD installation.

Unix sockets are only configurable on either IPv4 or IPv6, through the domain
parameter of socket(2) which can be PF_INET or PF_INET6. Operating systems, 
however,
can map IPv4 packets to a IPv6 socket listening on any interface. This is a 
feature
(apparently) enabled by default on Debian Linux, enabled by default on MacOS X 
and
that can be configured on FreeBSD. FreeBSD doesn't enable it by default because 
they
judge there is a security risk.

Original comment by pgu...@gmail.com on 19 Jan 2010 at 5:41

GoogleCodeExporter commented 8 years ago
rolled back in r135, see http://code.google.com/p/mochiweb/issues/detail?id=56

Original comment by bob.ippo...@gmail.com on 19 Jan 2010 at 6:21

GoogleCodeExporter commented 8 years ago
On my computer - ArchLinux, Erlang R13B03 (erts-5.7.4) - it seems that the 
order of
the [inet, inet6] option is important.

[inet, inet6] listens only on ipv4 (same as just [inet]? )
[inet6, inet] listens to both ipv6 and ipv4 (actually it's the same as [inet6] 
only)

can this be checked on the other platforms too?

Original comment by gdam...@gmail.com on 20 Jan 2010 at 4:43