diff --git a/dhcp/services/dhcp_server/include/dhcp_logger.h b/dhcp/services/dhcp_server/include/dhcp_logger.h index 1aa88200303d07ba8994a16a6a53e18580cc8d15..9176e985da91e90886f2a639b550bcc15650314a 100644 --- a/dhcp/services/dhcp_server/include/dhcp_logger.h +++ b/dhcp/services/dhcp_server/include/dhcp_logger.h @@ -27,7 +27,7 @@ #define LOG_TAG "DhcpServer" #undef LOG_DOMAIN -#define LOG_DOMAIN 0x0000000 +#define LOG_DOMAIN 0xD001560 #define LOGD(...) ((void)HiLogPrint(LOG_CORE, LOG_DEBUG, LOG_DOMAIN, LOG_TAG, __VA_ARGS__)) diff --git a/dhcp/services/dhcp_server/src/dhcp_dhcpd.c b/dhcp/services/dhcp_server/src/dhcp_dhcpd.c index 6c80d69d949ecaea534e710fb0139b03cff5b052..3aaac43c4abe826188a28d820fc45aa6963847b6 100644 --- a/dhcp/services/dhcp_server/src/dhcp_dhcpd.c +++ b/dhcp/services/dhcp_server/src/dhcp_dhcpd.c @@ -92,6 +92,9 @@ static int InitNetworkAbout(DhcpConfig *config) LOGE("error gateway argument."); return RET_FAILED; } + } else { + config->gateway = config->serverId; + LOGW("InitNetworkAbout, set gateway to serverId as default."); } return RET_SUCCESS; } @@ -146,10 +149,9 @@ static int InitAddressRange(DhcpConfig *config) static int InitDomainNameServer(DhcpConfig *config) { + DhcpOption argOpt = {DOMAIN_NAME_SERVER_OPTION, 0, {0}}; ArgumentInfo *arg = GetArgument("dns"); if (arg) { - DhcpOption argOpt = {DOMAIN_NAME_SERVER_OPTION, 0, {0}}; - char *pSave = NULL; char *pTok = strtok_r(arg->value, ",", &pSave); if ((pTok == NULL) || (strlen(pTok) == 0)) { @@ -164,15 +166,21 @@ static int InitDomainNameServer(DhcpConfig *config) } if (AppendAddressOption(&argOpt, dnsAddress) != RET_SUCCESS) { LOGW("failed to append dns option."); - }; + } pTok = strtok_r(NULL, ",", &pSave); } - - if (GetOption(&config->options, argOpt.code) != NULL) { - RemoveOption(&config->options, DOMAIN_NAME_SERVER_OPTION); + } else { + LOGW("%{public}s, set dns to serverId as default.", __func__); + uint32_t dnsAddress = config->serverId; + if (AppendAddressOption(&argOpt, dnsAddress) != RET_SUCCESS) { + LOGW("failed to append dns option."); } - PushBackOption(&config->options, &argOpt); } + + if (GetOption(&config->options, argOpt.code) != NULL) { + RemoveOption(&config->options, DOMAIN_NAME_SERVER_OPTION); + } + PushBackOption(&config->options, &argOpt); return RET_SUCCESS; } @@ -343,7 +351,7 @@ static int InitializeDhcpConfig(const char *ifname, DhcpConfig *config) return RET_FAILED; } } - LOGD("load local config file:%s", configFile); + LOGD("load local dhcp config file:%s", configFile); if (LoadConfig(configFile, ifname, config) != RET_SUCCESS) { LOGE("failed to load configure file."); return RET_FAILED; diff --git a/dhcp/services/mgr_service/src/dhcp_server_service.cpp b/dhcp/services/mgr_service/src/dhcp_server_service.cpp index 743f0b429a3f63c544c1b78db132434811fc99fb..4d85f421582adabaf2775124b1e96d6bd7b0fb1a 100644 --- a/dhcp/services/mgr_service/src/dhcp_server_service.cpp +++ b/dhcp/services/mgr_service/src/dhcp_server_service.cpp @@ -314,6 +314,7 @@ int DhcpServerService::SetDhcpRange(const std::string &ifname, const std::string WIFI_LOGE("SetDhcpRange tag m_mapTagDhcpRange no find tagName:%{public}s.", tagName.c_str()); return DHCP_OPT_FAILED; } + int nSize = (int)iterTag->second.size(); if (nSize != 1) { WIFI_LOGE("SetDhcpRange tag %{public}s range size:%{public}d error.", tagName.c_str(), nSize); diff --git a/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_sta/sta_saved_device_appraisal.cpp b/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_sta/sta_saved_device_appraisal.cpp index 2f81222fd021fee3f95ef38341c5a413b00ffc1e..ca79bfdd5218446ac4200c65384615dbc7d3daff 100644 --- a/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_sta/sta_saved_device_appraisal.cpp +++ b/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_sta/sta_saved_device_appraisal.cpp @@ -15,6 +15,7 @@ #include "sta_saved_device_appraisal.h" #include "wifi_logger.h" #include "wifi_settings.h" +#include "wifi_common_util.h" DEFINE_WIFILOG_LABEL("StaSavedDeviceAppraisal"); @@ -65,8 +66,8 @@ ErrCode StaSavedDeviceAppraisal::DeviceAppraisals( int score = 0; AppraiseDeviceQuality(score, scanInfo, device, info); - WIFI_LOGI("The device %{public}s score is %{public}d.rssi is %{public}d.\n", - scanInfo.ssid.c_str(), score, scanInfo.rssi); + WIFI_LOGI("The device networkId:%{public}d ssid:%{public}s score is %{public}d, rssi is %{public}d.", + device.networkId, SsidAnonymize(scanInfo.ssid).c_str(), score, scanInfo.rssi); if (score > highestScore || (score == highestScore && scanInfo.rssi > scanInfoElected.rssi)) { highestScore = score; @@ -78,6 +79,9 @@ ErrCode StaSavedDeviceAppraisal::DeviceAppraisals( } } if (sign == 1) { + WIFI_LOGI("DeviceAppraisals, Selected device, networkId:%{public}d, ssid:%{public}s, bssid:%{public}s.", + electedDevice.networkId, SsidAnonymize(electedDevice.ssid).c_str(), + MacAnonymize(electedDevice.bssid).c_str()); if (info.connState == ConnState::CONNECTED && electedDevice.networkId == info.networkId) { WifiDeviceConfig networkInfo; electedDevice = networkInfo;