Skip to content

Fix DNS lookups for IPv6 addresses. - #8053

Merged
jellefoks merged 9 commits into
youtube:25.lts.1+from
jellefoks:dns6_lookup_fix
Nov 17, 2025
Merged

jellefoks merged 9 commits into
youtube:25.lts.1+from
jellefoks:dns6_lookup_fix

Conversation

@jellefoks

@jellefoks jellefoks commented Nov 14, 2025 •

Copy link
Copy Markdown
Member

The Starboard layer wrapper for getaddrinfo() made incorrect copies of the address returned for IPv6 addresses.

This fixes that and adds extensive testing using a host with known IP addresses.

The fix is adopted from #7588 with a simplification and additional tests.

This PR also includes an update to test certs for net_unittests that expired Oct 29 2025.

Bug: 460175900
Bug: 438858995
Bug: 409716671
Bug: 460594994
Bug: 439002238
Bug: 405988446

@andrewsavage1 andrewsavage1 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This LGTM, but I'll ensure others get a chance to take a look. I assume we'll need to bring this into main/26.eap as well?

@jellefoks
jellefoks requested a review from kaidokert November 14, 2025 21:23
@kaidokert

Copy link
Copy Markdown
Contributor

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request fixes an issue with DNS lookups for IPv6 addresses by correctly copying sockaddr_in6 structures in the getaddrinfo wrapper. The changes also include extensive new tests to verify DNS resolution against known IP addresses and make other tests more robust by skipping them on environments where they cannot run.

My review has identified a critical issue in the new test logic that could lead to crashes, as well as a high-severity issue where the core fix could be made more robust. I've also included a medium-severity suggestion to improve test code maintainability by reducing duplication. Please see the detailed comments below.

@kaidokert kaidokert left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great find, and looks like a good fix to me.

@jellefoks

This comment was marked as resolved.

@jellefoks
jellefoks enabled auto-merge (squash) November 15, 2025 01:01
@jellefoks
jellefoks force-pushed the dns6_lookup_fix branch 2 times, most recently from be39676 to 53039b5 Compare November 15, 2025 05:57

@yell0wd0g yell0wd0g left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This LGTM, although I'm not sure my +1 is enough for this branch.

Particularly love the added tests!

@jellefoks
jellefoks force-pushed the dns6_lookup_fix branch 4 times, most recently from 970514d to f26a78b Compare November 16, 2025 22:31
@jellefoks
jellefoks merged commit 5dbf892 into youtube:25.lts.1+ Nov 17, 2025
254 of 255 checks passed
@jellefoks jellefoks added the cp-main Cherry Pick TO the main branch label Dec 9, 2025
jellefoks added a commit that referenced this pull request Dec 11, 2025
The Starboard layer wrapper for getaddrinfo() made incorrect copies of
the address returned for IPv6 addresses.

This fixes that and adds extensive testing using a host with known IP
addresses.

The fix is adopted from #7588 with
a simplification and additional tests.

This PR also includes an update to test certs for net_unittests that
expired Oct 29 2025.

Bug: 460175900
Bug: 438858995
Bug: 409716671
Bug: 460594994
Bug: 439002238
Bug: 405988446

---------

Co-authored-by: jimmy.ge <[email protected]>
jellefoks added a commit to jellefoks/cobalt that referenced this pull request Dec 11, 2025
The Starboard layer wrapper for getaddrinfo() made incorrect copies of
the address returned for IPv6 addresses.

This fixes that and adds extensive testing using a host with known IP
addresses.

The fix is adopted from youtube#7588 with
a simplification and additional tests.

This PR also includes an update to test certs for net_unittests that
expired Oct 29 2025.

Bug: 460175900
Bug: 438858995
Bug: 409716671
Bug: 460594994
Bug: 439002238
Bug: 405988446

---------

Co-authored-by: jimmy.ge <[email protected]>
jellefoks added a commit to jellefoks/cobalt that referenced this pull request Dec 15, 2025
The Starboard layer wrapper for getaddrinfo() made incorrect copies of
the address returned for IPv6 addresses.

This fixes that and adds extensive testing using a host with known IP
addresses.

The fix is adopted from youtube#7588 with
a simplification and additional tests.

This PR also includes an update to test certs for net_unittests that
expired Oct 29 2025.

Bug: 460175900
Bug: 438858995
Bug: 409716671
Bug: 460594994
Bug: 439002238
Bug: 405988446

---------

Co-authored-by: jimmy.ge <[email protected]>
jellefoks added a commit that referenced this pull request Dec 16, 2025
…8367)

Refer to the original PR: #8053

The Starboard layer wrapper for getaddrinfo() made incorrect copies of
the sockaddr structure for IPv6 addresses. This issue prevented proper
resolution and use of IPv6 addresses for DNS lookups.

This change modifies the wrapper to ensure that the entire sockaddr
structure, including the address data, is correctly copied, thus
resolving the IPv6 address lookup failures. Additionally, extensive
tests have been added and updated to thoroughly verify both IPv4 and
IPv6 address resolution for known external hosts and localhost.

Bug: 460175900
Bug: 438858995
Bug: 409716671
Bug: 460594994
Bug: 439002238
Bug: 405988446

Co-authored-by: jimmy.ge <[email protected]>
cobalt-github-releaser-bot pushed a commit that referenced this pull request Dec 16, 2025
…8367)

Refer to the original PR: #8053

The Starboard layer wrapper for getaddrinfo() made incorrect copies of
the sockaddr structure for IPv6 addresses. This issue prevented proper
resolution and use of IPv6 addresses for DNS lookups.

This change modifies the wrapper to ensure that the entire sockaddr
structure, including the address data, is correctly copied, thus
resolving the IPv6 address lookup failures. Additionally, extensive
tests have been added and updated to thoroughly verify both IPv4 and
IPv6 address resolution for known external hosts and localhost.

Bug: 460175900
Bug: 438858995
Bug: 409716671
Bug: 460594994
Bug: 439002238
Bug: 405988446

Co-authored-by: jimmy.ge <[email protected]>
(cherry picked from commit 2280057)
jellefoks added a commit that referenced this pull request Dec 16, 2025
…s for IPv6 addresses. (#8428)

Refer to the original PR: #8367

Refer to the original PR: #8053

The Starboard layer wrapper for getaddrinfo() made incorrect copies of
the sockaddr structure for IPv6 addresses. This issue prevented proper
resolution and use of IPv6 addresses for DNS lookups.

This change modifies the wrapper to ensure that the entire sockaddr
structure, including the address data, is correctly copied, thus
resolving the IPv6 address lookup failures. Additionally, extensive
tests have been added and updated to thoroughly verify both IPv4 and
IPv6 address resolution for known external hosts and localhost.

Bug: 460175900
Bug: 438858995
Bug: 409716671
Bug: 460594994
Bug: 439002238
Bug: 405988446

Co-authored-by: Jelle Foks <[email protected]>
Co-authored-by: jimmy.ge <[email protected]>
msolya pushed a commit to msolya/cobalt that referenced this pull request Mar 6, 2026
The Starboard layer wrapper for getaddrinfo() made incorrect copies of
the address returned for IPv6 addresses.

This fixes that and adds extensive testing using a host with known IP
addresses.

The fix is adopted from youtube#7588 with
a simplification and additional tests.

This PR also includes an update to test certs for net_unittests that
expired Oct 29 2025.

Bug: 460175900
Bug: 438858995
Bug: 409716671
Bug: 460594994
Bug: 439002238
Bug: 405988446

---------

Co-authored-by: jimmy.ge <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cp-main Cherry Pick TO the main branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants