Do not attempt to receive IPv6 flow labels on Android since the setsockopt call always fails. PiperOrigin-RevId: 713714235
diff --git a/quiche/quic/core/quic_udp_socket_posix.inc b/quiche/quic/core/quic_udp_socket_posix.inc index c368f2b..88bdf86 100644 --- a/quiche/quic/core/quic_udp_socket_posix.inc +++ b/quiche/quic/core/quic_udp_socket_posix.inc
@@ -235,7 +235,7 @@ << "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) {
diff --git a/quiche/quic/core/quic_udp_socket_test.cc b/quiche/quic/core/quic_udp_socket_test.cc index d1af818..6417c0e 100644 --- a/quiche/quic/core/quic_udp_socket_test.cc +++ b/quiche/quic/core/quic_udp_socket_test.cc
@@ -119,7 +119,14 @@ 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); @@ -132,7 +139,14 @@ 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