Conversation
This was referenced Sep 25, 2026
This was referenced Sep 25, 2026
david-yu
added this pull request to stack #12
September 25, 2026 16:16
ipv4_addr has both; ipv6_addr had neither, so an IPv6 endpoint could not be compared or used as a hash-map key without first converting it to a socket_address. Also drop the stale FIXME on network_stack::connect: the local address has followed the destination's family since 453d531.
The socket_address to ipv4_addr conversion is implicit and has been noexcept since b72a0cb, but it delegates to ipv4_addr(const inet_address&, uint16_t), which throws for an IPv6 address that is not IPv4-mapped — so passing an IPv6 socket_address anywhere an ipv4_addr is expected terminated the process instead of raising std::invalid_argument. Drop the noexcept. The only caller inside a noexcept function is socket_address::is_wildcard(), in its AF_INET arm, where the conversion cannot throw; that is now commented. The native stack's make_bound_datagram_channel checked nothing and reached an assert on a non-AF_INET address, while its unbound counterpart throws: make it throw too.
david-yu
force-pushed
the
ipv6/08-address-types
branch
from
September 25, 2026 18:11
59cd693 to
00e7787
Compare
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.
Part 8 of 10 of the IPv6 series, split out of #1 and rebased on current
scylladb/seastarmaster. Based on #8, so the diff here is only this PR's 2 commits.Why
Two gaps in the address types:
ipv4_addrhasoperator==andstd::hash;ipv6_addrhad neither.ipv4_addr(const socket_address&)is implicit and has beennoexceptsinceb72a0cbd0, but it delegates to a constructor that throws for an IPv6 address, so an IPv6socket_addressreaching anipv4_addrparameter calledstd::terminate.What
ab7e301d0) — also drops the stale FIXME onnetwork_stack::connect: the local address has followed the destination's family since453d531b0.00e7787f0) — drops thenoexcept; the native stack'smake_bound_datagram_channelnow throws for a non-AF_INETaddress like its unbound counterpart, instead of reaching an assert.API
ipv4_addr(const socket_address&)losesnoexcept. Calls are unaffected; only code that requires the conversion to benoexceptwould notice.std::hash<::sockaddr_in>andoperator==(::sockaddr_in, ::sockaddr_in)stay (review on net, dns, tls: make Seastar work on IPv6-only and dual-stack hosts #1).socket_address::wildcard(family, port)any more:inet_address(family)(669685c78) andipv6_addr(port)already spell a family's any-address.Testing
On the core-aws VM (Ubuntu 24.04, GCC 14, C++23, RelWithDebInfo, GnuTLS and OpenSSL in one tree), this PR's head builds and passes
dns,ipv6,socket,rpc,httpd,httpd_openssl,tls,tls_openssl,network_interface,websocketandunix_domainwithSEASTAR_TEST_REQUIRE_IPV6=1, so none of their IPv6 cases skipped.Stack