Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix getaddrinfo for IPv6 loopback address #22640

Merged
merged 1 commit into from
Oct 1, 2024

Conversation

sbc100
Copy link
Collaborator

@sbc100 sbc100 commented Sep 26, 2024

No description provided.

@@ -1073,7 +1073,7 @@ addToLibrary({
if (family === {{{ cDefs.AF_INET }}}) {
addr = _htonl({{{ cDefs.INADDR_LOOPBACK }}});
} else {
addr = [0, 0, 0, 1];
addr = [0, 0, 0, _htonl(1)];
Copy link
Member

Choose a reason for hiding this comment

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

To make sure I follow, this is an ipv6 address, and line 1074 is ipv4? (hence it is valid for one line to return an int, and other a JS array of 4 ints?)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, ip4 address are presented as a single number, ip6 is an array of 4 numbers.

This changes makes the address report correctly as ::1.

@sbc100 sbc100 disabled auto-merge October 1, 2024 00:14
@sbc100 sbc100 merged commit 3f6f7a9 into emscripten-core:main Oct 1, 2024
26 of 28 checks passed
@sbc100 sbc100 deleted the fix_getaddrinfo_null branch October 1, 2024 00:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants