Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions plugin/NetworkManagerImplementation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -928,7 +928,7 @@
}

{
ActiveInterfaceChangeData eventData{prevActiveInterface, currentActiveinterface};

Check notice

Code scanning / Coverity

Variable copied when it could be moved Low

Variable copied when it could be moved in ReportActiveInterfaceChange
NMLOG_INFO("Posting onActiveInterfaceChange %s", currentActiveinterface.c_str());
enqueueEvent(NM_ON_ACTIVEINTERFACE_CHANGE, std::move(eventData));
}
Expand Down Expand Up @@ -994,7 +994,7 @@
}
#endif
{
InternetStatusChangeData eventData{prevState, currState, interface};

Check notice

Code scanning / Coverity

Variable copied when it could be moved Low

Variable copied when it could be moved in ReportInternetStatusChange
NMLOG_INFO("Posting onInternetStatusChange with current state as %u", (unsigned)currState);
enqueueEvent(NM_ON_INTERNETSTATUS_CHANGE, std::move(eventData));
}
Expand Down Expand Up @@ -1054,7 +1054,7 @@
logSSIDs(LOG_LEVEL_INFO, filterResult);

{
AvailableSSIDsData eventData{jsonOfFilterScanResults};

Check notice

Code scanning / Coverity

Variable copied when it could be moved Low

Variable copied when it could be moved in ReportAvailableSSIDs
enqueueEvent(NM_ON_AVAILABLESSIDS, std::move(eventData));
}
}
Expand Down Expand Up @@ -1328,7 +1328,7 @@
GetWiFiSignalQuality(ssid, strength, noise, snr, newSignalQuality);

if (!ssid.empty())
m_lastConnectedSSID = ssid; // last connected ssid used in wifiConnect
setLastConnectedSSID(ssid); // last connected ssid used in wifiConnect

