From: Kirill A. Korinsky Subject: chromium: disable IP_TOS for UDP To: Robert Nagy Cc: OpenBSD ports Date: Tue, 08 Sep 2026 23:38:19 +0200 Robert, last update of chromium brings interestign issue. In browser I see that sometimes sites lagging to opens, special than it uses CDN and I had .core files and following errors: [94626:430929:0908/230331.214258:ERROR:services/network/p2p/socket_udp.cc:263] bind() to 169.254.0.1:0 failed: -147 [94626:430929:0908/230331.215009:ERROR:services/network/p2p/socket_udp.cc:263] bind() to 162.55.136.124:0 failed: -147 ungoogled-chromium[94626]: pledge "inet", syscall 105 luck me I still had artifacts from last test of recover patch, so I was able to make some investigation where I think I had figured it out. Seems that new chromium plays with TOS at UDP for HTTP/3 and our pledge prevents it, and kills the process. It dumps ~100Mb core and after that it fallback to HTTP/1.1. Here a diff where I prevents from using IP_TOS which I've applied only to chromium to ungoogled-chromium and had skipt iridium because it is still 151x Does it make any sense? Ok? Index: chromium/Makefile =================================================================== RCS file: /home/cvs/ports/www/chromium/Makefile,v diff -u -p -r1.930 Makefile --- chromium/Makefile 4 Sep 2026 07:15:08 -0000 1.930 +++ chromium/Makefile 8 Sep 2026 21:31:28 -0000 @@ -13,6 +13,7 @@ DPB_PROPERTIES+= lonesome COMMENT= Chromium browser V= 152.0.7977.82 +REVISION= 0 DISTNAME= chromium-${V} Index: chromium/patches/patch-net_socket_udp_socket_posix_cc =================================================================== RCS file: /home/cvs/ports/www/chromium/patches/patch-net_socket_udp_socket_posix_cc,v diff -u -p -r1.64 patch-net_socket_udp_socket_posix_cc --- chromium/patches/patch-net_socket_udp_socket_posix_cc 1 Sep 2026 06:56:00 -0000 1.64 +++ chromium/patches/patch-net_socket_udp_socket_posix_cc 8 Sep 2026 21:31:13 -0000 @@ -154,14 +154,31 @@ Index: net/socket/udp_socket_posix.cc int UDPSocketPosix::JoinSourceGroup(const IPAddress& group_address, const IPAddress& source_address) const { DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); -@@ -1679,6 +1696,10 @@ int UDPSocketPosix::JoinSourceGroup(const IPAddress& g - return SetSourceGroupMembership(group_address, source_address, +@@ -1680,6 +1697,10 @@ int UDPSocketPosix::JoinSourceGroup(const IPAddress& g MCAST_JOIN_SOURCE_GROUP); } -+ + +#if !defined(MCAST_LEAVE_SOURCE_GROUP) +#define MCAST_LEAVE_SOURCE_GROUP 0 +#endif - ++ int UDPSocketPosix::LeaveSourceGroup(const IPAddress& group_address, const IPAddress& source_address) const { + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); +@@ -1755,9 +1776,13 @@ int UDPSocketPosix::SetTos(DiffServCodePoint dscp, Ecn + dscp_and_ecn |= (dscp << 2); + } + } +- // Set the IPv4 option in all cases to support dual-stack sockets. +- int rv = setsockopt(socket_, IPPROTO_IP, IP_TOS, &dscp_and_ecn, +- sizeof(dscp_and_ecn)); ++ // Set the IPv4 option for dual-stack sockets, except on OpenBSD, where ++ // pledge forbids IP_TOS on IPv6 sockets. ++ int rv = 0; ++ if (!BUILDFLAG(IS_OPENBSD) || addr_family_ != AF_INET6) { ++ rv = setsockopt(socket_, IPPROTO_IP, IP_TOS, &dscp_and_ecn, ++ sizeof(dscp_and_ecn)); ++ } + if (addr_family_ == AF_INET6) { + // In the IPv6 case, the previous socksetopt may fail because of a lack of + // dual-stack support. Therefore ignore the previous return value. Index: ungoogled-chromium/Makefile =================================================================== RCS file: /home/cvs/ports/www/ungoogled-chromium/Makefile,v diff -u -p -r1.254 Makefile --- ungoogled-chromium/Makefile 4 Sep 2026 11:25:35 -0000 1.254 +++ ungoogled-chromium/Makefile 8 Sep 2026 21:30:59 -0000 @@ -15,6 +15,7 @@ COMMENT= Chromium browser sans integrat V= 152.0.7977.82 UGV= ${V}-1 +REVISION= 0 DISTNAME= ungoogled-chromium-${V} Index: ungoogled-chromium/patches/patch-net_socket_udp_socket_posix_cc =================================================================== RCS file: /home/cvs/ports/www/ungoogled-chromium/patches/patch-net_socket_udp_socket_posix_cc,v diff -u -p -r1.25 patch-net_socket_udp_socket_posix_cc --- ungoogled-chromium/patches/patch-net_socket_udp_socket_posix_cc 4 Sep 2026 06:44:59 -0000 1.25 +++ ungoogled-chromium/patches/patch-net_socket_udp_socket_posix_cc 8 Sep 2026 21:23:56 -0000 @@ -154,14 +154,31 @@ Index: net/socket/udp_socket_posix.cc int UDPSocketPosix::JoinSourceGroup(const IPAddress& group_address, const IPAddress& source_address) const { DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); -@@ -1679,6 +1696,10 @@ int UDPSocketPosix::JoinSourceGroup(const IPAddress& g - return SetSourceGroupMembership(group_address, source_address, +@@ -1680,6 +1697,10 @@ int UDPSocketPosix::JoinSourceGroup(const IPAddress& g MCAST_JOIN_SOURCE_GROUP); } -+ + +#if !defined(MCAST_LEAVE_SOURCE_GROUP) +#define MCAST_LEAVE_SOURCE_GROUP 0 +#endif - ++ int UDPSocketPosix::LeaveSourceGroup(const IPAddress& group_address, const IPAddress& source_address) const { + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); +@@ -1755,9 +1776,13 @@ int UDPSocketPosix::SetTos(DiffServCodePoint dscp, Ecn + dscp_and_ecn |= (dscp << 2); + } + } +- // Set the IPv4 option in all cases to support dual-stack sockets. +- int rv = setsockopt(socket_, IPPROTO_IP, IP_TOS, &dscp_and_ecn, +- sizeof(dscp_and_ecn)); ++ // Set the IPv4 option for dual-stack sockets, except on OpenBSD, where ++ // pledge forbids IP_TOS on IPv6 sockets. ++ int rv = 0; ++ if (!BUILDFLAG(IS_OPENBSD) || addr_family_ != AF_INET6) { ++ rv = setsockopt(socket_, IPPROTO_IP, IP_TOS, &dscp_and_ecn, ++ sizeof(dscp_and_ecn)); ++ } + if (addr_family_ == AF_INET6) { + // In the IPv6 case, the previous socksetopt may fail because of a lack of + // dual-stack support. Therefore ignore the previous return value. -- wbr, Kirill