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 Apple ECN dual stack behavior #35196

Merged
merged 11 commits into from
Aug 16, 2024
15 changes: 12 additions & 3 deletions test/common/quic/active_quic_listener_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -603,14 +603,23 @@ TEST_P(ActiveQuicListenerTest, EcnReportingIsEnabled) {
Network::Socket& socket = ActiveQuicListenerPeer::socket(*quic_listener_);
absl::optional<Network::Address::IpVersion> version = socket.ipVersion();
EXPECT_TRUE(version.has_value());
int optval;
int optval = 0;
socklen_t optlen = sizeof(optval);
Api::SysCallIntResult rv;
if (*version == Network::Address::IpVersion::v6) {
rv = socket.getSocketOption(IPPROTO_IPV6, IPV6_RECVTCLASS, &optval, &optlen);
} else {
rv = socket.getSocketOption(IPPROTO_IP, IP_RECVTOS, &optval, &optlen);
EXPECT_EQ(rv.return_value_, 0);
EXPECT_EQ(optval, 1);
rv = socket.getSocketOption(IPPROTO_IPV6, IPV6_V6ONLY, &optval, &optlen);
EXPECT_EQ(rv.return_value_, 0);
if (optval) {
martinduke marked this conversation as resolved.
Show resolved Hide resolved
return;
}
}
// Check the IPv4 version of the sockopt if the socket is v4 or dual-stack.
// Platform/ APIs for ECN reporting are poorly documented, but this test
// should uncover any issues.
rv = socket.getSocketOption(IPPROTO_IP, IP_RECVTOS, &optval, &optlen);
martinduke marked this conversation as resolved.
Show resolved Hide resolved
EXPECT_EQ(rv.return_value_, 0);
EXPECT_EQ(optval, 1);
}
Expand Down