aboutsummaryrefslogtreecommitdiff
path: root/www/chromium/files/patch-net_socket_udp__socket__posix.cc
diff options
context:
space:
mode:
Diffstat (limited to 'www/chromium/files/patch-net_socket_udp__socket__posix.cc')
-rw-r--r--www/chromium/files/patch-net_socket_udp__socket__posix.cc75
1 files changed, 2 insertions, 73 deletions
diff --git a/www/chromium/files/patch-net_socket_udp__socket__posix.cc b/www/chromium/files/patch-net_socket_udp__socket__posix.cc
index 735676bdf70e..f70c756fa1c6 100644
--- a/www/chromium/files/patch-net_socket_udp__socket__posix.cc
+++ b/www/chromium/files/patch-net_socket_udp__socket__posix.cc
@@ -1,39 +1,6 @@
---- net/socket/udp_socket_posix.cc.orig 2021-12-14 11:45:09 UTC
+--- net/socket/udp_socket_posix.cc.orig 2022-02-07 13:39:41 UTC
+++ net/socket/udp_socket_posix.cc
-@@ -75,6 +75,32 @@ const int kActivityMonitorBytesThreshold = 65535;
- const int kActivityMonitorMinimumSamplesForThroughputEstimate = 2;
- const base::TimeDelta kActivityMonitorMsThreshold = base::Milliseconds(100);
-
-+#if defined(OS_BSD)
-+int GetIPv4AddressFromIndex(int socket, uint32_t index, uint32_t* address) {
-+ if (!index) {
-+ *address = htonl(INADDR_ANY);
-+ return OK;
-+ }
-+
-+ sockaddr_in* result = nullptr;
-+
-+ ifreq ifr;
-+ ifr.ifr_addr.sa_family = AF_INET;
-+ if (!if_indextoname(index, ifr.ifr_name))
-+ return MapSystemError(errno);
-+ int rv = ioctl(socket, SIOCGIFADDR, &ifr);
-+ if (rv == -1)
-+ return MapSystemError(errno);
-+ result = reinterpret_cast<sockaddr_in*>(&ifr.ifr_addr);
-+
-+ if (!result)
-+ return ERR_ADDRESS_INVALID;
-+
-+ *address = result->sin_addr.s_addr;
-+ return OK;
-+}
-+#endif
-+
- #if defined(OS_MAC)
-
- // On OSX the file descriptor is guarded to detect the cause of
-@@ -625,13 +651,13 @@ int UDPSocketPosix::SetDoNotFragment() {
+@@ -636,7 +636,7 @@ int UDPSocketPosix::SetDoNotFragment() {
}
void UDPSocketPosix::SetMsgConfirm(bool confirm) {
@@ -42,41 +9,3 @@
if (confirm) {
sendto_flags_ |= MSG_CONFIRM;
} else {
- sendto_flags_ &= ~MSG_CONFIRM;
- }
--#endif // !defined(OS_APPLE)
-+#endif // !defined(OS_APPLE) && !defined(OS_BSD)
- }
-
- int UDPSocketPosix::AllowAddressReuse() {
-@@ -926,7 +952,11 @@ int UDPSocketPosix::SetMulticastOptions() {
- mreq.imr_ifindex = multicast_interface_;
- mreq.imr_address.s_addr = htonl(INADDR_ANY);
- int rv = setsockopt(socket_, IPPROTO_IP, IP_MULTICAST_IF,
-+#if defined(OS_BSD)
-+ reinterpret_cast<const char*>(&mreq.imr_address.s_addr), sizeof(mreq.imr_address.s_addr));
-+#else
- reinterpret_cast<const char*>(&mreq), sizeof(mreq));
-+#endif
- if (rv)
- return MapSystemError(errno);
- break;
-@@ -1027,9 +1057,18 @@ int UDPSocketPosix::LeaveGroup(const IPAddress& group_
- case IPAddress::kIPv4AddressSize: {
- if (addr_family_ != AF_INET)
- return ERR_ADDRESS_INVALID;
-+#if defined(OS_BSD)
-+ ip_mreq mreq = {};
-+ int error = GetIPv4AddressFromIndex(socket_, multicast_interface_,
-+ &mreq.imr_interface.s_addr);
-+
-+ if (error != OK)
-+ return error;
-+#else
- ip_mreqn mreq = {};
- mreq.imr_ifindex = multicast_interface_;
- mreq.imr_address.s_addr = INADDR_ANY;
-+#endif
- memcpy(&mreq.imr_multiaddr, group_address.bytes().data(),
- IPAddress::kIPv4AddressSize);
- int rv = setsockopt(socket_, IPPROTO_IP, IP_DROP_MEMBERSHIP,