Skip to content
Open
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
39 changes: 38 additions & 1 deletion src/hostif/handlers/src/hostIf_WiFi_ReqHandler.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* If not stated otherwise in this file or this component's LICENSE file the
* following copyright and licenses apply:

Check failure on line 3 in src/hostif/handlers/src/hostIf_WiFi_ReqHandler.cpp

View workflow job for this annotation

GitHub Actions / call-fossid-workflow / Fossid Annotate PR

FossID License Issue Detected

Source code with 'Apache-2.0' license found in local file 'src/hostif/handlers/src/hostIf_WiFi_ReqHandler.cpp' (Match: rdk/components/generic/tr69hostif/rdk/components/generic/tr69hostif/1902, 840 lines, url: https://code.rdkcentral.com/r/plugins/gitiles/rdk/components/generic/tr69hostif/+archive/rdk-dev-1902.tar.gz, file: src/hostif/handlers/src/hostIf_WiFi_ReqHandler.cpp)

Check failure on line 3 in src/hostif/handlers/src/hostIf_WiFi_ReqHandler.cpp

View workflow job for this annotation

GitHub Actions / call-fossid-workflow / Fossid Annotate PR

FossID License Issue Detected

Source code with 'Apache-2.0' license found in local file 'src/hostif/handlers/src/hostIf_WiFi_ReqHandler.cpp' (Match: rdk/components/generic/tr69hostif/rdk/components/generic/tr69hostif/1903, 840 lines, url: https://code.rdkcentral.com/r/plugins/gitiles/rdk/components/generic/tr69hostif/+archive/rdk-dev-1903.tar.gz, file: src/hostif/handlers/src/hostIf_WiFi_ReqHandler.cpp)
*
* Copyright 2016 RDK Management
*
Expand Down Expand Up @@ -255,9 +255,9 @@
const char *pSetting;
const int maxSSID_Instances = 1;
int instanceNum = 0;
int radioIndex = 1;
#ifdef RDKV_TR69
const int maxRadioInstances = 1;
int radioIndex = 1;
if (strcasecmp(stMsgData->paramName,"Device.WiFi.RadioNumberOfEntries") == 0)
{
stMsgData->instanceNum = maxRadioInstances;
Expand Down Expand Up @@ -327,6 +327,43 @@
}
ret = pIface->get_Device_WiFi_EnableWiFi(stMsgData);
}
#ifndef RDKV_TR69
else if (matchComponent(stMsgData->paramName, "Device.WiFi.Radio", &pSetting, instanceNum))
{
if (instanceNum != 1)
{
return NOK;
}

stMsgData->instanceNum = instanceNum;
hostIf_WiFi_Radio *pWifiRadio = hostIf_WiFi_Radio::getInstance(stMsgData->instanceNum);
hostIf_WiFi_Radio_Stats *pWifiRadioStats = hostIf_WiFi_Radio_Stats::getInstance(stMsgData->instanceNum);

if ((!pWifiRadio) || (!pWifiRadioStats))
{
return NOK;
}

if (strcasecmp(pSetting,"OperatingChannelBandwidth") == 0)
{
ret = pWifiRadio->get_Device_WiFi_Radio_OperatingChannelBandwidth(stMsgData,radioIndex);
}
else if (strcasecmp(pSetting,"Stats.PacketsReceived") == 0)
{
ret = pWifiRadioStats->get_Device_WiFi_Radio_Stats_PacketsReceived(stMsgData,radioIndex);
}
else if (strcasecmp(pSetting,"Stats.Noise") == 0)
{
ret = pWifiRadioStats->get_Device_WiFi_Radio_Stats_NoiseFloor(stMsgData,radioIndex);
}
else
{
RDK_LOG(RDK_LOG_ERROR,LOG_TR69HOSTIF,"[%s:%d] Parameter : \'%s\' is Not Supported \n", __FUNCTION__, __LINE__, stMsgData->paramName);
stMsgData->faultCode = fcInvalidParameterName;
ret = NOK;
}
}
#endif
#ifdef RDKV_TR69
else if (matchComponent(stMsgData->paramName, "Device.WiFi.Radio", &pSetting, instanceNum))
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,25 @@
</syntax>
</parameter>
</object>
<object base="Device.WiFi.Radio.{i}." access="readOnly" minEntries="0" maxEntries="unbounded" >
<parameter base="OperatingChannelBandwidth" access="readOnly" notification="0" maxNotification="2" >
<syntax>
<string/>
</syntax>
</parameter>
</object>
<object base="Device.WiFi.Radio.{i}.Stats." access="readOnly" minEntries="1" maxEntries="1" >
<parameter base="PacketsReceived" access="readOnly" notification="0" maxNotification="2" >
<syntax>
<unsignedLong/>
</syntax>
</parameter>
<parameter base="Noise" access="readOnly" notification="0" maxNotification="2" >
<syntax>
<int/>
</syntax>
</parameter>
</object>
<object base="Device.DeviceInfo.X_RDKCENTRAL-COM_xBlueTooth.DiscoveredDevice.{i}." access="readOnly" minEntries="0" maxEntries="unbounded" >
<parameter base="Name" access="readOnly" notification="0" maxNotification="2" >
<syntax>
Expand Down
23 changes: 22 additions & 1 deletion src/hostif/profiles/wifi/Device_WiFi_Radio.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* If not stated otherwise in this file or this component's LICENSE file the
* following copyright and licenses apply:

Check failure on line 3 in src/hostif/profiles/wifi/Device_WiFi_Radio.cpp

View workflow job for this annotation

GitHub Actions / call-fossid-workflow / Fossid Annotate PR

FossID License Issue Detected

Source code with 'Apache-2.0' license found in local file 'src/hostif/profiles/wifi/Device_WiFi_Radio.cpp' (Match: rdk/components/generic/tr69hostif/rdk/components/generic/tr69hostif/1901, 553 lines, url: https://code.rdkcentral.com/r/plugins/gitiles/rdk/components/generic/tr69hostif/+archive/RDK-DEV-1901.tar.gz, file: src/hostif/profiles/wifi/Device_WiFi_Radio.cpp)

Check failure on line 3 in src/hostif/profiles/wifi/Device_WiFi_Radio.cpp

View workflow job for this annotation

GitHub Actions / call-fossid-workflow / Fossid Annotate PR

FossID License Issue Detected

Source code with 'Apache-2.0' license found in local file 'src/hostif/profiles/wifi/Device_WiFi_Radio.cpp' (Match: rdk/components/generic/tr69hostif/rdk/components/generic/tr69hostif/1910, 553 lines, url: https://code.rdkcentral.com/r/plugins/gitiles/rdk/components/generic/tr69hostif/+archive/rdk-dev-1910.tar.gz, file: src/hostif/profiles/wifi/Device_WiFi_Radio.cpp)
*
* Copyright 2018 RDK Management
*
Expand Down Expand Up @@ -155,9 +155,10 @@
memset(TransmitPowerSupported, 0, sizeof(TransmitPowerSupported));
memset(RegulatoryDomain, 0, sizeof(RegulatoryDomain));
}
#ifdef RDKV_NM

int hostIf_WiFi_Radio::get_Device_WiFi_Radio_Props_Fields(int radioIndex)
{
#ifdef RDKV_NM
IARM_Result_t retVal = IARM_RESULT_SUCCESS;
IARM_BUS_WiFi_DiagsPropParam_t param = {0};
int ret;
Comment on lines 159 to 164

Copilot AI Mar 4, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inside get_Device_WiFi_Radio_Props_Fields() (in the #ifdef RDKV_NM section), several snprintf() calls pass the source string as the format argument (format-string vulnerability) and at least one call uses a size (BUFF_LENGTH_1024) that is larger than the destination buffer (OperatingChannelBandwidth is char[BUFF_MIN_16]), risking memory corruption. Please switch these to safe string copies (e.g., strcpy_s/strncpy) or snprintf(dest, sizeof(dest), "%s", src) with the correct destination size for every field.

Copilot uses AI. Check for mistakes.
Expand Down Expand Up @@ -208,6 +209,20 @@
RDK_LOG(RDK_LOG_ERROR,LOG_TR69HOSTIF,"[%s:%s]Error! Unable to connect to wifi instance\n", __FILE__, __FUNCTION__);
return NOK;
}
#else
hostIf_WiFi_Radio *pDev = hostIf_WiFi_Radio::getInstance(dev_id);
if(pDev)
{
snprintf(OperatingChannelBandwidth,BUFF_MIN_16,"80MHz");
radioFirstExTime = time (NULL);
return OK;
}
Comment on lines +212 to +219

Copilot AI Mar 4, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In non-RDKV_NM builds this function populates OperatingChannelBandwidth with a hard-coded value ("80MHz") and returns OK. Since this path is used by the new RDKE/WALDB data model parameters, it will report incorrect values at runtime; please fetch the real value via the non-RDKV_NM mechanism used elsewhere (Thunder/NetworkManager JSON-RPC), or return NOK / "Not Implemented" instead of a constant.

Copilot uses AI. Check for mistakes.
else
{
RDK_LOG(RDK_LOG_ERROR,LOG_TR69HOSTIF,"[%s:%s]Error! Unable to connect to wifi instance\n", __FILE__, __FUNCTION__);
return NOK;
}
#endif
}

void hostIf_WiFi_Radio::checkWifiRadioFetch(int radioIndex)
Expand All @@ -224,6 +239,8 @@
}
}

