Skip to content

Commit

Permalink
Do not attempt to receive IPv6 flow labels on Android since
Browse files Browse the repository at this point in the history
the setsockopt call always fails.

PiperOrigin-RevId: 713714235
  • Loading branch information
RyanTheOptimist authored and copybara-github committed Jan 9, 2025
1 parent 934d1de commit c20a7b1
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion quiche/quic/core/quic_udp_socket_posix.inc
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ bool QuicUdpSocketApi::SetupSocket(QuicUdpSocketFd fd, int address_family,
<< "IPv6 socket";
return false;
}
#if defined(__linux__)
#if defined(__linux__) && !defined(__ANDROID__)
if (GetQuicRestartFlag(quic_support_flow_label2)) {
QUIC_RESTART_FLAG_COUNT_N(quic_support_flow_label2, 5, 6);
if (setsockopt(fd, SOL_IPV6, IPV6_FLOWINFO, &set, sizeof(set)) != 0) {
Expand Down
14 changes: 14 additions & 0 deletions quiche/quic/core/quic_udp_socket_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,14 @@ TEST_F(QuicUdpSocketTest, FlowLabel) {
do {
socket_api.ReadPacket(server_socket, packet_info_interested, &read_result);
} while (!read_result.ok);
#if !defined(__ANDROID__)
ASSERT_TRUE(
read_result.packet_info.HasValue(QuicUdpPacketInfoBit::V6_FLOW_LABEL));
EXPECT_EQ(client_flow_label, read_result.packet_info.flow_label());
#else
EXPECT_FALSE(
read_result.packet_info.HasValue(QuicUdpPacketInfoBit::V6_FLOW_LABEL));
#endif

const uint32_t server_flow_label = 3;
packet_info.SetPeerAddress(client_address);
Expand All @@ -132,7 +139,14 @@ TEST_F(QuicUdpSocketTest, FlowLabel) {
do {
socket_api.ReadPacket(client_socket, packet_info_interested, &read_result);
} while (!read_result.ok);
#if !defined(__ANDROID__)
ASSERT_TRUE(
read_result.packet_info.HasValue(QuicUdpPacketInfoBit::V6_FLOW_LABEL));
EXPECT_EQ(server_flow_label, read_result.packet_info.flow_label());
#else
EXPECT_FALSE(
read_result.packet_info.HasValue(QuicUdpPacketInfoBit::V6_FLOW_LABEL));
#endif
}

} // namespace
Expand Down

0 comments on commit c20a7b1

Please sign in to comment.