From 0baedb1254ccfa1e0d3607867440f26d430e0ea4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=90=E6=9D=B0?= Date: Wed, 18 Oct 2023 09:27:36 +0000 Subject: [PATCH] =?UTF-8?q?innerapi=20AddNetworkRoute=20Signed-off-by:=20?= =?UTF-8?q?=E5=BE=90=E6=9D=B0=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../wifi_manage/wifi_net_agent.cpp | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_net_agent.cpp b/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_net_agent.cpp index c1b8db7a4..caf9de8f1 100644 --- a/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_net_agent.cpp +++ b/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_net_agent.cpp @@ -130,24 +130,9 @@ bool WifiNetAgent::AddRoute(const std::string interface, const std::string ipAdd std::string strLocalRoute = IpTools::ConvertIpv4Address(ipInt & maskInt); std::string destAddress = strLocalRoute + "/" + std::to_string(prefixLength); - auto samgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); - if (samgr == nullptr) { - LOGE("GetSystemAbilityManager failed!"); - return false; - } - auto remote = samgr->GetSystemAbility(COMM_NETSYS_NATIVE_SYS_ABILITY_ID); - if (remote == nullptr) { - LOGE("GetSystemAbility failed!"); - return false; - } - OHOS::sptr netsysService = iface_cast(remote); - if (netsysService == nullptr) { - LOGE("NetdService is nullptr!"); - return false; - } LOGI("Add route, interface: %{public}s, destAddress: %{public}s, ipAddress: %{public}s, prefixLength: %{public}d", interface.c_str(), IpAnonymize(destAddress).c_str(), IpAnonymize(ipAddress).c_str(), prefixLength); - netsysService->NetworkAddRoute(OHOS::nmd::LOCAL_NETWORK_NETID, interface, destAddress, ipAddress); + NetConnClient::GetInstance().AddNetworkRoute(OHOS::nmd::LOCAL_NETWORK_NETID, interface, destAddress, ipAddress); LOGI("NetAgent add route finish"); return true; } -- Gitee