FreeBSD Bugzilla – Attachment 184556 Details for
Bug 211036
www/chromium hangs and becomes unresponsive just opening a new tab
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
v2
chromium-network-interface.diff (text/plain), 16.42 KB, created by
Carlos J. Puga Medina
on 2017-07-20 20:40:35 UTC
(
hide
)
Description:
v2
Filename:
MIME Type:
Creator:
Carlos J. Puga Medina
Created:
2017-07-20 20:40:35 UTC
Size:
16.42 KB
patch
obsolete
>Index: www/chromium/files/patch-net_BUILD.gn >=================================================================== >--- www/chromium/files/patch-net_BUILD.gn (revision 446254) >+++ www/chromium/files/patch-net_BUILD.gn (working copy) >@@ -1,6 +1,6 @@ >---- net/BUILD.gn.orig 2017-06-05 19:03:09 UTC >-+++ net/BUILD.gn >-@@ -86,7 +86,7 @@ if (use_glib && use_gconf && !is_chromeos) { >+--- net/BUILD.gn.orig 2017-06-26 21:03:20.000000000 +0200 >++++ net/BUILD.gn 2017-07-04 23:12:52.376233000 +0200 >+@@ -86,7 +86,7 @@ > net_configs += [ "//build/config/linux/gconf" ] > } > >@@ -9,7 +9,7 @@ > net_configs += [ "//build/config/linux:libresolv" ] > } > >-@@ -1900,6 +1900,16 @@ component("net") { >+@@ -1900,6 +1900,17 @@ > sources -= [ "disk_cache/blockfile/file_posix.cc" ] > } > >@@ -21,12 +21,13 @@ > + "base/network_change_notifier_linux.h", > + "base/network_interfaces_linux.cc", > + ] >++ sources += [ "base/network_interfaces_freebsd.cc" ] > + } > + > if (is_ios || is_mac) { > sources += [ > "base/mac/url_conversions.h", >-@@ -2854,7 +2864,7 @@ if (!is_ios && !is_android) { >+@@ -2854,7 +2865,7 @@ > } > } > >@@ -35,7 +36,7 @@ > executable("cachetool") { > testonly = true > sources = [ >-@@ -2883,7 +2893,7 @@ if (is_linux || is_mac) { >+@@ -2883,7 +2894,7 @@ > } > } > >@@ -44,7 +45,7 @@ > static_library("epoll_server") { > sources = [ > "tools/epoll_server/epoll_server.cc", >-@@ -2987,7 +2997,7 @@ if (is_android) { >+@@ -2987,7 +2998,7 @@ > } > } > >@@ -53,7 +54,7 @@ > executable("disk_cache_memory_test") { > testonly = true > sources = [ >-@@ -4874,7 +4884,7 @@ test("net_unittests") { >+@@ -4874,7 +4885,7 @@ > "third_party/nist-pkits/", > ] > >@@ -62,7 +63,7 @@ > deps += [ > "//third_party/pyftpdlib/", > "//third_party/pywebsocket/", >-@@ -4897,7 +4907,7 @@ test("net_unittests") { >+@@ -4897,7 +4908,7 @@ > if (is_desktop_linux) { > deps += [ ":epoll_quic_tools" ] > } >@@ -71,7 +72,7 @@ > sources += [ > "tools/quic/chlo_extractor_test.cc", > "tools/quic/end_to_end_test.cc", >-@@ -4957,6 +4967,10 @@ test("net_unittests") { >+@@ -4957,6 +4968,10 @@ > > if (is_chromeos) { > sources -= [ "proxy/proxy_config_service_linux_unittest.cc" ] >Index: www/chromium/files/patch-net_base_network__interfaces__freebsd.cc >=================================================================== >--- www/chromium/files/patch-net_base_network__interfaces__freebsd.cc (nonexistent) >+++ www/chromium/files/patch-net_base_network__interfaces__freebsd.cc (working copy) >@@ -0,0 +1,242 @@ >+--- net/base/network_interfaces_freebsd.cc.orig 2017-07-04 23:05:54.591928000 +0200 >++++ net/base/network_interfaces_freebsd.cc 2017-07-04 23:07:28.844964000 +0200 >+@@ -0,0 +1,239 @@ >++// Copyright (c) 2014 The Chromium Authors. All rights reserved. >++// Use of this source code is governed by a BSD-style license that can be >++// found in the LICENSE file. >++ >++#include "net/base/network_interfaces_freebsd.h" >++ >++#include <ifaddrs.h> >++#include <net/if.h> >++#include <netinet/in.h> >++#include <sys/types.h> >++#include <net/if_media.h> >++#include <netinet/in_var.h> >++#include <netinet6/in6_var.h> >++#include <sys/ioctl.h> >++ >++#include <memory> >++#include <set> >++ >++#include "base/files/file_path.h" >++#include "base/logging.h" >++#include "base/strings/string_number_conversions.h" >++#include "base/strings/string_tokenizer.h" >++#include "base/strings/string_util.h" >++#include "base/threading/thread_restrictions.h" >++#include "net/base/escape.h" >++#include "net/base/ip_endpoint.h" >++#include "net/base/net_errors.h" >++#include "net/base/network_interfaces_posix.h" >++#include "url/gurl.h" >++ >++namespace net { >++ >++namespace { >++ >++// FreeBSD implementation of IPAttributesGetterFreeBSD which calls ioctl on socket to >++// retrieve IP attributes. >++class IPAttributesGetterFreeBSDImpl : public internal::IPAttributesGetterFreeBSD { >++ public: >++ IPAttributesGetterFreeBSDImpl(); >++ ~IPAttributesGetterFreeBSDImpl() override; >++ bool IsInitialized() const override; >++ bool GetIPAttributes(const char* ifname, >++ const sockaddr* sock_addr, >++ int* native_attributes) override; >++ >++ private: >++ int ioctl_socket_; >++}; >++ >++IPAttributesGetterFreeBSDImpl::IPAttributesGetterFreeBSDImpl() >++ : ioctl_socket_(socket(AF_INET6, SOCK_DGRAM, 0)) { >++ DCHECK_GE(ioctl_socket_, 0); >++} >++ >++bool IPAttributesGetterFreeBSDImpl::IsInitialized() const { >++ return ioctl_socket_ >= 0; >++} >++ >++IPAttributesGetterFreeBSDImpl::~IPAttributesGetterFreeBSDImpl() { >++ if (ioctl_socket_ >= 0) { >++ close(ioctl_socket_); >++ } >++} >++ >++bool IPAttributesGetterFreeBSDImpl::GetIPAttributes(const char* ifname, >++ const sockaddr* sock_addr, >++ int* native_attributes) { >++ struct in6_ifreq ifr = {}; >++ strncpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name) - 1); >++ memcpy(&ifr.ifr_ifru.ifru_addr, sock_addr, sock_addr->sa_len); >++ int rv = ioctl(ioctl_socket_, SIOCGIFAFLAG_IN6, &ifr); >++ if (rv >= 0) { >++ *native_attributes = ifr.ifr_ifru.ifru_flags; >++ } >++ return (rv >= 0); >++} >++ >++// When returning true, the platform native IPv6 address attributes were >++// successfully converted to net IP address attributes. Otherwise, returning >++// false and the caller should drop the IP address which can't be used by the >++// application layer. >++bool TryConvertNativeToNetIPAttributes(int native_attributes, >++ int* net_attributes) { >++ // For FreeBSD, we disallow addresses with attributes IN6_IFF_ANYCASE, >++ // IN6_IFF_DUPLICATED, IN6_IFF_TENTATIVE, and IN6_IFF_DETACHED as these are >++ // still progressing through duplicated address detection (DAD) or are not >++ // suitable to be used in an one-to-one communication and shouldn't be used >++ // by the application layer. >++ if (native_attributes & (IN6_IFF_ANYCAST | IN6_IFF_DUPLICATED | >++ IN6_IFF_TENTATIVE | IN6_IFF_DETACHED)) { >++ return false; >++ } >++ >++ if (native_attributes & IN6_IFF_DEPRECATED) { >++ *net_attributes |= IP_ADDRESS_ATTRIBUTE_DEPRECATED; >++ } >++ >++ return true; >++} >++ >++NetworkChangeNotifier::ConnectionType GetNetworkInterfaceType( >++ int addr_family, >++ const std::string& interface_name) { >++ NetworkChangeNotifier::ConnectionType type = >++ NetworkChangeNotifier::CONNECTION_UNKNOWN; >++ >++ struct ifmediareq ifmr = {}; >++ strncpy(ifmr.ifm_name, interface_name.c_str(), sizeof(ifmr.ifm_name) - 1); >++ >++ int s = socket(addr_family, SOCK_DGRAM, 0); >++ if (s == -1) { >++ return type; >++ } >++ >++ if (ioctl(s, SIOCGIFMEDIA, &ifmr) != -1) { >++ if (ifmr.ifm_current & IFM_IEEE80211) { >++ type = NetworkChangeNotifier::CONNECTION_WIFI; >++ } else if (ifmr.ifm_current & IFM_ETHER) { >++ type = NetworkChangeNotifier::CONNECTION_ETHERNET; >++ } >++ } >++ close(s); >++ return type; >++} >++ >++} // namespace >++ >++namespace internal { >++ >++bool GetNetworkListImpl(NetworkInterfaceList* networks, >++ int policy, >++ const ifaddrs* interfaces, >++ IPAttributesGetterFreeBSD* ip_attributes_getter) { >++ // Enumerate the addresses assigned to network interfaces which are up. >++ for (const ifaddrs* interface = interfaces; interface != NULL; >++ interface = interface->ifa_next) { >++ // Skip loopback interfaces, and ones which are down. >++ if (!(IFF_RUNNING & interface->ifa_flags)) >++ continue; >++ if (IFF_LOOPBACK & interface->ifa_flags) >++ continue; >++ // Skip interfaces with no address configured. >++ struct sockaddr* addr = interface->ifa_addr; >++ if (!addr) >++ continue; >++ >++ // Skip unspecified addresses (i.e. made of zeroes) and loopback addresses >++ // configured on non-loopback interfaces. >++ if (IsLoopbackOrUnspecifiedAddress(addr)) >++ continue; >++ >++ const std::string& name = interface->ifa_name; >++ // Filter out VMware interfaces, typically named vmnet1 and vmnet8. >++ if (ShouldIgnoreInterface(name, policy)) { >++ continue; >++ } >++ >++ NetworkChangeNotifier::ConnectionType connection_type = >++ NetworkChangeNotifier::CONNECTION_UNKNOWN; >++ >++ int ip_attributes = IP_ADDRESS_ATTRIBUTE_NONE; >++ >++ // Retrieve native ip attributes and convert to net version if a getter is >++ // given. >++ if (ip_attributes_getter && ip_attributes_getter->IsInitialized()) { >++ int native_attributes = 0; >++ if (addr->sa_family == AF_INET6 && >++ ip_attributes_getter->GetIPAttributes( >++ interface->ifa_name, interface->ifa_addr, &native_attributes)) { >++ if (!TryConvertNativeToNetIPAttributes(native_attributes, >++ &ip_attributes)) { >++ continue; >++ } >++ } >++ } >++ >++ connection_type = GetNetworkInterfaceType(addr->sa_family, name); >++ >++ IPEndPoint address; >++ >++ int addr_size = 0; >++ if (addr->sa_family == AF_INET6) { >++ addr_size = sizeof(sockaddr_in6); >++ } else if (addr->sa_family == AF_INET) { >++ addr_size = sizeof(sockaddr_in); >++ } >++ >++ if (address.FromSockAddr(addr, addr_size)) { >++ uint8_t prefix_length = 0; >++ if (interface->ifa_netmask) { >++ // If not otherwise set, assume the same sa_family as ifa_addr. >++ if (interface->ifa_netmask->sa_family == 0) { >++ interface->ifa_netmask->sa_family = addr->sa_family; >++ } >++ IPEndPoint netmask; >++ if (netmask.FromSockAddr(interface->ifa_netmask, addr_size)) { >++ prefix_length = MaskPrefixLength(netmask.address()); >++ } >++ } >++ networks->push_back(NetworkInterface( >++ name, name, if_nametoindex(name.c_str()), connection_type, >++ address.address(), prefix_length, ip_attributes)); >++ } >++ } >++ >++ return true; >++} >++ >++} // namespace internal >++ >++bool GetNetworkList(NetworkInterfaceList* networks, int policy) { >++ if (networks == NULL) >++ return false; >++ >++ // getifaddrs() may require IO operations. >++ base::ThreadRestrictions::AssertIOAllowed(); >++ >++ ifaddrs* interfaces; >++ if (getifaddrs(&interfaces) < 0) { >++ PLOG(ERROR) << "getifaddrs"; >++ return false; >++ } >++ >++ std::unique_ptr<internal::IPAttributesGetterFreeBSD> ip_attributes_getter; >++ >++ ip_attributes_getter.reset(new IPAttributesGetterFreeBSDImpl()); >++ >++ bool result = internal::GetNetworkListImpl(networks, policy, interfaces, >++ ip_attributes_getter.get()); >++ freeifaddrs(interfaces); >++ return result; >++} >++ >++std::string GetWifiSSID() { >++ NOTIMPLEMENTED(); >++ return ""; >++} >++ >++} // namespace net > >Property changes on: www/chromium/files/patch-net_base_network__interfaces__freebsd.cc >___________________________________________________________________ >Added: fbsd:nokeywords >## -0,0 +1 ## >+yes >\ No newline at end of property >Added: svn:eol-style >## -0,0 +1 ## >+native >\ No newline at end of property >Added: svn:mime-type >## -0,0 +1 ## >+text/plain >\ No newline at end of property >Index: www/chromium/files/patch-net_base_network__interfaces__freebsd.h >=================================================================== >--- www/chromium/files/patch-net_base_network__interfaces__freebsd.h (nonexistent) >+++ www/chromium/files/patch-net_base_network__interfaces__freebsd.h (working copy) >@@ -0,0 +1,47 @@ >+--- net/base/network_interfaces_freebsd.h.orig 2017-07-04 23:05:05.313339000 +0200 >++++ net/base/network_interfaces_freebsd.h 2017-07-04 23:04:51.039635000 +0200 >+@@ -0,0 +1,44 @@ >++// Copyright (c) 2014 The Chromium Authors. All rights reserved. >++// Use of this source code is governed by a BSD-style license that can be >++// found in the LICENSE file. >++ >++#ifndef NET_BASE_NETWORK_INTERFACES_FREEBSD_H_ >++#define NET_BASE_NETWORK_INTERFACES_FREEBSD_H_ >++ >++// This file is only used to expose some of the internals >++// of network_interfaces_mac.cc to tests. >++ >++#include <sys/socket.h> >++ >++#include "base/macros.h" >++#include "net/base/net_export.h" >++#include "net/base/network_interfaces.h" >++ >++struct ifaddrs; >++struct sockaddr; >++ >++namespace net { >++namespace internal { >++ >++class NET_EXPORT IPAttributesGetterFreeBSD { >++ public: >++ IPAttributesGetterFreeBSD() {} >++ virtual ~IPAttributesGetterFreeBSD() {} >++ virtual bool IsInitialized() const = 0; >++ virtual bool GetIPAttributes(const char* ifname, >++ const sockaddr* sock_addr, >++ int* native_attributes) = 0; >++ >++ private: >++ DISALLOW_COPY_AND_ASSIGN(IPAttributesGetterFreeBSD); >++}; >++ >++NET_EXPORT bool GetNetworkListImpl(NetworkInterfaceList* networks, >++ int policy, >++ const ifaddrs* interfaces, >++ IPAttributesGetterFreeBSD* ip_attributes_getter); >++ >++} // namespace internal >++} // namespace net >++ >++#endif // NET_BASE_NETWORK_INTERFACES_FREEBSD_H_ > >Property changes on: www/chromium/files/patch-net_base_network__interfaces__freebsd.h >___________________________________________________________________ >Added: fbsd:nokeywords >## -0,0 +1 ## >+yes >\ No newline at end of property >Added: svn:eol-style >## -0,0 +1 ## >+native >\ No newline at end of property >Added: svn:mime-type >## -0,0 +1 ## >+text/plain >\ No newline at end of property >Index: www/chromium/files/patch-net_base_network__interfaces__posix.cc >=================================================================== >--- www/chromium/files/patch-net_base_network__interfaces__posix.cc (revision 446254) >+++ www/chromium/files/patch-net_base_network__interfaces__posix.cc (nonexistent) >@@ -1,20 +0,0 @@ >---- net/base/network_interfaces_posix.cc.orig 2017-04-19 19:06:36 UTC >-+++ net/base/network_interfaces_posix.cc >-@@ -9,7 +9,7 @@ >- #include <memory> >- #include <set> >- >--#if !defined(OS_NACL) >-+#if !defined(OS_NACL) && !defined(OS_BSD) >- #include "net/base/network_interfaces_posix.h" >- #include <net/if.h> >- #include <netinet/in.h> >-@@ -17,7 +17,7 @@ >- >- namespace net { >- >--#if !defined(OS_NACL) >-+#if !defined(OS_NACL) && !defined(OS_BSD) >- namespace internal { >- >- // The application layer can pass |policy| defined in net_util.h to > >Property changes on: www/chromium/files/patch-net_base_network__interfaces__posix.cc >___________________________________________________________________ >Deleted: fbsd:nokeywords >## -1 +0,0 ## >-yes >\ No newline at end of property >Deleted: svn:eol-style >## -1 +0,0 ## >-native >\ No newline at end of property >Deleted: svn:mime-type >## -1 +0,0 ## >-text/plain >\ No newline at end of property >Index: www/chromium/files/patch-net_base_network__interfaces__posix.h >=================================================================== >--- www/chromium/files/patch-net_base_network__interfaces__posix.h (nonexistent) >+++ www/chromium/files/patch-net_base_network__interfaces__posix.h (working copy) >@@ -0,0 +1,11 @@ >+--- net/base/network_interfaces_posix.h.orig 2017-07-04 22:49:41.402276000 +0200 >++++ net/base/network_interfaces_posix.h 2017-07-04 22:49:59.456467000 +0200 >+@@ -8,6 +8,8 @@ >+ // This file is only used to expose some of the internals of >+ // network_interfaces_posix.cc to network_interfaces_linux.cc and network_interfaces_mac.cc. >+ >++#include <sys/socket.h> >++ >+ #include <string> >+ >+ struct sockaddr; > >Property changes on: www/chromium/files/patch-net_base_network__interfaces__posix.h >___________________________________________________________________ >Added: fbsd:nokeywords >## -0,0 +1 ## >+yes >\ No newline at end of property >Added: svn:eol-style >## -0,0 +1 ## >+native >\ No newline at end of property >Added: svn:mime-type >## -0,0 +1 ## >+text/plain >\ No newline at end of property >Index: www/chromium/files/patch-v8_src_log-utils.h >=================================================================== >--- www/chromium/files/patch-v8_src_log-utils.h (nonexistent) >+++ www/chromium/files/patch-v8_src_log-utils.h (working copy) >@@ -0,0 +1,11 @@ >+--- v8/src/log-utils.h.orig 2017-07-04 22:40:30.657540000 +0200 >++++ v8/src/log-utils.h 2017-07-04 22:40:59.090730000 +0200 >+@@ -14,6 +14,8 @@ >+ #include "src/base/platform/mutex.h" >+ #include "src/flags.h" >+ >++#include <stdarg.h> >++ >+ namespace v8 { >+ namespace internal { >+ > >Property changes on: www/chromium/files/patch-v8_src_log-utils.h >___________________________________________________________________ >Added: fbsd:nokeywords >## -0,0 +1 ## >+yes >\ No newline at end of property >Added: svn:eol-style >## -0,0 +1 ## >+native >\ No newline at end of property >Added: svn:mime-type >## -0,0 +1 ## >+text/plain >\ No newline at end of property
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 211036
:
184061
|
184117
| 184556