Retry server connection using other address type
-
Version of iperf3 (or development branch, such as
masteror3.1-STABLE) to which this pull request applies: master -
Issues fixed (if any): #1558
-
Brief description of code changes (suitable for use as a commit message):
Suggested enhancement per discussion #1558 - when connection to the server fails on "connection refused" while using IPv4/IPv6 address type, retry with the other address type (IPv6/IPv4). This is done only when the server address is a hostname and -4 or -6 options are not used. The first address used is per the address returned by getaddrinfo() (called by netdial() -> create_socket()).
Note that per the getaddreinfo() man page: "AF_UNSPEC indicates that getaddrinfo() should return socket addresses for any address family (either IPv4 or IPv6, for example) that can be used with node and service". At least in my WSL machine only the IPv4 address is returned. This is why the retry in done in iperf_connect().