Skip to content

Commit 915d948

Browse files
authored
Merge branch 'rdkcentral:develop' into develop
2 parents 0deff45 + 7be17e8 commit 915d948

3 files changed

Lines changed: 56 additions & 0 deletions

File tree

plugin/NetworkManagerImplementation.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -614,13 +614,17 @@ namespace WPEFramework
614614
{
615615
if(interface == "eth0")
616616
{
617+
m_ethIPv4Address = {};
618+
m_ethIPv6Address = {};
617619
m_ethConnected.store(false);
618620
m_defaultInterface = "wlan0"; // If WiFi is connected, make it the default interface
619621
// As default interface is changed to wlan0, switch connectivity monitor to initial check
620622
connectivityMonitor.switchToInitialCheck();
621623
}
622624
else if(interface == "wlan0")
623625
{
626+
m_wlanIPv4Address = {};
627+
m_wlanIPv6Address = {};
624628
m_wlanConnected.store(false);
625629
if(m_ethConnected.load())
626630
m_defaultInterface = "eth0"; // If Ethernet is connected, make it the default interface

plugin/NetworkManagerImplementation.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,10 @@ namespace WPEFramework
306306
std::atomic<bool> m_stopThread{false};
307307
std::mutex m_condVariableMutex;
308308
std::condition_variable m_condVariable;
309+
IPAddress m_ethIPv4Address;
310+
IPAddress m_wlanIPv4Address;
311+
IPAddress m_ethIPv6Address;
312+
IPAddress m_wlanIPv6Address;
309313

310314
public:
311315
std::atomic<bool> m_ethConnected;

plugin/rdk/NetworkManagerRDKProxy.cpp

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -684,6 +684,46 @@ namespace WPEFramework
684684
LOG_ENTRY_FUNCTION();
685685
uint32_t rc = Core::ERROR_RPC_CALL_FAILED;
686686
IARM_BUS_NetSrvMgr_Iface_Settings_t iarmData = { 0 };
687+
string ipversionStr;
688+
689+
if(interface.empty())
690+
{
691+
interface = m_defaultInterface;
692+
}
693+
if(ipversion.empty())
694+
{
695+
ipversionStr = "IPv4";
696+
}
697+
else
698+
{
699+
ipversionStr = ipversion;
700+
}
701+
if ("wlan0" == interface)
702+
{
703+
if("IPv4" == ipversionStr && !m_wlanIPv4Address.ipaddress.empty())
704+
{
705+
address = m_wlanIPv4Address;
706+
return Core::ERROR_NONE;
707+
}
708+
else if("IPv6" == ipversionStr && !m_wlanIPv6Address.ipaddress.empty())
709+
{
710+
address = m_wlanIPv6Address;
711+
return Core::ERROR_NONE;
712+
}
713+
}
714+
else if ("eth0" == interface)
715+
{
716+
if("IPv4" == ipversionStr && !m_ethIPv4Address.ipaddress.empty())
717+
{
718+
address = m_ethIPv4Address;
719+
return Core::ERROR_NONE;
720+
}
721+
else if("IPv6" == ipversionStr && !m_ethIPv6Address.ipaddress.empty())
722+
{
723+
address = m_ethIPv6Address;
724+
return Core::ERROR_NONE;
725+
}
726+
}
687727
/* Netsrvmgr returns eth0 & wlan0 as primary interface but when we want to set., we must set ETHERNET or WIFI*/
688728
//TODO: Fix netsrvmgr to accept eth0 & wlan0
689729
if ("wlan0" == interface)
@@ -714,11 +754,19 @@ namespace WPEFramework
714754
{
715755
address.ipversion = string ("IPv4");
716756
address.prefix = NetmaskToPrefix(iarmData.netmask);
757+
if("eth0" == interface)
758+
m_ethIPv4Address = address;
759+
else if("wlan0" == interface)
760+
m_wlanIPv4Address = address;
717761
}
718762
else if (0 == strcasecmp("ipv6", iarmData.ipversion))
719763
{
720764
address.ipversion = string ("IPv6");
721765
address.prefix = std::atoi(iarmData.netmask);
766+
if("eth0" == interface)
767+
m_ethIPv6Address = address;
768+
else if("wlan0" == interface)
769+
m_wlanIPv6Address = address;
722770
}
723771

724772
rc = Core::ERROR_NONE;

0 commit comments

Comments
 (0)