Skip to content

XB10-2559: Fix for Client IPv4 Address Display in UI. - #86

Open
sethumcacit-bot wants to merge 8 commits into
developfrom
topic/XB10-2559_latest
Open

XB10-2559: Fix for Client IPv4 Address Display in UI.#86
sethumcacit-bot wants to merge 8 commits into
developfrom
topic/XB10-2559_latest

Conversation

@sethumcacit-bot

Copy link
Copy Markdown

Reason for change: Fix for Client IPv4 address display when LAN DHCP is Disable
Test Procedure: Build and Verify
Priority: P1
Risks: low
Signed-off-by: Sethupathy_Nagarajan@comcast.com

Copilot AI review requested due to automatic review settings July 22, 2026 20:12
@sethumcacit-bot
sethumcacit-bot requested review from a team as code owners July 22, 2026 20:12

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 targets incorrect/stale client IPv4 address display in the UI when LAN DHCP server is disabled, by adjusting host-table IPv4 handling during host state transitions and adding product-specific device-mode handling.

Changes:

  • Add logic to remove a host’s stored IPv4 address(es) when a client transitions offline and dhcp_server_enabled=0 (CBR / OneStack business mode).
  • Add OneStack-specific device-mode integration (header usage and link flag).
  • Add multiple new debug traces across IP address discovery, update, and export paths.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
source/lm/network_devices_status.c Adds debug trace when reading the host’s IPv4 string parameter.
source/lm/Makefile.am Adds a new Automake conditional to link -ldevicemode for OneStack builds.
source/lm/lm_wrapper.c Adds debug traces around ARP parsing and DHCPv4 client/reservation IP updates.
source/lm/lm_main.c Adds OneStack device-mode include, new offline/DHCP-disabled IPv4 cleanup logic, and extensive IP-related debug traces.
source/lm/cosa_hosts_dml.c Adds debug trace when fetching the IPAddress parameter.

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

Comment thread source/lm/Makefile.am
Comment on lines +70 to +72
if ONESTACK_PRODUCT_REQ
libCcspLM_la_LDFLAGS += -ldevicemode
endif
Comment thread source/lm/network_devices_status.c Outdated
Comment thread source/lm/lm_main.c Outdated
Comment thread source/lm/lm_main.c
Comment thread source/lm/lm_main.c Outdated
Comment thread source/lm/lm_main.c Outdated
Comment thread source/lm/cosa_hosts_dml.c Outdated
@sethumcacit-bot
sethumcacit-bot force-pushed the topic/XB10-2559_latest branch from 8e7b3ba to 47a44a1 Compare July 23, 2026 07:56
Reason for change: Fix for Client IPv4 address display when
LAN DHCP is Disable
Test Procedure: Build and Verify
Priority: P1
Risks: low
Signed-off-by: Sethupathy_Nagarajan@comcast.com
@sethumcacit-bot
sethumcacit-bot force-pushed the topic/XB10-2559_latest branch from 47a44a1 to ff4e1e2 Compare July 23, 2026 08:14
Comment thread source/lm/lm_main.c Fixed
Comment thread source/lm/lm_main.c Fixed
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings July 23, 2026 09:00
sethumcacit-bot and others added 2 commits July 23, 2026 14:30
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
sethumcacit-bot and others added 2 commits July 23, 2026 14:34
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

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

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Comments suppressed due to low confidence (10)

source/lm/lm_main.c:1609

  • In Add_Update_IPv6Address(), the new debug log reads temp->pStringParaValue[LM_HOST_IPAddress_IPAddressId] before the field is initialized. If AnscAllocateMemory() doesn’t zero the struct (or if the pointer is NULL), passing it to a %s formatter is undefined behavior and can crash. Initialize the allocated node before any reads, and log only after setting the string.
			temp=AnscAllocateMemory(sizeof(LmObjectHostIPAddress));
			if(temp == NULL)
			{
				return NULL;
			}
			else
            else
            {

source/lm/lm_main.c:1637

  • This debug log uses temp even when the IPv6 list was already initialized, which means temp may be uninitialized here. It also passes the value to %s without guarding. Log pCur (the node being updated) and guard against NULL instead.
	}

source/lm/lm_main.c:2644

  • This debug log dereferences pHost before the subsequent NULL-check (if (pHost && ...)). If Hosts_FindHostByPhysAddress() returns NULL, this will crash.
                pHost = Hosts_FindHostByPhysAddress((char *)hosts.phyAddr);

source/lm/lm_main.c:2316

  • This debug log prints pHost->pStringParaValue[LM_HOST_IPAddressId] with a %s formatter before checking whether the pointer is NULL. Passing NULL to %s is undefined behavior and can crash.
			Xlm_wrapper_get_info(pHost);

source/lm/lm_main.c:2570

  • This debug log prints pHost->pStringParaValue[LM_HOST_IPAddressId] with %s immediately before code that explicitly handles the NULL case. If the IP address is NULL, the log statement itself can crash.
                    pHost->l1unReachableCnt = 1;

source/lm/lm_main.c:2603

  • Same issue as above: %s formatting a potentially-NULL IP string is undefined behavior and can crash. This should be guarded (or removed).
                    pHost->l1unReachableCnt = 1;

source/lm/lm_main.c:4536

  • This debug log prints pHost->pStringParaValue[LM_HOST_IPAddressId] with %s without checking for NULL. In this function pHost->pStringParaValue[LM_HOST_IPAddressId] can legitimately be NULL, so the log statement can crash.
        }

source/lm/lm_main.c:4682

  • This debug log prints the host IP string using %s without guarding against NULL. If the host has no IPv4 yet, this is undefined behavior and can crash.
    source/lm/lm_main.c:1739
  • This debug log prints pHost->pStringParaValue[LM_HOST_IPAddressId] using %s without guarding against NULL. If the host does not yet have an IP address, this is undefined behavior and can crash.
	{

source/lm/lm_main.c:720

  • This debug log prints the IP string with %s without guarding against NULL. In this path the IP may still be NULL (e.g., getIPAddress() fails / returns empty and LanManager_CheckCloneCopy() no-ops), so the log statement can crash.
                CcspTraceDebug(("%s:%d, InLease:LM_HOST_IPAddressId:%s \n",__FUNCTION__,__LINE__, pHost->pStringParaValue[LM_HOST_IPAddressId]));

Comment thread configure.ac
Comment on lines +94 to +104
AC_ARG_ENABLE([onestacksupport],
AS_HELP_STRING([--enable-onestacksupport],[enable onestack support (default is no)]),
[
case "${enableval}" in
yes) ONESTACK_PRODUCT_REQ=true;;
no) ONESTACK_PRODUCT_REQ=false;;
*) AC_MSG_ERROR([bad value ${enableval} for --enable-onestacksupport ]);;
esac
],
[echo "onestack is disabled"])
AM_CONDITIONAL(ONESTACK_PRODUCT_REQ, test "x$ONESTACK_PRODUCT_REQ" = xtrue)
Copilot AI review requested due to automatic review settings July 23, 2026 09:08
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

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

Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.

Comments suppressed due to low confidence (7)

source/lm/lm_main.c:1638

  • This debug log uses temp->... even though temp is only initialized inside the *ppHeader == NULL branch; when the list is non-empty this is an uninitialized pointer dereference.
    CcspTraceDebug(("%s:%d, Final:In-ipv6: ipAddress=%s \n", __FUNCTION__, __LINE__, ipAddress ? ipAddress : "(null)"));

source/lm/lm_main.c:1743

  • These debug logs pass pHost->pStringParaValue[LM_HOST_IPAddressId] to %s without a NULL check; this is undefined behavior if the host doesn't currently have an IPv4 string set (which is a valid state before LanManager_CheckCloneCopy runs).
        CcspTraceDebug(("%s:%d, Before:In-ipv4:%s, LM_HOST_IPAddressId: %s \n",__FUNCTION__,__LINE__, ipAddress, pHost->pStringParaValue[LM_HOST_IPAddressId]));
		pCur = Add_Update_IPv4Address(pHost,ipAddress);
		LanManager_CheckCloneCopy(&(pHost->pStringParaValue[LM_HOST_IPAddressId]) , ipAddress);
        CcspTraceDebug(("%s:%d, After:In-ipv4:%s, LM_HOST_IPAddressId: %s \n",__FUNCTION__,__LINE__, ipAddress, pHost->pStringParaValue[LM_HOST_IPAddressId]));

source/lm/lm_main.c:2317

  • This debug log uses %s with pHost->pStringParaValue[LM_HOST_IPAddressId] without a NULL guard; Host_AddIPv4Address() is called even when the pointer is NULL, so this can crash before the function gets a chance to handle the NULL input.
            CcspTraceDebug(("%s:%d, LM_HOST_IPAddressId:%s \n",__FUNCTION__,__LINE__, pHost->pStringParaValue[LM_HOST_IPAddressId]));

