Allows connecting to IPv6 hosts if an AAAA record is present

and /etc/gai.conf is not configured to prefer IPv4 hosts.

The current logic handling the output of getaddrinfo() is
flawed in that it only ever attempts to connect() to the
first address returned.

This is a problem for both round-robin and dual-stack hosts.

Furthermore, rtl_tcp_source_c::rtl_tcp_source_c() assumes a colon
in the device string is a port number.  This prevents the use
of raw IPv6 addresses.  The function will need to be taught how
to handle IPv6 addresses contained within square brackets, e.g.

Therefore further work is required to improve the handling of
multiple addresses, and also device strings containing raw IPv6

Signed-off-by: Jeremy Visser <>
This commit is contained in:
Jeremy Visser 2014-08-14 23:44:46 +02:00 committed by Dimitri Stolnikov
parent 225faa2e6a
commit 58d95b5164
1 changed files with 1 additions and 1 deletions

View File

@ -113,7 +113,7 @@ rtl_tcp_source_f::rtl_tcp_source_f(size_t itemsize,
struct addrinfo *ip_src; // store the source IP address to use
struct addrinfo hints;
memset( (void*)&hints, 0, sizeof(hints) );
hints.ai_family = AF_INET;
hints.ai_family = AF_UNSPEC;
hints.ai_socktype = SOCK_STREAM;
hints.ai_protocol = IPPROTO_TCP;
hints.ai_flags = AI_PASSIVE;