Follow-up Comment #7, bug #15559 (project freeciv):

I have a similar bug using OpenBSD. I am running an old snapshot of OpenBSD

My server (S2_2 r17748) accepted connections from "localhost" and from
"", but not from "::1". I found that my server had no IPv6 support,
because configure failed the AF_INET6 check. OpenBSD has AF_INET6, so I fixed
configure and rebuilt my server with IPv6 support.

Now my server, with IPv6 support, accepts connections from "localhost" and
"::1", but not from "". My server refuses IPv4 connections because
it listens only to IPv6 socket.

* RFC 3493 <> specifies that IPv6 socket
may use IPv4 with addresses like "::ffff:".
* Some systems (at least OpenBSD) require IPv6 sockets to use IPv6 only. This
has security reason: "IPv4-Mapped Addresses on the Wire Considered Harmful"
* I have rumours that some versions of Debian, FreeBSD, NetBSD and Microsoft
Windows enable IPV6_V6ONLY by default.
* OpenBSD provides zero ways to disable IPV6_V6ONLY.
* Opinions from internet do range from 'IPV6_V6ONLY on is stupid' to
'IPV6_V6ONLY off is stupid'.

The correct way is to listen to multiple sockets: both IPv4 socket and IPv6
socket. Examples are identd.c
<> and
sshd.c <> of
OpenBSD. They use getaddrinfo(3) to get list addresses, create one socket(2)
per address, then poll(2) multiple sockets to listen(2).

I am attaching a patch *p22-listen-plural.diff* for S2_2 that attempts to use
multiple sockets. This might fix bug #15559 and bug #16149.

0 This patch fixes the AF_INET6 configure check. (OpenBSD needs <sys/types.h>
before <sys/socket.h>.)
0 This patch replaces the one socket 'sock' with an array 'listen_socks', and
listens to all connections in the array.
0 This patch adds a new bug. The multiple sockets can accept too many
connections, but server_make_connection() in server/sernet.c fails to close
the extra connections.

This patch allows my server to accept all of "localhost", "::1" and
"". I will continue to run S2_2 with my patch
*p22-listen-plural.diff* to look for bugs. I would like other players to
check if this patch fixes bug #15559, fixes bug #16149, or breaks platforms
other than OpenBSD.

(file #9838)

Additional Item Attachment:

File name: p22-plural-listen.diff         Size:7 KB


Reply to this item at:


  Message sent via/by Gna!

Freeciv-dev mailing list

Reply via email to