if (oldSignalQuality != newSignalQuality) {
oldSignalQuality = newSignalQuality;
Expand Down Expand Up @@ -1382,7 +1382,7 @@
{
LOG_ENTRY_FUNCTION();
{
WiFiSignalQualityChangeData eventData{ssid, strength, noise, snr, quality};

Check notice

Code scanning / Coverity

Variable copied when it could be moved Low

Variable copied when it could be moved in ReportWiFiSignalQualityChange
NMLOG_INFO("Posting onWiFiSignalQualityChange %d", strength);
enqueueEvent(NM_ON_WIFISIGNALQUALITY_CHANGE, std::move(eventData));
}
Expand Down Expand Up @@ -1457,11 +1457,12 @@
{
if (m_wlanDisconnectedForSleep.load())
{
if (!m_lastConnectedSSID.empty())
const std::string lastConnectedSSID = getLastConnectedSSID();
if (!lastConnectedSSID.empty())
{
NMLOG_INFO("OnPowerModePreChange: waking from DeepSleep — reconnecting to '%s'",
m_lastConnectedSSID.c_str());
uint32_t rcWifiUp = ConnectToKnownSSID(m_lastConnectedSSID);
lastConnectedSSID.c_str());
uint32_t rcWifiUp = ConnectToKnownSSID(lastConnectedSSID);
if (rcWifiUp == Core::ERROR_NONE)
{
m_wlanDisconnectedForSleep.store(false);
Expand Down Expand Up @@ -1607,7 +1608,7 @@

std::set<std::string> NetworkManagerImplementation::swapIpCache(
const std::string& iface, const std::string& ipFamily,
IpFamilyCache newCache)

Check notice

Code scanning / Coverity

Big parameter passed by value Low

Big parameter passed by value in swapIpCache
{
std::set<std::string> oldKeys;
std::lock_guard<std::mutex> lock(m_ipCacheMutex);
Expand Down
13 changes: 13 additions & 0 deletions plugin/NetworkManagerImplementation.h
Original file line number Diff line number Diff line change
Expand Up @@ -466,9 +466,22 @@ namespace WPEFramework
m_defaultInterface = iface;
}

void setLastConnectedSSID(const std::string& ssid)
{
std::lock_guard<std::mutex> lock(m_lastConnectedSSIDMutex);
m_lastConnectedSSID = ssid;
}

std::string getLastConnectedSSID() const
{
std::lock_guard<std::mutex> lock(m_lastConnectedSSIDMutex);
return m_lastConnectedSSID;
}

private:
string m_defaultInterface;
mutable std::mutex m_defaultInterfaceMutex;
mutable std::mutex m_lastConnectedSSIDMutex;
std::map<std::pair<std::string, std::string>, IpFamilyCache> m_ipCacheMap;
mutable std::mutex m_ipCacheMutex;
};
Expand Down
10 changes: 6 additions & 4 deletions plugin/gnome/NetworkManagerGnomeProxy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@
interface.enabled = GnomeNetworkManagerEvents::isInterfaceStateEnabled(info.state);
interface.connected = GnomeNetworkManagerEvents::isInterfaceStateConnected(info.state);

interfaceList.push_back(interface);

Check notice

Code scanning / Coverity

Variable copied when it could be moved Low

Variable copied when it could be moved in GetAvailableInterfaces
}

using Implementation = RPC::IteratorType<Exchange::INetworkManager::IInterfaceDetailsIterator>;
Expand Down Expand Up @@ -590,8 +590,9 @@
if(enabled && interface == nmUtils::wlanIface() && _instance != NULL)
{
sleep(1); // wait for 1 sec to change the device state
NMLOG_INFO("Activating connection '%s' ...", _instance->m_lastConnectedSSID.c_str());
wifi->activateKnownConnection(nmUtils::wlanIface(), _instance->m_lastConnectedSSID);
const string lastConnectedSSID = _instance->getLastConnectedSSID();
NMLOG_INFO("Activating connection '%s' ...", lastConnectedSSID.c_str());
wifi->activateKnownConnection(nmUtils::wlanIface(), lastConnectedSSID);
}
}

Expand Down Expand Up @@ -665,7 +666,7 @@
{
NMLOG_DEBUG("no %s address on %s", family.c_str(), interface.c_str());
}
result.ipversion = family;

Check notice

Code scanning / Coverity

Variable copied when it could be moved Low

Variable copied when it could be moved in GetIPSettings

return Core::ERROR_NONE;
}
Expand Down Expand Up @@ -740,7 +741,7 @@
m_filterSsidslist.clear();
m_filterFrequencies.clear();
m_filterSsidslist = filteredSsids;
m_filterFrequencies = filteredFrequencies;

Check notice

Code scanning / Coverity

Variable copied when it could be moved Low

Variable copied when it could be moved in StartWiFiScan
m_filterVectorsLock.Unlock();

nmEvent->setwifiScanOptions(true);
Expand Down Expand Up @@ -814,8 +815,9 @@

if(ssid.ssid.empty())
{
NMLOG_WARNING("ssid is empty activating last connected ssid !");
if(_instance != NULL && wifi->activateKnownConnection(nmUtils::wlanIface(), _instance->m_lastConnectedSSID))
const string lastConnectedSSID = _instance->getLastConnectedSSID();
NMLOG_WARNING("ssid is empty activating last connected ssid (%s) !", lastConnectedSSID.c_str());
if(_instance != NULL && wifi->activateKnownConnection(nmUtils::wlanIface(), lastConnectedSSID))
Comment on lines 816 to +820
{
rc = Core::ERROR_NONE;
}
Expand Down
5 changes: 3 additions & 2 deletions plugin/gnome/gdbus/NetworkManagerGdbusClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -979,8 +979,9 @@ namespace WPEFramework
// Wait for 1 sec to change the device state
sleep(1);
if(interface == GnomeUtils::getWifiIfname() && _instance != nullptr) {
NMLOG_INFO("Activating connection '%s' ...", _instance->m_lastConnectedSSID.c_str());
activateKnownConnection(GnomeUtils::getWifiIfname(), _instance->m_lastConnectedSSID);
const std::string lastConnectedSSID = _instance->getLastConnectedSSID();
NMLOG_INFO("Activating connection '%s' ...", lastConnectedSSID.c_str());
activateKnownConnection(GnomeUtils::getWifiIfname(), lastConnectedSSID);
}
else if(interface == GnomeUtils::getEthIfname()) {
NMLOG_INFO("Activating connection 'Wired connection 1' ...");
Expand Down
5 changes: 3 additions & 2 deletions plugin/gnome/gdbus/NetworkManagerGdbusProxy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -286,8 +286,9 @@ namespace WPEFramework

if(ssid.ssid.empty() && _instance != NULL)
{
NMLOG_WARNING("ssid is empty activating last connected ssid !");
if(_nmGdbusClient->activateKnownConnection(GnomeUtils::getWifiIfname(), _instance->m_lastConnectedSSID))
const string lastConnectedSSID = _instance->getLastConnectedSSID();
NMLOG_WARNING("ssid is empty activating last connected ssid (%s) !", lastConnectedSSID.c_str());
if(_nmGdbusClient->activateKnownConnection(GnomeUtils::getWifiIfname(), lastConnectedSSID))
rc = Core::ERROR_NONE;
}
else if(ssid.ssid.size() <= 32)
Expand Down
Loading