network_interfaces_getifaddrs_android.h 1.1 KB

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