From 7502401788fcba5c9f81a9e4701e2f0831e78698 Mon Sep 17 00:00:00 2001 From: skvlad Date: Thu, 29 Sep 2016 12:59:35 -0700 Subject: [PATCH] Do not spam "Connect failed with 101/65" in logs. WebRTC polls the list of local IP addresses for both IPv4 and IPv6 every ~2 seconds. It does so by trying to connect() a UDP socket to an address on the public Internet (without actually sending any packets). If the host doesn't have IPv6 (or IPv4) connectivity, it fails with errno 101 (ENETUNREACH, Linux) or errno 65 (EHOSTUNREACH, Mac). This is the expected behavior, and we shouldn't be logging these failures, especially since polling is fairly frequent. BUG=webrtc:6347 R=deadbeef@webrtc.org, honghaiz@webrtc.org, perkj@webrtc.org Review URL: https://codereview.webrtc.org/2370383002 . Cr-Commit-Position: refs/heads/master@{#14440} --- webrtc/base/network.cc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/webrtc/base/network.cc b/webrtc/base/network.cc index 36d028b493..ba056e4635 100644 --- a/webrtc/base/network.cc +++ b/webrtc/base/network.cc @@ -839,7 +839,12 @@ IPAddress BasicNetworkManager::QueryDefaultLocalAddress(int family) const { if (socket->Connect(SocketAddress( family == AF_INET ? kPublicIPv4Host : kPublicIPv6Host, kPublicPort)) < 0) { - LOG(LS_INFO) << "Connect failed with " << socket->GetError(); + if (socket->GetError() != ENETUNREACH + && socket->GetError() != EHOSTUNREACH) { + // Ignore the expected case of "host/net unreachable" - which happens if + // the network is V4- or V6-only. + LOG(LS_INFO) << "Connect failed with " << socket->GetError(); + } return IPAddress(); } return socket->GetLocalAddress().ipaddr();