source/lm/lm_main.c:2572

  • This debug log prints pHost->pStringParaValue[LM_HOST_IPAddressId] with %s before the code checks whether that pointer is NULL; if it is NULL (which the following if (!...) explicitly handles), the log itself can crash the process.
                    CcspTraceDebug(("%s:%d, LM_HOST_IPAddressId:%s \n",__FUNCTION__,__LINE__, pHost->pStringParaValue[LM_HOST_IPAddressId]));
                    if ( ! pHost->pStringParaValue[LM_HOST_IPAddressId] )

source/lm/lm_main.c:2605

  • Same issue here: the debug log uses %s with a value that is immediately checked for NULL on the next line; if it's NULL the log call can crash.
                    CcspTraceDebug(("%s:%d, LM_HOST_IPAddressId:%s \n",__FUNCTION__,__LINE__, pHost->pStringParaValue[LM_HOST_IPAddressId]));
                    if ( ! pHost->pStringParaValue[LM_HOST_IPAddressId] )

source/lm/lm_main.c:4538

  • This debug log prints pHost->pStringParaValue[LM_HOST_IPAddressId] with %s before the subsequent NULL check; if the pointer is NULL, the log call can crash.
        CcspTraceDebug(("%s:%d, LM_HOST_IPAddressId:%s \n",__FUNCTION__,__LINE__, pHost->pStringParaValue[LM_HOST_IPAddressId]));
        if ((status.ipv4Active) && (pHost->pStringParaValue[LM_HOST_IPAddressId]))

source/lm/lm_main.c:4684

  • This debug log prints pHost->pStringParaValue[LM_HOST_IPAddressId] with %s before the code checks for NULL; if the pointer is NULL, the log itself can crash.
            CcspTraceDebug(("%s:%d, LM_HOST_IPAddressId:%s \n",__FUNCTION__,__LINE__, pHost->pStringParaValue[LM_HOST_IPAddressId]));
            if (pHost->pStringParaValue[LM_HOST_IPAddressId]) {

Comment thread source/lm/lm_main.c Outdated
Comment on lines +1607 to +1610
else
{
//temp->pStringParaValue[LM_HOST_IPAddress_IPAddressId] = AnscCloneString("EMPTY");
temp->pStringParaValue[LM_HOST_IPAddress_IPAddressId] = AnscCloneString(" "); // fix for RDKB-19836
else
{
CcspTraceDebug(("%s:%d, Allocating IPv6 placeholder entry\n", __FUNCTION__, __LINE__));
Comment thread source/lm/lm_main.c Outdated
Comment thread source/lm/Makefile.am
Comment on lines +70 to +72
if ONESTACK_PRODUCT_REQ
libCcspLM_la_LDFLAGS += -ldevicemode
endif
Copilot AI review requested due to automatic review settings July 23, 2026 09:15

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

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Comments suppressed due to low confidence (2)

source/lm/Makefile.am:72

  • ONESTACK_PRODUCT_REQ currently only adds -ldevicemode, but the code is gated by _ONESTACK_PRODUCT_REQ_ (preprocessor) in lm_main.c. If the configure option is enabled without an external -D_ONESTACK_PRODUCT_REQ_, this will link a library without compiling the guarded code; if _ONESTACK_PRODUCT_REQ_ is defined externally without --enable-onestacksupport, it will compile but fail to link. Tie the conditional to both compile and link flags in the same place.
if ONESTACK_PRODUCT_REQ
    libCcspLM_la_LDFLAGS += -ldevicemode
endif

source/lm/lm_main.c:1516

  • This new debug log hard-codes In-ipv4 even when Host_FreeIPAddress() is called with version == 6, making logs misleading. Consider logging the version and guarding against NULL string pointers to avoid %s UB.
        CcspTraceDebug(("%s:%d, Free:In-ipv4:LM_HOST_IPAddress_IPAddressId: %s \n",__FUNCTION__,__LINE__, pIpAddrList->pStringParaValue[LM_HOST_IPAddress_IPAddressId]));

Comment thread source/lm/lm_wrapper.c
{
hosts[index].status = LM_NEIGHBOR_STATE_STALE;
}
CcspTraceDebug(("%s %d: %s %s %s %d\n", __FUNCTION__, __LINE__, hosts[index].phyAddr,hosts[index].ipAddr,hosts[index].ifName,hosts[index].status));
Copilot AI review requested due to automatic review settings July 23, 2026 10:28

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

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Comments suppressed due to low confidence (1)

source/lm/Makefile.am:72

  • ONESTACK_PRODUCT_REQ is used to add -ldevicemode, but the C code is gated by the _ONESTACK_PRODUCT_REQ_ preprocessor macro. As-is, you can end up with (a) code compiled without the macro but still linking devicemode, or (b) code compiled with _ONESTACK_PRODUCT_REQ_ but failing to link because the conditional isn’t enabled. Define the macro when the automake conditional is enabled (or align both sides to the same symbol).
if ONESTACK_PRODUCT_REQ
    libCcspLM_la_LDFLAGS += -ldevicemode
endif

Comment thread source/lm/lm_main.c
Comment on lines 1556 to 1560
for(pCur = pIpAddrList; pCur != NULL; pPre = pCur, pCur = pCur->pNext){
CcspTraceDebug(("%s:%d, Before:In-ipv4:%s, LM_HOST_IPAddress_IPAddressId: %s \n",__FUNCTION__,__LINE__, ipAddress, pCur->pStringParaValue[LM_HOST_IPAddress_IPAddressId]));
if (strcasecmp(pCur->pStringParaValue[LM_HOST_IPAddress_IPAddressId], ipAddress) == 0){
break;
}
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings July 23, 2026 10:43
@sethumcacit-bot
sethumcacit-bot force-pushed the topic/XB10-2559_latest branch from 1f4ec84 to ed93a4c Compare July 23, 2026 10:43

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

Copilot reviewed 6 out of 6 changed files in this pull request and generated no new comments.

Comments suppressed due to low confidence (6)

source/lm/Makefile.am:72

  • --enable-onestacksupport enables the Automake conditional ONESTACK_PRODUCT_REQ (and adds -ldevicemode), but the C code gates OneStack paths on _ONESTACK_PRODUCT_REQ_. That macro is not defined anywhere in this Makefile, so the OneStack-only code will still be compiled out even when the configure option is enabled. Define _ONESTACK_PRODUCT_REQ_ via CPPFLAGS under the same conditional so the build option actually enables the intended code paths.
if ONESTACK_PRODUCT_REQ
    libCcspLM_la_LDFLAGS += -ldevicemode
endif

source/lm/lm_main.c:2314

  • This debug log prints pHost->pStringParaValue[LM_HOST_IPAddressId] with %s without a NULL guard. If the IPv4 address isn't present yet, passing NULL to %s is undefined and can crash inside the logger. Use a ternary to log a safe placeholder.
            CcspTraceDebug(("%s:%d, LM_HOST_IPAddressId:%s \n",__FUNCTION__,__LINE__, pHost->pStringParaValue[LM_HOST_IPAddressId]));

source/lm/lm_main.c:2568

  • This debug log prints pHost->pStringParaValue[LM_HOST_IPAddressId] with %s before checking it for NULL on the next line. Passing NULL to %s is undefined and can crash; guard the value.
                    CcspTraceDebug(("%s:%d, LM_HOST_IPAddressId:%s \n",__FUNCTION__,__LINE__, pHost->pStringParaValue[LM_HOST_IPAddressId]));

source/lm/lm_main.c:2601

  • This debug log prints pHost->pStringParaValue[LM_HOST_IPAddressId] with %s before checking it for NULL on the next line. Passing NULL to %s is undefined and can crash; guard the value.
                    CcspTraceDebug(("%s:%d, LM_HOST_IPAddressId:%s \n",__FUNCTION__,__LINE__, pHost->pStringParaValue[LM_HOST_IPAddressId]));

source/lm/lm_main.c:4534

  • This debug log prints pHost->pStringParaValue[LM_HOST_IPAddressId] with %s without a NULL guard, even though the code immediately treats the field as optional. Passing NULL to %s is undefined and can crash; log a safe placeholder instead.
        CcspTraceDebug(("%s:%d, LM_HOST_IPAddressId:%s \n",__FUNCTION__,__LINE__, pHost->pStringParaValue[LM_HOST_IPAddressId]));

source/lm/lm_main.c:4680

  • This debug log prints pHost->pStringParaValue[LM_HOST_IPAddressId] with %s before checking it for NULL on the next line. Passing NULL to %s is undefined and can crash; guard the value.
            CcspTraceDebug(("%s:%d, LM_HOST_IPAddressId:%s \n",__FUNCTION__,__LINE__, pHost->pStringParaValue[LM_HOST_IPAddressId]));

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.

3 participants