RDKEMW-14684 Implement Radio Data Model Parameters for RDKE - #380
RDKEMW-14684 Implement Radio Data Model Parameters for RDKE#380nhanasi wants to merge 9 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
Implements additional WiFi Radio data model parameters intended for RDKE/WALDB by exposing Device.WiFi.Radio.{i}.OperatingChannelBandwidth and Device.WiFi.Radio.{i}.Stats fields through the hostIf WiFi request handler and the generic WALDB data model.
Changes:
- Added WALDB generic data model entries for
OperatingChannelBandwidth,Stats.PacketsReceived, andStats.Noise. - Updated WiFi Radio/Radio_Stats hostIf implementations to compile without
RDKV_NMand provide values for the new parameters. - Extended
WiFiReqHandler::handleGetMsg()(non-TR69 path) to route the newDevice.WiFi.Radio.*parameters to the appropriate getters.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| src/unittest/stubs/dsVideoDeviceTypes.h | Adds an extra leading blank line in the stub header. |
| src/hostif/profiles/wifi/Device_WiFi_Radio_Stats.h | Makes NoiseFloor signed and removes RDKV_NM gating around props fetch declarations. |
| src/hostif/profiles/wifi/Device_WiFi_Radio_Stats.cpp | Refactors RDKV_NM usage and adds non-RDKV_NM fallback behavior for stats props. |
| src/hostif/profiles/wifi/Device_WiFi_Radio.h | Removes RDKV_NM gating around radio props fetch declarations. |
| src/hostif/profiles/wifi/Device_WiFi_Radio.cpp | Refactors RDKV_NM usage and adds non-RDKV_NM fallback behavior for radio props. |
| src/hostif/parodusClient/waldb/data-model/data-model-generic.xml | Adds the new Radio / Radio.Stats parameters to the generic WALDB data model. |
| src/hostif/handlers/src/hostIf_WiFi_ReqHandler.cpp | Adds non-TR69 routing for the new Radio parameters. |
Comments suppressed due to low confidence (1)
src/hostif/profiles/wifi/Device_WiFi_Radio_Stats.cpp:232
PacketsReceivedis modeled as anunsigned long(and WALDB XML declares it asunsignedLong), but this getter writes it viaput_intand setsparamtypetohostIf_UnsignedIntTypewithparamLen=4. This can truncate values and can also cause a type mismatch for the new RDKE data model parameter; usehostIf_UnsignedLongTypeand write the value with the appropriate helper/size (consistent with other stats getters in the codebase, e.g. WiFi EndPoint stats).
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__);
checkWifiRadioPropsFetch(radioIndex);
put_int(stMsgData->paramValue, PacketsReceived);
stMsgData->paramtype = hostIf_UnsignedIntType;
stMsgData->paramLen=4;
RDK_LOG(RDK_LOG_TRACE1,LOG_TR69HOSTIF,"[%s:%s] Exiting..\n", __FUNCTION__, __FILE__);
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| 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; |
There was a problem hiding this comment.
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.
| @@ -1,3 +1,4 @@ | |||
|
|
|||
There was a problem hiding this comment.
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.
| #else | ||
| hostIf_WiFi_Radio *pDev = hostIf_WiFi_Radio::getInstance(dev_id); | ||
| if(pDev) | ||
| { | ||
| snprintf(OperatingChannelBandwidth,BUFF_MIN_16,"80MHz"); | ||
| radioFirstExTime = time (NULL); | ||
| return OK; | ||
| } |
There was a problem hiding this comment.
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.
| #else | ||
| hostIf_WiFi_Radio_Stats *pDev = hostIf_WiFi_Radio_Stats::getInstance(dev_id); | ||
| if(pDev) | ||
| { | ||
| PacketsReceived = 65568; | ||
| NoiseFloor = -100; | ||
| radioFirstExTime = time (NULL); | ||
| return OK; | ||
| } |
There was a problem hiding this comment.
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.
Implement Radio Data Model Parameters for RDKE