| Index: webrtc/base/nethelpers.cc
|
| diff --git a/webrtc/base/nethelpers.cc b/webrtc/base/nethelpers.cc
|
| index d9015283b0baef98f2a370acdf334f9603a8765d..d3d24c2c971d39d7410f39e433f5f24d7732d442 100644
|
| --- a/webrtc/base/nethelpers.cc
|
| +++ b/webrtc/base/nethelpers.cc
|
| @@ -17,6 +17,10 @@
|
| #include <ws2tcpip.h>
|
| #include "webrtc/base/win32.h"
|
| #endif
|
| +#if defined(WEBRTC_LINUX)
|
| +#include <sys/types.h>
|
| +#include <ifaddrs.h>
|
| +#endif
|
|
|
| #include "webrtc/base/byteorder.h"
|
| #include "webrtc/base/logging.h"
|
| @@ -118,10 +122,7 @@ int inet_pton(int af, const char* src, void *dst) {
|
| }
|
|
|
| bool HasIPv6Enabled() {
|
| -#if !defined(WEBRTC_WIN)
|
| - // We only need to check this for Windows XP (so far).
|
| - return true;
|
| -#else
|
| +#if defined(WEBRTC_WIN)
|
| if (IsWindowsVistaOrLater()) {
|
| return true;
|
| }
|
| @@ -157,6 +158,22 @@ bool HasIPv6Enabled() {
|
| }
|
| }
|
| return false;
|
| +#elif defined(WEBRTC_LINUX)
|
| + bool has_ipv6 = false;
|
| + struct ifaddrs* ifa;
|
| + if (getifaddrs(&ifa) < 0) {
|
| + return false;
|
| + }
|
| + for (struct ifaddrs* cur = ifa; cur != nullptr; cur = cur->ifa_next) {
|
| + if (cur->ifa_addr->sa_family == AF_INET6) {
|
| + has_ipv6 = true;
|
| + break;
|
| + }
|
| + }
|
| + freeifaddrs(ifa);
|
| + return has_ipv6;
|
| +#else
|
| + return true;
|
| #endif
|
| }
|
| } // namespace rtc
|
|
|