multi: probe for IPv6 functionality in multi_init()#20383
Closed
multi: probe for IPv6 functionality in multi_init()#20383
Conversation
In some legacy systems IPv6 might dynamically work/not work and thus curl needs to check/probe to see if it should indeed be used. This change moves the probe that checks for working IPv6 to the multi handle setup function instead of delaying it to when the first name resolve is performed. This avoids a later tricky error path if the socket cannot be created due to OOM.
Member
Author
|
augment review |
🤖 Augment PR SummarySummary: Move IPv6 capability probing to multi handle initialization so the result is known upfront.
🤖 Was this summary useful? React with 👍 or 👎 |
There was a problem hiding this comment.
Pull request overview
This PR moves the IPv6 functionality probe from lazy initialization during name resolution to eager initialization during multi handle setup. This prevents potential out-of-memory errors in a complex error path later when DNS resolution happens.
Changes:
- Replaced tri-state IPv6 status tracking (UNKNOWN/DEAD/WORKS) with a simple boolean flag
- Moved IPv6 probing from
Curl_ipv6works()to newCurl_probeipv6()function called duringCurl_multi_handle()initialization - Simplified
Curl_ipv6works()to just return the pre-computed status
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| lib/multihandle.h | Changed ipv6_up from unsigned char with three states to a simple BIT(ipv6_works) boolean flag |
| lib/multi.c | Added call to Curl_probeipv6() during multi handle initialization with proper error handling |
| lib/hostip.h | Added Curl_probeipv6() function declaration for USE_IPV6, defined as CURLE_OK macro otherwise |
| lib/hostip.c | Implemented Curl_probeipv6() with socket creation test and OOM detection; simplified Curl_ipv6works() to return cached result |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
In some legacy systems IPv6 might dynamically work/not work and thus curl needs to check/probe to see if it should indeed be used.
This change moves the probe that checks for working IPv6 to the multi handle setup function instead of delaying it to when the first name resolve is performed. This avoids a later tricky error path if the socket cannot be created due to OOM.