RDKB-64443:WAN is going down after restarting the Wanmanager process#201
RDKB-64443:WAN is going down after restarting the Wanmanager process#201aadhithan01 wants to merge 24 commits intordkcentral:mainfrom
Conversation
… client event error paths
There was a problem hiding this comment.
Pull request overview
Updates WanManager’s DHCP client RBUS event handling to avoid WAN going down after a WanManager process restart by improving event parsing robustness and adjusting the RBUS subscription API usage.
Changes:
- Add NULL checks for DHCP event fields (e.g.,
IfName,MsgType) before dereferencing. - Switch DHCP event subscription from
rbusEvent_SubscribetorbusEvent_SubscribeEx.
Comments suppressed due to low confidence (1)
source/TR-181/middle_layer_src/wanmgr_rbus_dhcp_client_events.c:46
eventDatais allocated withmallocand then immediately passed tomemsetwithout checking for allocation failure. Ifmallocreturns NULL this will crash; add a NULL check and return early (logging an error) before dereferencing it.
DhcpEventThreadArgs *eventData = malloc(sizeof(DhcpEventThreadArgs));
memset(eventData, 0, sizeof(DhcpEventThreadArgs));
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…enabling DHCP clients to DHCPManager Set DHCPv4/DHCPv6 Interface parameter to DHCPManager before subscribing to the .Events, then enable the DHCP client. This ensures the interface is configured on DHCPManager prior to event subscription so no events are missed on startup.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
c7a260e
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
Comments suppressed due to low confidence (1)
source/TR-181/middle_layer_src/wanmgr_rbus_dhcp_client_events.c:236
- In the DHCP_LEASE_UPDATE path, if
LeaseInfoisn't a valid bytes payload (e.g.,rbusValue_GetBytesreturns NULL orbytes_lendoesn't match the expected struct size), the code still enqueues the event with a zeroedleaseunion.WanMgr_ProcessDhcpClientEventwill then treat it as a real lease update and can mark the interface UP with empty IP/gateway data. Drop the event (freeeventDataand return) whenptris NULL or the length is unexpected, instead of enqueuing it.
uint8_t const* ptr = rbusValue_GetBytes(value, &bytes_len);
if(eventData->version == DHCPV4)
{
if((size_t)bytes_len == sizeof(DHCP_MGR_IPV4_MSG))
{
memcpy(&(eventData->lease.v4), ptr, bytes_len);
}
else
{
CcspTraceError(("%s-%d : DHCPv4 lease length %d and expected %d\n", __FUNCTION__, __LINE__, bytes_len,sizeof(DHCP_MGR_IPV4_MSG) ));
}
}
else
{
if((size_t)bytes_len == sizeof(DHCP_MGR_IPV6_MSG))
{
memcpy(&(eventData->lease.v6), ptr, bytes_len);
}
else
{
CcspTraceError(("%s-%d : DHCPv6 lease length %d and expected %d\n", __FUNCTION__, __LINE__, bytes_len,sizeof(DHCP_MGR_IPV6_MSG) ));
}
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
RDKB-64443:WAN is going down after restarting the Wanmanager process
Reason for change: After Wan-restart internet is not working
Test Procedure: Restart the Wanmanager and check erouter0 is getting ipv6 address
Risks: Low
Signed-off-by:[email protected]