Skip to content

Topic/dm wifi#414

Open
Vismalskumar0 wants to merge 2 commits into
developfrom
topic/dm_wifi
Open

Topic/dm wifi#414
Vismalskumar0 wants to merge 2 commits into
developfrom
topic/dm_wifi

Conversation

@Vismalskumar0

Copy link
Copy Markdown
Contributor

No description provided.

RDKEMW-14888 : Observing error logs captured from RTMessages in tr69h…
@Vismalskumar0 Vismalskumar0 requested a review from a team as a code owner March 12, 2026 18:55
Copilot AI review requested due to automatic review settings March 12, 2026 18:55

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the WiFi EndPoint cache refresh logic to be more tolerant of incomplete JSON-RPC responses from NetworkManager (specifically around the interfaces array and WiFi enabled field), favoring warnings and retaining previously cached values rather than failing the refresh.

Changes:

  • Downgrades certain JSON parsing failures (missing interfaces, missing WiFi interface, invalid/missing enabled) from hard errors to warnings.
  • Guards iteration and parsing to avoid dereferencing when interfaces is not an array or the WiFi interface is not found.
  • Keeps the prior cached Enable value when the WiFi enabled value cannot be determined.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Comment on lines 361 to +399
@@ -378,13 +377,13 @@ int hostIf_WiFi_EndPoint::refreshCache()

if (!interface)
{
RDK_LOG (RDK_LOG_ERROR, LOG_TR69HOSTIF, "[%s] WIFI interface not found\n", __FUNCTION__);
cJSON_Delete(root);
return NOK;
RDK_LOG (RDK_LOG_WARN, LOG_TR69HOSTIF, "[%s] WIFI interface not found, keeping existing Enable value\n", __FUNCTION__);
}

//ASSIGN TO OP HERE
cJSON *result = cJSON_GetObjectItem(interface, "enabled");
if (interface)
{
cJSON *result = cJSON_GetObjectItem(interface, "enabled");
if (cJSON_IsBool(result))
{
Enable = cJSON_IsTrue(result);
@@ -395,10 +394,9 @@ int hostIf_WiFi_EndPoint::refreshCache()
}
else
{
RDK_LOG (RDK_LOG_ERROR, LOG_TR69HOSTIF, "[%s] WIFI interface missing valid enabled field\n", __FUNCTION__);
cJSON_Delete(root);
return NOK;
RDK_LOG (RDK_LOG_WARN, LOG_TR69HOSTIF, "[%s] WIFI interface missing valid enabled field, keeping existing Enable value\n", __FUNCTION__);
}
}

Copilot AI Mar 12, 2026

Copy link

Choose a reason for hiding this comment

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

refreshCache() now tolerates missing/invalid interfaces / enabled and keeps the prior Enable value, but the rest of the function still treats the refresh as successful (cache timestamp/last_call_status updated later) and downstream logic uses Enable to decide whether the endpoint is disabled. This can cause stale Enable to be cached and potentially report an enabled endpoint as disabled (or vice versa) when the response is incomplete. Consider tracking whether Enable was actually refreshed; if not, avoid marking the cache refresh successful (e.g., set last_call_status = NOK / skip updating the cache timestamp) or derive disabled status from state instead of a potentially-stale Enable.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants