Fix failure in net/quic/mobile:quic_udp_socket_test_ios
The iOS behavior of the IP_RECVTOS sockopt appears to have changed. The resulting cmsg is of type IP_RECVTOS instead of IP_TOS.
quic_udp_socket_test and quic_udp_socket_test_ios both now pass.
PiperOrigin-RevId: 583399990
diff --git a/quiche/quic/core/quic_udp_socket_posix.inc b/quiche/quic/core/quic_udp_socket_posix.inc
index 114b359..d6ec150 100644
--- a/quiche/quic/core/quic_udp_socket_posix.inc
+++ b/quiche/quic/core/quic_udp_socket_posix.inc
@@ -132,8 +132,13 @@
return;
}
+#if defined(__APPLE__)
+ if ((cmsg->cmsg_level == IPPROTO_IP && cmsg->cmsg_type == IP_RECVTOS) ||
+ (cmsg->cmsg_level == IPPROTO_IPV6 && cmsg->cmsg_type == IPV6_TCLASS)) {
+#else
if ((cmsg->cmsg_level == IPPROTO_IP && cmsg->cmsg_type == IP_TOS) ||
(cmsg->cmsg_level == IPPROTO_IPV6 && cmsg->cmsg_type == IPV6_TCLASS)) {
+#endif
if (packet_info_interested.IsSet(QuicUdpPacketInfoBit::ECN)) {
packet_info->SetEcnCodepoint(QuicEcnCodepoint(
*(reinterpret_cast<uint8_t*>(CMSG_DATA(cmsg))) & kEcnMask));