Use ip_address helpers to get loopback IP. This fixes use of undeclared identifier 'INADDR_LOOPBACK' when compiling fake_port_allocator.h on iOS. Change-Id: Ia94080650058a3fdd7b63a6377e1097c7933fd22 Bug: webrtc:251890128 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/469400 Commit-Queue: Jeremy Leconte <jleconte@google.com> Reviewed-by: Danil Chapovalov <danilchap@webrtc.org> Cr-Commit-Position: refs/heads/main@{#47597}
diff --git a/p2p/BUILD.gn b/p2p/BUILD.gn index a3993ad..f9f3e0f 100644 --- a/p2p/BUILD.gn +++ b/p2p/BUILD.gn
@@ -989,6 +989,7 @@ "../rtc_base:async_packet_socket", "../rtc_base:checks", "../rtc_base:ip_address", + "../rtc_base:net_helpers", "../rtc_base:net_test_helpers", "../rtc_base:network", "../rtc_base:socket_factory",
diff --git a/p2p/test/fake_port_allocator.h b/p2p/test/fake_port_allocator.h index 8e27df9..8e473ff 100644 --- a/p2p/test/fake_port_allocator.h +++ b/p2p/test/fake_port_allocator.h
@@ -32,6 +32,7 @@ #include "rtc_base/async_packet_socket.h" #include "rtc_base/checks.h" #include "rtc_base/ip_address.h" +#include "rtc_base/net_helpers.h" #include "rtc_base/net_test_helpers.h" #include "rtc_base/network.h" #include "rtc_base/socket_factory.h" @@ -109,14 +110,14 @@ allocator_(allocator), network_thread_(network_thread), factory_(factory), - ipv4_network_("network", "unittest", IPAddress(INADDR_LOOPBACK), 32), - ipv6_network_("network", "unittest", IPAddress(in6addr_loopback), 64), + ipv4_network_("network", "unittest", GetLoopbackIP(AF_INET), 32), + ipv6_network_("network", "unittest", GetLoopbackIP(AF_INET6), 64), port_(), port_config_count_(0), stun_servers_(allocator->stun_servers()), turn_servers_(allocator->turn_servers()) { - ipv4_network_.AddIP(IPAddress(INADDR_LOOPBACK)); - ipv6_network_.AddIP(IPAddress(in6addr_loopback)); + ipv4_network_.AddIP(GetLoopbackIP(AF_INET)); + ipv6_network_.AddIP(GetLoopbackIP(AF_INET6)); } void SetCandidateFilter(uint32_t filter) override {