Merge pull request !3356 from zhangqin88/OpenHarmony-5.0.1-Release
This commit is contained in:
openharmony_ci 2024-11-22 11:00:46 +00:00 committed by Gitee
commit faa7fc8db8
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
10 changed files with 64 additions and 59 deletions

View File

@ -126,7 +126,6 @@ public:
/**
* @Description set tx power for sar
*
* @param power - 1001 1002 1003······
* @return ErrCode - operation result
*/

View File

@ -557,7 +557,7 @@ public:
*
* @param uid - target app uid
* @param protocol - target protocol type
* @return enable - enable/disable dpi mark
* @param enable - enable/disable dpi mark
*/
ErrCode SetDpiMarkRule(const std::string &ifaceName, int uid, int protocol, int enable) override;
#ifdef OHOS_ARCH_LITE

View File

@ -292,33 +292,30 @@ void WifiNetAgent::SetNetLinkIPInfo(sptr<NetManagerStandard::NetLinkInfo> &netLi
netAddr->prefixlen_ = prefixLength;
netLinkInfo->netAddrList_.push_back(*netAddr);
LOGD("SetNetLinkIPInfo %{public}s", wifiIpV6Info.globalIpV6Address.c_str());
sptr<NetManagerStandard::INetAddr> netIpv6Addr = nullptr;
sptr<NetManagerStandard::INetAddr> netIpv6Addr = (std::make_unique<NetManagerStandard::INetAddr>()).release();
netIpv6Addr->type_ = NetManagerStandard::INetAddr::IPV6;
netIpv6Addr->family_ = NetManagerStandard::INetAddr::IPV6;
netIpv6Addr->netMask_ = wifiIpV6Info.netmask;
netIpv6Addr->prefixlen_ = 0;
if (!wifiIpV6Info.globalIpV6Address.empty()) {
netIpv6Addr = (std::make_unique<NetManagerStandard::INetAddr>()).release();
netIpv6Addr->address_ = wifiIpV6Info.globalIpV6Address;
}
LOGD("SetNetLinkIPInfo randGlobalIpV6Address:%{public}s", wifiIpV6Info.randGlobalIpV6Address.c_str());
if (!wifiIpV6Info.randGlobalIpV6Address.empty()) {
netIpv6Addr = (std::make_unique<NetManagerStandard::INetAddr>()).release();
netIpv6Addr->address_ = wifiIpV6Info.randGlobalIpV6Address;
}
LOGD("SetNetLinkIPInfo uniqueLocalAddress1:%{public}s", wifiIpV6Info.uniqueLocalAddress1.c_str());
if (!wifiIpV6Info.uniqueLocalAddress1.empty()) {
netIpv6Addr = (std::make_unique<NetManagerStandard::INetAddr>()).release();
netIpv6Addr->address_ = wifiIpV6Info.uniqueLocalAddress1;
}
LOGD("SetNetLinkIPInfo uniqueLocalAddress2:%{public}s", wifiIpV6Info.uniqueLocalAddress2.c_str());
if (!wifiIpV6Info.uniqueLocalAddress2.empty()) {
netIpv6Addr = (std::make_unique<NetManagerStandard::INetAddr>()).release();
netIpv6Addr->address_ = wifiIpV6Info.uniqueLocalAddress2;
}
if (netIpv6Addr != nullptr) {
netIpv6Addr->type_ = NetManagerStandard::INetAddr::IPV6;
netIpv6Addr->family_ = NetManagerStandard::INetAddr::IPV6;
netIpv6Addr->netMask_ = wifiIpV6Info.netmask;
netIpv6Addr->prefixlen_ = 0;
netLinkInfo->netAddrList_.push_back(*netIpv6Addr);
LOGI("SetNetLinkIPInfo globalIpv6:%{public}s", MacAnonymize(wifiIpV6Info.globalIpV6Address).c_str());
}
if (!wifiIpV6Info.randGlobalIpV6Address.empty()) {
netIpv6Addr->address_ = wifiIpV6Info.randGlobalIpV6Address;
netLinkInfo->netAddrList_.push_back(*netIpv6Addr);
LOGI("SetNetLinkIPInfo randGlobalIpv6:%{public}s", MacAnonymize(wifiIpV6Info.randGlobalIpV6Address).c_str());
}
if (!wifiIpV6Info.uniqueLocalAddress1.empty()) {
netIpv6Addr->address_ = wifiIpV6Info.uniqueLocalAddress1;
netLinkInfo->netAddrList_.push_back(*netIpv6Addr);
LOGI("SetNetLinkIPInfo LocalIpv6:%{public}s", MacAnonymize(wifiIpV6Info.uniqueLocalAddress1).c_str());
}
if (!wifiIpV6Info.uniqueLocalAddress2.empty()) {
netIpv6Addr->address_ = wifiIpV6Info.uniqueLocalAddress2;
netLinkInfo->netAddrList_.push_back(*netIpv6Addr);
LOGI("SetNetLinkIPInfo randLocalIpv6:%{public}s", MacAnonymize(wifiIpV6Info.uniqueLocalAddress2).c_str());
}
}
@ -344,10 +341,12 @@ void WifiNetAgent::SetNetLinkDnsInfo(sptr<NetManagerStandard::NetLinkInfo> &netL
if (!wifiIpV6Info.primaryDns.empty()) {
ipv6dns->address_ = wifiIpV6Info.primaryDns;
netLinkInfo->dnsList_.push_back(*ipv6dns);
LOGI("SetNetLinkDnsInfo ipv6:%{public}s", MacAnonymize(wifiIpV6Info.primaryDns).c_str());
}
if (!wifiIpV6Info.secondDns.empty()) {
ipv6dns->address_ = wifiIpV6Info.secondDns;
netLinkInfo->dnsList_.push_back(*ipv6dns);
LOGI("SetNetLinkDnsInfo ipv6:%{public}s", MacAnonymize(wifiIpV6Info.secondDns).c_str());
}
}
@ -435,6 +434,16 @@ void WifiNetAgent::InitWifiNetAgent(const WifiNetAgentCallbacks &wifiNetAgentCal
wifiNetAgentCallbacks_ = wifiNetAgentCallbacks;
}
void WifiNetAgent::ResetSupplierId()
{
supplierId = INVALID_SUPPLIER_ID;
}
uint32_t WifiNetAgent::GetSupplierId()
{
return supplierId;
}
bool WifiNetAgent::RequestNetwork(const int uid, const int networkId)
{
if (!wifiNetAgentCallbacks_.OnRequestNetwork) {
@ -454,16 +463,6 @@ WifiNetAgent::NetConnCallback::NetConnCallback()
WifiNetAgent::NetConnCallback::~NetConnCallback()
{}
void WifiNetAgent::ResetSupplierId()
{
supplierId = INVALID_SUPPLIER_ID;
}
uint32_t WifiNetAgent::GetSupplierId()
{
return supplierId;
}
int32_t WifiNetAgent::NetConnCallback::RequestNetwork(
const std::string &ident, const std::set<NetManagerStandard::NetCap> &netCaps,
const NetManagerStandard::NetRequest &netrequest)

View File

@ -48,6 +48,7 @@ config("wifi_fw_common_header") {
include_dirs += [
"//base/hiviewdfx/hilog_lite/interfaces/native/innerkits",
"//third_party/bounds_checking_function/include",
"//third_party/wpa_supplicant/wpa_supplicant-2.9/src",
]
}
}
@ -144,6 +145,7 @@ if (defined(ohos_lite)) {
ldflags += [
"-fPIC",
"-Wl,-E",
"-Iwpa_client",
]
}
} else {

View File

@ -13,6 +13,13 @@
* limitations under the License.
*/
#include <unistd.h>
#include <net/if.h>
#include <sys/ioctl.h>
#include <sys/socket.h>
#include <pthread.h>
#include "securec.h"
#include "wifi_hdi_common.h"
@ -334,9 +341,6 @@ static int HdiRsnKeyMgmtToAuthMgmt(const uint8_t *s)
if (HDI_GET_RSN_ID(s) == HDI_RSN_AUTH_KEY_MGMT_FT_SAE) {
return HDI_KEY_MGMT_FT_SAE;
}
if (HDI_GET_RSN_ID(s) == HDI_RSN_AUTH_KEY_MGMT_SHA256) {
return HDI_KEY_MGMT_IEEE8021X_SHA256;
}
return 0;
}
@ -551,7 +555,7 @@ int HdiConvertIeRsn(const uint8_t *rsnIe, size_t rsnIeLen,
data->hasGroup = 1;
if (!HdiCheckValidGroup(data->groupCipher)) {
LOGI("invalid group cipher 0x%{public}x (%08x)", data->groupCipher,
HdiGetBe32(pos));
HdiGetBe32(pos));
return -1;
}
pos += HDI_SELECTOR_LEN;
@ -628,7 +632,7 @@ int HdiParseIe(const uint8_t *hdiIe, size_t wpaIeLen,
{
if (wpaIeLen >= HDI_POS_FIRST && hdiIe[0] == HDI_EID_RSN) {
return HdiConvertIeRsn(hdiIe, wpaIeLen, data);
}
}
if (wpaIeLen >= HDI_POS_SIX && hdiIe[0] == HDI_EID_VENDOR_SPECIFIC &&
hdiIe[1] >= HDI_POS_FOURTH && HdiGetBe32(&hdiIe[HDI_POS_SECOND]) == HDI_OSEN_IE_VENDOR_TYPE) {
return HdiConvertIeRsn(hdiIe, wpaIeLen, data);
@ -673,7 +677,6 @@ char* HdiGetIeTxt(char *pos, char *end, const char *proto,
HDI_HANDLE_CIPHER_POS_INFO(data.keyMgmt & HDI_KEY_MGMT_FT_IEEE8021X, ret, pos, end, "+", "%sFT/EAP");
HDI_HANDLE_CIPHER_POS_INFO(data.keyMgmt & HDI_KEY_MGMT_FT_PSK, ret, pos, end, "+", "%sFT/PSK");
HDI_HANDLE_CIPHER_POS_INFO(data.keyMgmt & HDI_KEY_MGMT_FT_SAE, ret, pos, end, "+", "%sFT/SAE");
HDI_HANDLE_CIPHER_POS_INFO(data.keyMgmt & HDI_KEY_MGMT_IEEE8021X_SHA256, ret, pos, end, "+", "%sEAP");
pos = HdiGetCipherTxt(pos, end, data.pairwiseCipher);

View File

@ -204,6 +204,7 @@ static void HdiWpaResetGlobalObj()
g_wpaObj = NULL;
if (g_devMgr != NULL) {
g_devMgr->UnloadDevice(g_devMgr, HDI_WPA_SERVICE_NAME);
HDIDeviceManagerRelease(g_devMgr);
g_devMgr = NULL;
}
ClearIfaceName();
@ -591,6 +592,7 @@ static void HdiApResetGlobalObj()
g_apObj = NULL;
if (g_apDevMgr != NULL) {
g_apDevMgr->UnloadDevice(g_apDevMgr, HDI_AP_SERVICE_NAME);
HDIDeviceManagerRelease(g_apDevMgr);
g_apDevMgr = NULL;
}
pthread_mutex_unlock(&g_apObjMutex);
@ -679,7 +681,7 @@ static WifiErrorNo StartApHdi(int id, const char *ifaceName)
int32_t ret = g_apObj->StartApWithCmd(g_apObj, ifaceName, id);
if (ret != HDF_SUCCESS) {
LOGE("%{public}s Start failed: %{public}d", __func__, ret);
IHostapdInterfaceGetInstance(HDI_AP_SERVICE_NAME, false);
IHostapdInterfaceGetInstance(HDI_AP_SERVICE_NAME, g_apObj, false);
g_apObj = NULL;
if (g_apDevMgr != NULL) {
g_apDevMgr->UnloadDevice(g_apDevMgr, HDI_AP_SERVICE_NAME);

View File

@ -27,6 +27,7 @@
#include "wifi_supplicant_hal_interface.h"
#include "servmgr_hdi.h"
#include "hdf_remote_service.h"
#include "wifi_config_center.h"
#undef LOG_TAG
#define LOG_TAG "HalDeviceManager"
@ -59,6 +60,14 @@ bool HalDeviceManager::StartChipHdi()
{
std::lock_guard<std::mutex> lock(mMutex);
LOGI("StartChipHdi start...");
if (g_IWifi != nullptr) {
bool isInit = false;
g_IWifi->IsInit(isInit);
if (isInit) {
LOGI("has start");
return true;
}
}
g_IWifi = IChipController::Get(CHIP_SERVICE_NAME, false);
CHECK_NULL_AND_RETURN(g_IWifi, false);
@ -656,7 +665,6 @@ int32_t HalDeviceManager::IfaceSetTxPower(
LOGI("can not find iface:%{public}s", ifaceName.c_str());
return result;
}
bool HalDeviceManager::GetPowerModel(const std::string &ifaceName, int &model)
{
if (!CheckReloadChipHdiService()) {
@ -755,11 +763,6 @@ bool HalDeviceManager::SetApMacAddress(const std::string &ifaceName, const std::
void HalDeviceManager::ResetHalDeviceManagerInfo()
{
std::lock_guard<std::mutex> lock(mMutex);
WifiP2PHalInterface::GetInstance().StopP2p();
WifiStaHalInterface::GetInstance().StopWifi();
WifiApHalInterface::GetInstance().StopAp();
ClearStaInfo();
ClearApInfo();
g_chipControllerCallback = nullptr;
g_chipIfaceCallback = nullptr;
g_IWifi = nullptr;
@ -1465,7 +1468,6 @@ void HalDeviceManager::AddChipHdiDeathRecipient()
.OnRemoteDied = [](HdfDeathRecipient *recipient, HdfRemoteService *service) {
LOGI("Chip Hdi service died!");
g_chipHdiServiceDied = true;
ResetHalDeviceManagerInfo();
RemoveChipHdiDeathRecipient();
return;
}

View File

@ -481,6 +481,7 @@ void SelfCureStateMachine::ConnectedMonitorState::HandleInternetFailedDetected(I
WIFI_LOGI("current network do not need selfcure");
return;
}
if (!pSelfCureStateMachine->IsSuppOnCompletedState()) {
WIFI_LOGI("%{public}s: Wifi connection not completed", __FUNCTION__);
return;
@ -503,9 +504,6 @@ void SelfCureStateMachine::ConnectedMonitorState::HandleInternetFailedDetected(I
}
if (!pSelfCureStateMachine->staticIpCureSuccess && msg->GetParam2() == 1) {
if (hasInternetRecently || portalUnthenEver || pSelfCureStateMachine->internetUnknown) {
if (pSelfCureStateMachine->IsCustNetworkSelfCure()) {
return;
}
pSelfCureStateMachine->selfCureReason = WIFI_CURE_INTERNET_FAILED_TYPE_DNS;
TransitionToSelfCureState(WIFI_CURE_INTERNET_FAILED_TYPE_DNS);
return;
@ -1728,6 +1726,9 @@ void SelfCureStateMachine::InternetSelfCureState::HandleSelfCureFailedForRandMac
pSelfCureStateMachine->selfCureOnGoing = false;
pSelfCureStateMachine->useWithRandMacAddress = 0;
pSelfCureStateMachine->SetIsReassocWithFactoryMacAddress(0);
if (pSelfCureStateMachine->IsCustNetworkSelfCure()) {
return;
}
pSelfCureStateMachine->SendMessage(WIFI_CURE_CMD_INTERNET_FAILED_SELF_CURE, WIFI_CURE_INTERNET_FAILED_TYPE_DNS);
return;
}

View File

@ -207,7 +207,7 @@ bool WifiCommonEventHelper::PublishSelfcureStateChangedEvent(const int &pid, con
CommonEventData commonData;
commonData.SetWant(want);
std::vector<std::string> permissions;
permissions.push_back(COMMON_EVENT_SET_WIFI_CONFIG_PERMISSION);
permissions.push_back(COMMON_EVENT_GET_WIFI_INFO_PERMISSION);
CommonEventPublishInfo publishInfo;
publishInfo.SetSubscriberPermissions(permissions);
if (!CommonEventManager::PublishCommonEvent(commonData, publishInfo)) {

View File

@ -39,14 +39,11 @@ inline const std::string COMMON_EVENT_WIFI_P2P_PEERS_STATE_CHANGED =
"usual.event.wifi.p2p.DEVICES_CHANGE";
inline const std::string COMMON_EVENT_WIFI_P2P_PEERS_DISCOVERY_STATE_CHANGED =
"usual.event.wifi.p2p.PEER_DISCOVERY_STATE_CHANGE";
inline const std::string COMMON_EVENT_WIFI_P2P_CURRENT_DEVICE_STATE_CHANGED =
"usual.event.wifi.p2p.CURRENT_DEVICE_CHANGE";
inline const std::string COMMON_EVENT_WIFI_P2P_GROUP_STATE_CHANGED = "usual.event.wifi.p2p.GROUP_STATE_CHANGED";
const std::string COMMON_EVENT_WIFI_P2P_CURRENT_DEVICE_STATE_CHANGED = "usual.event.wifi.p2p.CURRENT_DEVICE_CHANGE";
const std::string COMMON_EVENT_WIFI_P2P_GROUP_STATE_CHANGED = "usual.event.wifi.p2p.GROUP_STATE_CHANGED";
inline const std::string COMMON_EVENT_WIFI_SELF_CURE_STATE_CHANGED = "usual.event.wifi.selfcure.STATE_CHANGED";
inline const std::string COMMON_EVENT_SET_WIFI_CONFIG_PERMISSION = "ohos.permission.SET_WIFI_INFO";
inline const std::string COMMON_EVENT_GET_WIFI_INFO_PERMISSION = "ohos.permission.GET_WIFI_INFO";
inline const std::string COMMON_EVENT_MANAGE_WIFI_CONNECTION_PERMISSION = "ohos.permission.MANAGE_WIFI_CONNECTION";
class WifiCommonEventHelper {
public:
static bool PublishEvent(const std::string &eventAction, const int &code, const std::string &data,