URL:
  <http://gna.org/bugs/?17020>

                 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: 

    _______________________________________________________

Details:

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
refused".

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,
—octo



    _______________________________________________________

File Attachments:


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

<http://gna.org/bugs/download.php?file_id=11118>

    _______________________________________________________

Reply to this item at:

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

_______________________________________________
  Nachricht geschickt von/durch Gna!
  http://gna.org/


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

Reply via email to