Skip to content

XB10-2559: Fix for Client IPv4 Address Display in UI when LAN DHCP is…#67

Open
jayantrais wants to merge 1 commit into
developfrom
topic/XB10-2559
Open

XB10-2559: Fix for Client IPv4 Address Display in UI when LAN DHCP is…#67
jayantrais wants to merge 1 commit into
developfrom
topic/XB10-2559

Conversation

@jayantrais
Copy link
Copy Markdown

… Disabled.

Reason for change: Fix for Client IPv4 address display when LAN DHCP is Disabled.
Test Procedure: Build and Verify
Priority: P1
Risks: low

… Disabled.

Reason for change: Fix for Client IPv4 address display when LAN DHCP is Disabled.
Test Procedure: Build and Verify
Priority: P1
Risks: low

Signed-off-by: jrai722 <jayant_rai2@comcast.com>
Copilot AI review requested due to automatic review settings May 18, 2026 21:54
@jayantrais jayantrais requested review from a team as code owners May 18, 2026 21:54
@github-actions
Copy link
Copy Markdown


Thank you for your submission, we really appreciate it. Like many open-source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution. You can sign the CLA by just posting a Pull Request Comment same as the below format.


I have read the CLA Document and I hereby sign the CLA


Rai seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You can retrigger this bot by commenting recheck in this Pull Request. Posted by the CLA Assistant Lite bot.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

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 aims to fix incorrect/stale client IPv4 address display in the UI when the LAN DHCP server is disabled by clearing the host’s stored IPv4 data when the address is not found in the DHCP lease file and dhcp_server_enabled=0.

Changes:

  • Add syscfg-based gating (dhcp_server_enabled, and devicemode on OneStack) in the “IP not found in lease file” path.
  • Clear stored IPv4 address fields for the host when DHCP server is disabled (to prevent UI display of stale IPv4 info).
  • Add additional warning logs around the above path.
Comments suppressed due to low confidence (3)

source/lm/lm_main.c:750

  • pHost->ipv4AddrArray is a linked list allocated via AnscAllocateMemory (see Add_Update_IPv4Address), so free(pHost->ipv4AddrArray) only frees the head node and leaks the rest (and may mismatch the allocator). Use Host_FreeIPAddress(pHost, 4) (or the same per-node free logic) to clear IPv4 addresses safely before setting ipv4AddrArray/numIPv4Addr to 0/NULL.
                                    free(pHost->pStringParaValue[LM_HOST_IPAddressId]);
                                    pHost->pStringParaValue[LM_HOST_IPAddressId] = NULL;
                                    free(pHost->ipv4AddrArray);
                                    pHost->ipv4AddrArray = NULL;
                                    pHost->numIPv4Addr = 0;

source/lm/lm_main.c:751

  • When clearing the host's IPv4 address due to DHCP server being disabled, pHost->ipv4Active is left as TRUE. Downstream code (e.g., presence detection) uses ipv4Active to decide whether to treat IPv4 as active, so this can lead to an “IPv4 active but no address” state. Consider setting pHost->ipv4Active = FALSE when you null out the IPv4 address fields.
                                    pHost->pStringParaValue[LM_HOST_IPAddressId] = NULL;
                                    free(pHost->ipv4AddrArray);
                                    pHost->ipv4AddrArray = NULL;
                                    pHost->numIPv4Addr = 0;
                                }

source/lm/lm_main.c:736

  • Under _CBR_PRODUCT_REQ_ (without _ONESTACK_PRODUCT_REQ_), device_mode is never used and CcspTraceWarning((" SETHU: _ONESTACK_PRODUCT_REQ_ \n")) becomes misleading. To avoid unused-variable warnings and confusing logs, declare device_mode only inside the _ONESTACK_PRODUCT_REQ_ block and adjust the log message (or remove it).
#if defined (_CBR_PRODUCT_REQ_) || defined (_ONESTACK_PRODUCT_REQ_)
                    char device_mode[32] = {0};
                    char dhcp_server_enabled[32] = {0};

                    CcspTraceWarning((" SETHU: _ONESTACK_PRODUCT_REQ_ \n"));
#if defined (_ONESTACK_PRODUCT_REQ_)
                    if(!syscfg_get( NULL, "devicemode", device_mode, sizeof(device_mode)))
                    {

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

Comment thread source/lm/lm_main.c
Comment on lines +728 to +745
CcspTraceWarning(("<%s> SETHU: IPAddress not found in lease file : IPAddress = %s, MAC Addr = %s \n",__FUNCTION__, pHost->pStringParaValue[LM_HOST_IPAddressId], pHost->pStringParaValue[LM_HOST_PhysAddressId]));
#if defined (_CBR_PRODUCT_REQ_) || defined (_ONESTACK_PRODUCT_REQ_)
char device_mode[32] = {0};
char dhcp_server_enabled[32] = {0};

CcspTraceWarning((" SETHU: _ONESTACK_PRODUCT_REQ_ \n"));
#if defined (_ONESTACK_PRODUCT_REQ_)
if(!syscfg_get( NULL, "devicemode", device_mode, sizeof(device_mode)))
{
CcspTraceWarning((" SETHU: devicemode: %s\n", device_mode));
if(strncmp(device_mode, "business", strlen("business")) == 0)
{
#endif
if(!syscfg_get( NULL, "dhcp_server_enabled", dhcp_server_enabled, sizeof(dhcp_server_enabled)))
{
CcspTraceWarning((" SETHU: dhcp_server_enabled: %s\n", dhcp_server_enabled));
if(strncmp(dhcp_server_enabled, "0", strlen("0")) == 0)
{
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