Conversation
IPv6 UDP sockets normalize IPv4 and IPv4-mapped destinations to IPv4 internally. Returning those endpoints directly from getsockname/getpeername exposed an AF_INET sockaddr on an AF_INET6 socket, violating Linux's dual-stack ABI and triggering glibc's address-sorting assertion. Add one private UDP name-query conversion shared by the local and peer accessors. Map IPv4 addresses back to IPv4-mapped IPv6 only for IPv6 sockets, leaving routing, receive matching, port selection and generic sockaddr copyout unchanged. No additional state, allocation or locking is introduced. Extend the existing dunitest suite with seven cases covering both destination formats, address-family reuse after disconnect, explicit wildcard binding, unbound and IPv4 behavior, truncated name buffers and the isolated getaddrinfo(NULL) reproducer. Validation: make kernel; make fmt FMT_CHECK=--check; seven new Linux cases repeated ten times; DragonOS QEMU UDP IPv6 suite 20/20 and device-binding suite 8/8. The original socket and getaddrinfo probes now pass. The original npm registry curl request returns HTTP 200 and exit 0 with and without tracing, without forcing IPv4 or disabling TLS verification. Independent plan review and three-role implementation review found no outstanding defects. Signed-off-by: longjin <longjin@dragonos.org>
Member
Author
|
@codex review |
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.
Summary
Fix IPv6 UDP
getsockname()andgetpeername()returning an IPv4 sockaddrafter a successful connection to an IPv4 destination.
This Linux ABI mismatch caused glibc's IPv4-mapped address assertion during
getaddrinfo()result sorting, aborting curl before it could connect to npmregistry. The issue also reproduces without DNS or external networking using
getaddrinfo(NULL, "443", ...)with AF_UNSPEC and SOCK_STREAM hints.Implementation
The kernel change adds no fields, locks, allocations or application-specific
behavior. Semantics were checked against Linux 6.6.139's IPv6 datagram connect
and
inet6_getname()implementations.Regression coverage
Seven tests extend the existing UDP IPv6 dunitest suite:
getaddrinfo(NULL)reproducerValidation
make kernelmake fmt FMT_CHECK=--check(including clippy)git diff --checkgetaddrinfo(NULL)probe: exit 134 → 0without tracing; no
-4and no disabled TLS verificationsystem/performance reviews completed with no outstanding findings.
Scope
This fixes UDP name-query serialization, not complete IPv6 support. Existing
V6ONLY and unrelated syscall validation gaps are unchanged. Full gVisor,
non-x86_64 runtime suites and end-to-end model generation were not tested.