1 // Copyright 2022 The Chromium Authors 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef NET_BASE_NETWORK_INTERFACES_GETIFADDRS_ANDROID_H_ 6 #define NET_BASE_NETWORK_INTERFACES_GETIFADDRS_ANDROID_H_ 7 8 #include "build/build_config.h" 9 10 #if BUILDFLAG(IS_ANDROID) 11 12 #include <ifaddrs.h> 13 14 namespace net::internal { 15 16 // Implementation of getifaddrs for Android. 17 // Fills out a list of ifaddr structs (see below) which contain information 18 // about every network interface available on the host. 19 // See 'man getifaddrs' on Linux or OS X (nb: it is not a POSIX function). 20 // Due to some buggy getifaddrs() implementation in Android 11, Chromium 21 // provides its own version. See https://crbug.com/1240237 for more context. 22 // ifa_ifu(ifa_broadaddr, ifa_dstaddr) is not populated in this function. 23 int Getifaddrs(struct ifaddrs** result); 24 void Freeifaddrs(struct ifaddrs* addrs); 25 26 } // namespace net::internal 27 28 #endif // BUILDFLAG(IS_ANDROID) 29 30 #endif // NET_BASE_NETWORK_INTERFACES_GETIFADDRS_ANDROID_H_ 31