#ifdef RDKV_NM

int hostIf_WiFi_Radio::get_Device_WiFi_Radio_Enable(HOSTIF_MsgData_t *stMsgData,int radioIndex )
{

Expand Down Expand Up @@ -465,6 +482,8 @@
return OK;
}

#endif

int hostIf_WiFi_Radio::get_Device_WiFi_Radio_OperatingChannelBandwidth(HOSTIF_MsgData_t *stMsgData,int radioIndex )
{
RDK_LOG(RDK_LOG_TRACE1,LOG_TR69HOSTIF,"[%s:%s] Entering..\n", __FUNCTION__, __FILE__);
Expand All @@ -476,6 +495,8 @@
return OK;
}

#ifdef RDKV_NM

int hostIf_WiFi_Radio::get_Device_WiFi_Radio_ExtensionChannel(HOSTIF_MsgData_t *stMsgData,int radioIndex )
{
RDK_LOG(RDK_LOG_TRACE1,LOG_TR69HOSTIF,"[%s:%s] Entering..\n", __FUNCTION__, __FILE__);
Expand Down
2 changes: 0 additions & 2 deletions src/hostif/profiles/wifi/Device_WiFi_Radio.h
Original file line number Diff line number Diff line change
Expand Up @@ -118,10 +118,8 @@ class hostIf_WiFi_Radio {
static GList* getAllAssociateDevs();
static void closeInstance(hostIf_WiFi_Radio *);
static void closeAllInstances();
#ifdef RDKV_NM
int get_Device_WiFi_Radio_Props_Fields(int radioIndex);
void checkWifiRadioFetch(int radioIndex);
#endif
bool Enable;
char Status[BUFF_LENGTH_64];
char Alias[BUFF_LENGTH_64];
Expand Down
29 changes: 25 additions & 4 deletions src/hostif/profiles/wifi/Device_WiFi_Radio_Stats.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* If not stated otherwise in this file or this component's LICENSE file the
* following copyright and licenses apply:

Check failure on line 3 in src/hostif/profiles/wifi/Device_WiFi_Radio_Stats.cpp

View workflow job for this annotation

GitHub Actions / call-fossid-workflow / Fossid Annotate PR

FossID License Issue Detected

Source code with 'Apache-2.0' license found in local file 'src/hostif/profiles/wifi/Device_WiFi_Radio_Stats.cpp' (Match: rdk/components/generic/tr69hostif/rdk/components/generic/tr69hostif/1901, 292 lines, url: https://code.rdkcentral.com/r/plugins/gitiles/rdk/components/generic/tr69hostif/+archive/rdk-dev-1901.tar.gz, file: src/hostif/profiles/wifi/Device_WiFi_Radio_Stats.cpp)
*
* Copyright 2018 RDK Management
*
Expand Down Expand Up @@ -44,9 +44,7 @@
#endif

GHashTable* hostIf_WiFi_Radio_Stats::ifHash = NULL;
#ifdef RDKV_NM
static time_t radioFirstExTime = 0;
#endif

hostIf_WiFi_Radio_Stats *hostIf_WiFi_Radio_Stats::getInstance(int dev_id)
{
Expand Down Expand Up @@ -119,9 +117,9 @@

}

#ifdef RDKV_NM
int hostIf_WiFi_Radio_Stats::get_Device_WiFi_Radio_Stats_Props_Fields(int radioIndex)
{
#ifdef RDKV_NM
IARM_Result_t retVal = IARM_RESULT_SUCCESS;
IARM_BUS_WiFi_DiagsPropParam_t param = {0};
int ret;
Expand Down Expand Up @@ -153,6 +151,21 @@
RDK_LOG(RDK_LOG_ERROR,LOG_TR69HOSTIF,"[%s:%s]Error! Unable to connect to wifi instance\n", __FILE__, __FUNCTION__);
return NOK;
}
#else
hostIf_WiFi_Radio_Stats *pDev = hostIf_WiFi_Radio_Stats::getInstance(dev_id);
if(pDev)
{
PacketsReceived = 65568;
NoiseFloor = -100;
radioFirstExTime = time (NULL);
return OK;
}
Comment on lines +154 to +162

Copilot AI Mar 4, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In non-RDKV_NM builds this code returns hard-coded values for PacketsReceived and NoiseFloor and returns OK. This will make the new RDKE/WALDB parameters report bogus data; please fetch real stats using the non-RDKV_NM approach already used in other WiFi profile codepaths (Thunder/NetworkManager JSON-RPC), or fail the request (NOK / invalid parameter) rather than returning constants.

Copilot uses AI. Check for mistakes.
else
{
RDK_LOG(RDK_LOG_ERROR,LOG_TR69HOSTIF,"[%s:%s]Error! Unable to connect to wifi instance\n", __FILE__, __FUNCTION__);
return NOK;
}
#endif

}

Expand All @@ -170,6 +183,8 @@
}
}

