Summary: IPv6: Improve connecting to dual-stack system
                 Project: Freeciv
            Submitted by: None
            Submitted on: Donnerstag 04.11.2010 um 14:50 CET
                Category: client
                Severity: 3 - Normal
                Priority: 5 - Normal
                  Status: None
             Assigned to: None
        Originator Email: f...@octo.it
             Open/Closed: Open
                 Release: r18414
         Discussion Lock: Any
        Operating System: None
         Planned Release: 



I ran into a problem when setting up a game with two machines, both having
IPv6 connectivity: Both, server and client have global, public IPv6 addresses
and are able to connect to the internet via IPv6. For some reason (totally
unrelated), the server only bound to the IPv4 any-address. When trying to
connect to the host name, the IPv6 address was returned and tried, but no
connection could be made. Instead of trying the IPv4 address which was
returned as well, the client simply gave up and reported "connection

The attached patch implements the expected behavior: It iterates over all
addresses returned by getaddrinfo(3) and tries to establish a connection. If
connecting to an address fails, it continues with the next returned address.
This is the default behavior under UNIX and has the huge benefit of "working
just like any other program". For example, whether IPv4 or IPv6 is preferred
is controlled via the "/etc/gai.conf" configuration file and if a domain name
resolves to multiple addresses they will be tried in a pseudo-random
(round-robin) fashion.

In all likelihood this patch has some flaws. For example, I'm not 100%
certain if and where the file descriptor gets closed. Also, it is possible
that under Windows includes or defines are missing.

Best regards,


File Attachments:

Date: Donnerstag 04.11.2010 um 14:50 CET  Name: freeciv-ipv6-connect.patch 
Size: 2kB   By: None



Reply to this item at:


  Nachricht geschickt von/durch Gna!

Freeciv-dev mailing list

Reply via email to