Retry server connection using other address type #1562
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Version of iperf3 (or development branch, such as
master
or3.1-STABLE
) to which this pull request applies: masterIssues fixed (if any): Fallback logic on client mode (IPv6 -> IPv4 (tcp)) #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 bygetaddrinfo()
(called bynetdial() -> 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()
.