Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Consider a connection to IP addressed [ ::1 ; 127.1 ]. This should give some preference to ::1, but should attempt a connection to both ::1 and 127.1. Earlier, the sequence of actions was as follows: - Connect ::1 - Wait for v6_connect_timeout, connect_failed, or connected - Cancel connection attempt to ::1; Connect 127.1 - Wait for connect_timeout, connect_failed, or connected This means the connection to the IPv6 address was only waiting for v6_connect_timeout time, and then being cancelled. There were no two connection being attempted to be established at the same time. Some DNS resolvers on the azure cloud (where Github actions are hosted) do not reply on port 853 (DNS-over-TLS), but just drop the packets. This confused the happy-eyeballs/dns-client stack, and it resulted in a timeout (as spotted by semgrep). With this PR, the above scenario is changed to: - Connect ::1 - Wait for connect_delay, connect_failed, or connected - Connect 127.1 - Wait for connect_timeout, connect_failed, or connected - Cancel all other connection attempts (on success or timeout) And the same is applied to using a single IP address and multiple ports (i.e. for the DNS resolver probing port 853 and 53). * for IP addresses, encoded as domain name, print the ipaddr directly (to avoid confusion) * in Connect_failed cases (i.e. timeout), also cancel all connection attempts * revise log output, only print in timer when there's change (actions or suspend) * improve error message for failed connections * review with @reynir * note about v6_connect_timeout --------- Co-authored-by: Robur <team@robur.coop> Sponsored-By: Semgrep Inc
- Loading branch information
Showing
5 changed files
with
355 additions
and
267 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.