#ifdef RDKV_NM

int hostIf_WiFi_Radio_Stats::get_Device_WiFi_Radio_Stats_BytesSent(HOSTIF_MsgData_t *stMsgData,int radioIndex )
{
RDK_LOG(RDK_LOG_TRACE1,LOG_TR69HOSTIF,"[%s:%s] Entering..\n", __FUNCTION__, __FILE__);
Expand Down Expand Up @@ -205,6 +220,8 @@
return OK;
}

#endif

int hostIf_WiFi_Radio_Stats::get_Device_WiFi_Radio_Stats_PacketsReceived(HOSTIF_MsgData_t *stMsgData,int radioIndex )
{
RDK_LOG(RDK_LOG_TRACE1,LOG_TR69HOSTIF,"[%s:%s] Entering..\n", __FUNCTION__, __FILE__);
Expand All @@ -216,6 +233,8 @@
return OK;
}

#ifdef RDKV_NM

int hostIf_WiFi_Radio_Stats::get_Device_WiFi_Radio_Stats_ErrorsSent(HOSTIF_MsgData_t *stMsgData,int radioIndex )
{
RDK_LOG(RDK_LOG_TRACE1,LOG_TR69HOSTIF,"[%s:%s] Entering..\n", __FUNCTION__, __FILE__);
Expand Down Expand Up @@ -259,6 +278,9 @@
RDK_LOG(RDK_LOG_TRACE1,LOG_TR69HOSTIF,"[%s:%s] Exiting..\n", __FUNCTION__, __FILE__);
return OK;
}

