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

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

My server (S2_2 r17748) accepted connections from "localhost" and from
"127.0.0.1", 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 "127.0.0.1". My server refuses IPv4 connections because
it listens only to IPv6 socket.

* RFC 3493 <http://tools.ietf.org/html/rfc3493> specifies that IPv6 socket
may use IPv4 with addresses like "::ffff:172.34.5.6".
* Some systems (at least OpenBSD) require IPv6 sockets to use IPv6 only. This
has security reason: "IPv4-Mapped Addresses on the Wire Considered Harmful"
<http://tools.ietf.org/html/draft-itojun-v6ops-v4mapped-harmful-02>.
* 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
<http://www.openbsd.org/cgi-bin/cvsweb/src/libexec/identd/identd.c> and
sshd.c <http://www.openbsd.org/cgi-bin/cvsweb/src/usr.bin/ssh/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
"127.0.0.1". 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:

  <http://gna.org/bugs/?15559>

_______________________________________________
  Message sent via/by Gna!
  http://gna.org/


_______________________________________________
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev

Reply via email to