From b8d938967307cc0855968d4de8ee54a25502a793 Mon Sep 17 00:00:00 2001 From: Francis Tsui Date: Mon, 15 Dec 2025 14:39:00 -0800 Subject: [PATCH] Deprecate enable_ipv6_dual_stack flag. PiperOrigin-RevId: 844925341 --- .../flags/nearby_platform_feature_flags.h | 4 ---- .../platform/implementation/windows/wifi_direct.h | 2 +- .../implementation/windows/wifi_direct_medium.cc | 10 ++-------- .../windows/wifi_direct_server_socket.cc | 4 ++-- .../implementation/windows/wifi_hotspot_medium.cc | 10 ++-------- .../windows/wifi_hotspot_server_socket.cc | 4 ++-- .../windows/wifi_hotspot_server_socket.h | 2 +- .../platform/implementation/windows/wifi_lan.h | 2 +- .../implementation/windows/wifi_lan_medium.cc | 15 +++------------ .../windows/wifi_lan_server_socket.cc | 4 ++-- 10 files changed, 16 insertions(+), 41 deletions(-) diff --git a/internal/platform/flags/nearby_platform_feature_flags.h b/internal/platform/flags/nearby_platform_feature_flags.h index b760aa4b..6859c9ba 100644 --- a/internal/platform/flags/nearby_platform_feature_flags.h +++ b/internal/platform/flags/nearby_platform_feature_flags.h @@ -65,10 +65,6 @@ constexpr auto kEnableHotspotDhcpRenew = constexpr auto kEnableIntelPieSdk = flags::Flag(kConfigPackage, "45428547", false); -// Enable/Disable IPv6 dual stack support on Windows. -constexpr auto kEnableIpv6DualStack = - flags::Flag(kConfigPackage, "45733519", false); - // Enable/Disable use of IPv6 address from mDNS on Windows. constexpr auto kEnableMdnsIpv6 = flags::Flag(kConfigPackage, "45735181", false); diff --git a/internal/platform/implementation/windows/wifi_direct.h b/internal/platform/implementation/windows/wifi_direct.h index 094d43a4..6314e0df 100644 --- a/internal/platform/implementation/windows/wifi_direct.h +++ b/internal/platform/implementation/windows/wifi_direct.h @@ -160,7 +160,7 @@ class WifiDirectServerSocket : public api::WifiDirectServerSocket { void SetIPAddress(std::string ip_address); // Binds to local port - bool Listen(int port, bool dual_stack); + bool Listen(int port); private: // Retrieves WifiDirect GO IP address from local machine diff --git a/internal/platform/implementation/windows/wifi_direct_medium.cc b/internal/platform/implementation/windows/wifi_direct_medium.cc index 201e5d18..b515b2cb 100644 --- a/internal/platform/implementation/windows/wifi_direct_medium.cc +++ b/internal/platform/implementation/windows/wifi_direct_medium.cc @@ -126,10 +126,7 @@ std::unique_ptr WifiDirectMedium::ConnectToService( return nullptr; } - bool dual_stack = NearbyFlags::GetInstance().GetBoolFlag( - platform::config_package_nearby::nearby_platform_feature:: - kEnableIpv6DualStack); - SocketAddress server_address(dual_stack); + SocketAddress server_address(/*dual_stack=*/true); if (!server_address.FromString(server_address, remote_ip_address, port)) { LOG(ERROR) << "no valid service address and port to connect."; return nullptr; @@ -219,9 +216,6 @@ std::unique_ptr WifiDirectMedium::ListenForService( // thread to avoid blocking BWU sending out of band upgrade frame to GC. listener_executor_.Execute([this, port]() mutable { absl::MutexLock lock(mutex_); - bool dual_stack = NearbyFlags::GetInstance().GetBoolFlag( - platform::config_package_nearby::nearby_platform_feature:: - kEnableIpv6DualStack); if (ip_address_local_.empty()) { if (server_socket_ptr_) { LOG(INFO) << "Waiting for IP address is ready."; @@ -247,7 +241,7 @@ std::unique_ptr WifiDirectMedium::ListenForService( port = FeatureFlags::GetInstance().GetFlags().wifi_direct_default_port; } if (server_socket_ptr_ && - server_socket_ptr_->Listen(port, dual_stack)) { + server_socket_ptr_->Listen(port)) { medium_status_ |= kMediumStatusAccepting; // Setup close notifier after listen started. diff --git a/internal/platform/implementation/windows/wifi_direct_server_socket.cc b/internal/platform/implementation/windows/wifi_direct_server_socket.cc index 95e384da..b6ed7ee8 100644 --- a/internal/platform/implementation/windows/wifi_direct_server_socket.cc +++ b/internal/platform/implementation/windows/wifi_direct_server_socket.cc @@ -107,10 +107,10 @@ Exception WifiDirectServerSocket::Close() { return {Exception::kSuccess}; } -bool WifiDirectServerSocket::Listen(int port, bool dual_stack) { +bool WifiDirectServerSocket::Listen(int port) { LOG(INFO) << "Listen wifi_direct on IP:port " << wifi_direct_ipaddr_ << ":" << port; - SocketAddress address(dual_stack); + SocketAddress address(/*dual_stack=*/true); if (!SocketAddress::FromString(address, wifi_direct_ipaddr_, port)) { LOG(ERROR) << "Failed to parse wifi_direct IP address."; return false; diff --git a/internal/platform/implementation/windows/wifi_hotspot_medium.cc b/internal/platform/implementation/windows/wifi_hotspot_medium.cc index e81d77af..c663c3a1 100644 --- a/internal/platform/implementation/windows/wifi_hotspot_medium.cc +++ b/internal/platform/implementation/windows/wifi_hotspot_medium.cc @@ -91,10 +91,7 @@ std::unique_ptr WifiHotspotMedium::ConnectToService( return nullptr; } - bool dual_stack = NearbyFlags::GetInstance().GetBoolFlag( - platform::config_package_nearby::nearby_platform_feature:: - kEnableIpv6DualStack); - SocketAddress server_address(dual_stack); + SocketAddress server_address(/*dual_stack=*/true); if (!server_address.FromBytes(server_address, service_address.address, service_address.port)) { LOG(ERROR) << "no valid service address and port to connect."; @@ -152,10 +149,7 @@ WifiHotspotMedium::ListenForService(int port) { auto server_socket = std::make_unique(); server_socket_ptr_ = server_socket.get(); - bool dual_stack = NearbyFlags::GetInstance().GetBoolFlag( - platform::config_package_nearby::nearby_platform_feature:: - kEnableIpv6DualStack); - if (server_socket->Listen(port, dual_stack)) { + if (server_socket->Listen(port)) { medium_status_ |= kMediumStatusAccepting; // Setup close notifier after listen started. diff --git a/internal/platform/implementation/windows/wifi_hotspot_server_socket.cc b/internal/platform/implementation/windows/wifi_hotspot_server_socket.cc index 3cdd3f23..9dbbef0a 100644 --- a/internal/platform/implementation/windows/wifi_hotspot_server_socket.cc +++ b/internal/platform/implementation/windows/wifi_hotspot_server_socket.cc @@ -137,8 +137,8 @@ void WifiHotspotServerSocket::PopulateHotspotCredentials( hotspot_credentials.SetAddressCandidates(std::move(service_addresses)); } -bool WifiHotspotServerSocket::Listen(int port, bool dual_stack) { - SocketAddress address(dual_stack); +bool WifiHotspotServerSocket::Listen(int port) { + SocketAddress address(/*dual_stack=*/true); // Allow server socket to listen on all interfaces. // Consider sharing the same server socket for WifiLan medium. SocketAddress::FromString(address, "", port); diff --git a/internal/platform/implementation/windows/wifi_hotspot_server_socket.h b/internal/platform/implementation/windows/wifi_hotspot_server_socket.h index 5fc90d44..61d4fa0d 100644 --- a/internal/platform/implementation/windows/wifi_hotspot_server_socket.h +++ b/internal/platform/implementation/windows/wifi_hotspot_server_socket.h @@ -76,7 +76,7 @@ class WifiHotspotServerSocket : public api::WifiHotspotServerSocket { HotspotCredentials& hotspot_credentials) override; // Binds to local port - bool Listen(int port, bool dual_stack); + bool Listen(int port); private: // Retrieves hotspot IP address from local machine diff --git a/internal/platform/implementation/windows/wifi_lan.h b/internal/platform/implementation/windows/wifi_lan.h index 71004d39..f47240fd 100644 --- a/internal/platform/implementation/windows/wifi_lan.h +++ b/internal/platform/implementation/windows/wifi_lan.h @@ -141,7 +141,7 @@ class WifiLanServerSocket : public api::WifiLanServerSocket { } // Binds to local port - bool Listen(int port, bool dual_stack); + bool Listen(int port); private: NearbyServerSocket server_socket_; diff --git a/internal/platform/implementation/windows/wifi_lan_medium.cc b/internal/platform/implementation/windows/wifi_lan_medium.cc index 39b084ed..85d26f49 100644 --- a/internal/platform/implementation/windows/wifi_lan_medium.cc +++ b/internal/platform/implementation/windows/wifi_lan_medium.cc @@ -347,10 +347,7 @@ std::unique_ptr WifiLanMedium::ConnectToService( const ServiceAddress& service_address, CancellationFlag* cancellation_flag) { LOG(INFO) << "ConnectToService is called."; - bool dual_stack = NearbyFlags::GetInstance().GetBoolFlag( - platform::config_package_nearby::nearby_platform_feature:: - kEnableIpv6DualStack); - SocketAddress server_address(dual_stack); + SocketAddress server_address(/*dual_stack=*/true); if (!server_address.FromServiceAddress(server_address, service_address)) { LOG(ERROR) << "no valid service address and port to connect."; return nullptr; @@ -404,10 +401,7 @@ std::unique_ptr WifiLanMedium::ListenForService( std::make_unique(); WifiLanServerSocket* server_socket_ptr = server_socket.get(); - bool dual_stack = NearbyFlags::GetInstance().GetBoolFlag( - platform::config_package_nearby::nearby_platform_feature:: - kEnableIpv6DualStack); - if (server_socket->Listen(port, dual_stack)) { + if (server_socket->Listen(port)) { int port = server_socket_ptr->GetPort(); LOG(INFO) << "started to listen serive on port: " << port; port_to_server_socket_map_.insert({port, server_socket_ptr}); @@ -705,10 +699,7 @@ bool WifiLanMedium::IsConnectableIpAddress(NsdServiceInfo& nsd_service_info, absl::Duration timeout) { std::string ipv4_address = nsd_service_info.GetIPAddress(); if (!ipv4_address.empty()) { - bool dual_stack = NearbyFlags::GetInstance().GetBoolFlag( - platform::config_package_nearby::nearby_platform_feature:: - kEnableIpv6DualStack); - SocketAddress service_address(dual_stack); + SocketAddress service_address(/*dual_stack=*/true); if (SocketAddress::FromBytes(service_address, ipv4_address, nsd_service_info.GetPort())) { if (TestConnection(service_address, timeout)) { diff --git a/internal/platform/implementation/windows/wifi_lan_server_socket.cc b/internal/platform/implementation/windows/wifi_lan_server_socket.cc index 87409184..db293223 100644 --- a/internal/platform/implementation/windows/wifi_lan_server_socket.cc +++ b/internal/platform/implementation/windows/wifi_lan_server_socket.cc @@ -59,9 +59,9 @@ std::unique_ptr WifiLanServerSocket::Accept() { return std::make_unique(std::move(client_socket)); } -bool WifiLanServerSocket::Listen(int port, bool dual_stack) { +bool WifiLanServerSocket::Listen(int port) { // Listen on all interfaces. - SocketAddress address(dual_stack); + SocketAddress address(/*dual_stack=*/true); SocketAddress::FromString(address, "", port); if (!server_socket_.Listen(address)) { LOG(ERROR) << "Failed to listen socket at port:" << port;