#endif

int hostIf_WiFi_Radio_Stats::get_Device_WiFi_Radio_Stats_NoiseFloor(HOSTIF_MsgData_t *stMsgData,int radioIndex )
{
RDK_LOG(RDK_LOG_TRACE1,LOG_TR69HOSTIF,"[%s:%s] Entering..\n", __FUNCTION__, __FILE__);
Expand All @@ -269,6 +291,5 @@
RDK_LOG(RDK_LOG_TRACE1,LOG_TR69HOSTIF,"[%s:%s] Exiting..\n", __FUNCTION__, __FILE__);
return OK;
}
#endif

#endif /* #ifdef USE_WIFI_PROFILE */
4 changes: 1 addition & 3 deletions src/hostif/profiles/wifi/Device_WiFi_Radio_Stats.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* If not stated otherwise in this file or this component's LICENSE file the
* following copyright and licenses apply:

Check failure on line 3 in src/hostif/profiles/wifi/Device_WiFi_Radio_Stats.h

View workflow job for this annotation

GitHub Actions / call-fossid-workflow / Fossid Annotate PR

FossID License Issue Detected

Source code with 'Apache-2.0' license found in local file 'src/hostif/profiles/wifi/Device_WiFi_Radio_Stats.h' (Match: rdk/components/generic/tr69hostif/rdk/components/generic/tr69hostif/2.1-20161212, 221 lines, url: https://code.rdkcentral.com/r/plugins/gitiles/rdk/components/generic/tr69hostif/+archive/2.1-20161212.tar.gz, file: src/hostif/profiles/wifi/include/Device_WiFi_Radio_Stats.h)
*
* Copyright 2016 RDK Management
*
Expand Down Expand Up @@ -76,10 +76,8 @@
static GList* getAllAssociateDevs();
static void closeInstance(hostIf_WiFi_Radio_Stats *);
static void closeAllInstances();
#ifdef RDKV_NM
int get_Device_WiFi_Radio_Stats_Props_Fields(int radioIndex);
void checkWifiRadioPropsFetch(int radioIndex);
#endif

unsigned long BytesSent;
unsigned long BytesReceived;
Expand All @@ -89,7 +87,7 @@
unsigned int ErrorsReceived;
unsigned int DiscardPacketsSent;
unsigned int DiscardPacketsReceived;
unsigned int NoiseFloor;
int NoiseFloor;

/**
* @ingroup TR69_HOSTIF_WIFI_RADIO_STAT
Expand Down
1 change: 1 addition & 0 deletions src/unittest/stubs/dsVideoDeviceTypes.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

Copilot AI Mar 4, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A leading blank line was added before the file header comment. This breaks the common convention of having the copyright header at the very top of the file; please remove the extra blank line.

Suggested change

Copilot uses AI. Check for mistakes.
/*
* If not stated otherwise in this file or this component's LICENSE file the
* following copyright and licenses apply:
Expand Down
Loading