Skip to content

RDKB-63098: Handle IPv6 delegation for business vs residential Partner ID as part of single build#25

Open
rirfha948 wants to merge 5 commits intodevelopfrom
topic/onestack
Open

RDKB-63098: Handle IPv6 delegation for business vs residential Partner ID as part of single build#25
rirfha948 wants to merge 5 commits intodevelopfrom
topic/onestack

Conversation

@rirfha948
Copy link

No description provided.

Reason for change: Added One Stack MACRO handling
Test Procedure:
  - TBD
Risks: None
Priority: P3
Signed-off-by: rirfha948 <rasina_irfhan@comcast.com>
Reason for change: Added One Stack MACRO handling
Test Procedure:
  - TBD
Risks: None
Priority: P3
Signed-off-by: rirfha948 <rasina_irfhan@comcast.com>
Copilot AI review requested due to automatic review settings February 11, 2026 11:07
@rirfha948 rirfha948 requested review from a team as code owners February 11, 2026 11:08
Copy link

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

Enables a single build to handle IPv6 prefix delegation differences (e.g., business vs. residential) by broadening compilation guards to include _ONESTACK_PRODUCT_REQ_ and adding runtime feature checks before applying PD-related TLVs and sysevents.

Changes:

  • Expand DHCPv6 PD compilation guards to include _ONESTACK_PRODUCT_REQ_ across the provisioning state machine and callback abstraction.
  • Add runtime gating via isFeatureSupportedInCurrentMode(FEATURE_IPV6_DELEGATION) to ignore PD TLVs and avoid starting/stopping the DHCPv6 client when PD is disabled.
  • Conditionally register the topology-mode TLV callback based on the runtime PD feature state.

Reviewed changes

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

File Description
source/CMAgentSsp/gw_prov_sm.c Adds OneStack compile guards and runtime feature gating for PD TLVs, DHCPv6 client sysevents, and callback registration.
source/CMAgentSsp/gw_prov_abstraction.h Extends the callback typedef/member guarding to include _ONESTACK_PRODUCT_REQ_.

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

Comment on lines +1023 to +1028
#ifdef _ONESTACK_PRODUCT_REQ_
if (!isFeatureSupportedInCurrentMode(FEATURE_IPV6_DELEGATION))
{
/* PD feature disabled — ignore TLV */
return TLV_PARSE_CALLBACK_OK_EXTIF;
}
Copy link

Copilot AI Feb 11, 2026

Choose a reason for hiding this comment

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

When _ONESTACK_PRODUCT_REQ_ is enabled, this code introduces references to isFeatureSupportedInCurrentMode() and FEATURE_IPV6_DELEGATION, but there is no declaration/definition visible in this repository or included headers in this file. Please include the proper header (or add an extern prototype / enum definition) under _ONESTACK_PRODUCT_REQ_ so OneStack builds don’t fail with an implicit declaration / undefined identifier.

Copilot uses AI. Check for mistakes.
Comment on lines +2173 to 2181
#if defined(CISCO_CONFIG_DHCPV6_PREFIX_DELEGATION) || defined(_ONESTACK_PRODUCT_REQ_)
#if defined(_ONESTACK_PRODUCT_REQ_)
if (isFeatureSupportedInCurrentMode(FEATURE_IPV6_DELEGATION))
#endif
{
v_secure_system("sysevent set dhcpv6_client-stop");
}
#endif
}
Copy link

Copilot AI Feb 11, 2026

Choose a reason for hiding this comment

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

Preprocessor directives in this block are indented inside the function body, which is inconsistent with most other #if/#endif usage in this file and makes the conditional structure harder to read/maintain. Consider left-aligning the #if/#endif to column 0 (and keeping the runtime if indented) to match surrounding style.

Suggested change
#if defined(CISCO_CONFIG_DHCPV6_PREFIX_DELEGATION) || defined(_ONESTACK_PRODUCT_REQ_)
#if defined(_ONESTACK_PRODUCT_REQ_)
if (isFeatureSupportedInCurrentMode(FEATURE_IPV6_DELEGATION))
#endif
{
v_secure_system("sysevent set dhcpv6_client-stop");
}
#endif
}
#if defined(CISCO_CONFIG_DHCPV6_PREFIX_DELEGATION) || defined(_ONESTACK_PRODUCT_REQ_)
#if defined(_ONESTACK_PRODUCT_REQ_)
if (isFeatureSupportedInCurrentMode(FEATURE_IPV6_DELEGATION))
#endif
{
v_secure_system("sysevent set dhcpv6_client-stop");
}
#endif
}

Copilot uses AI. Check for mistakes.
Comment on lines +3919 to +3926
#if defined(CISCO_CONFIG_DHCPV6_PREFIX_DELEGATION) || defined(_ONESTACK_PRODUCT_REQ_)
#if defined(_ONESTACK_PRODUCT_REQ_)
if (isFeatureSupportedInCurrentMode(FEATURE_IPV6_DELEGATION))
#endif
{
void* pGW_setTopologyMode = GW_setTopologyMode;
obj->pGW_SetTopologyMode = (fpGW_SetTopologyMode)pGW_setTopologyMode;
}
Copy link

Copilot AI Feb 11, 2026

Choose a reason for hiding this comment

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

RegisterDocsisCallback() allocates appCallBack with malloc() and does not zero-initialize it. With the new runtime gating, when IPv6 delegation is not supported pGW_SetTopologyMode is left uninitialized (garbage) instead of being set to NULL, which can lead to crashes if the state machine reads/calls it. Please ensure the struct is zeroed (e.g., calloc/memset) or explicitly set obj->pGW_SetTopologyMode = NULL in the non-supported path.

Copilot uses AI. Check for mistakes.
Copilot AI review requested due to automatic review settings February 12, 2026 12:56
Copy link

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

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


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

Comment on lines 208 to 232
@@ -227,7 +227,7 @@ typedef struct __appCallBack
fpDocsisRATransInterval pDocsis_GetRATransInterval;
#endif
fpGW_Tr069PaSubTLVParse pGW_Tr069PaSubTLVParse;
#if defined (CISCO_CONFIG_DHCPV6_PREFIX_DELEGATION)
#if defined(CISCO_CONFIG_DHCPV6_PREFIX_DELEGATION) || defined(_ONESTACK_PRODUCT_REQ_)
fpGW_SetTopologyMode pGW_SetTopologyMode;
#endif
Copy link

Copilot AI Feb 12, 2026

Choose a reason for hiding this comment

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

This header now conditionally changes the appCallBack struct layout when _ONESTACK_PRODUCT_REQ_ is defined. Since CcspCMAgentSsp links against an external -lgwprovappabs library (where SME_CreateEventHandler likely consumes appCallBack), any mismatch in whether _ONESTACK_PRODUCT_REQ_ is defined between the executable and that library can cause ABI/layout corruption at runtime. Ensure the same macro is defined consistently for all compilation units that include this header (or avoid changing the struct layout via conditional compilation).

Copilot uses AI. Check for mistakes.
@@ -143,5 +143,6 @@ AC_CONFIG_FILES(

AM_CONDITIONAL([PLATFORM_PUMA7_ENABLED], [test $PLATFORM_PUMA7_ENABLED = yes])
AM_CONDITIONAL([FEATURE_RDKB_WAN_MANAGER], [test $FEATURE_RDKB_WAN_MANAGER = yes])
Copy link

Copilot AI Feb 12, 2026

Choose a reason for hiding this comment

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

This adds an Automake conditional for ONESTACK_PRODUCT_REQ, but it is not wired to any AC_ARG_ENABLE/AC_ARG_WITH or AC_DEFINE that would propagate a corresponding C macro (e.g., _ONESTACK_PRODUCT_REQ_) into config.h/compile flags. If this repo is expected to control the feature via configure, add a proper AC_ARG_ENABLE (or similar) and an AC_DEFINE so the C sources and all dependent components can reliably compile the intended code paths.

Suggested change
AM_CONDITIONAL([FEATURE_RDKB_WAN_MANAGER], [test $FEATURE_RDKB_WAN_MANAGER = yes])
AM_CONDITIONAL([FEATURE_RDKB_WAN_MANAGER], [test $FEATURE_RDKB_WAN_MANAGER = yes])
ONESTACK_PRODUCT_REQ=false
AC_ARG_ENABLE([onestack_product_req],
AS_HELP_STRING([--enable-onestack_product_req],[enable OneStack product requirements support]),
[
case "${enableval}" in
yes)
ONESTACK_PRODUCT_REQ=true
AC_DEFINE([_ONESTACK_PRODUCT_REQ_],[1],
[Enable OneStack product requirements support])
;;
no)
ONESTACK_PRODUCT_REQ=false
;;
*)
AC_MSG_ERROR([bad value ${enableval} for --enable-onestack_product_req])
;;
esac
],
[ONESTACK_PRODUCT_REQ=false])

Copilot uses AI. Check for mistakes.
Comment on lines +3921 to +3928
#if defined(CISCO_CONFIG_DHCPV6_PREFIX_DELEGATION) || defined(_ONESTACK_PRODUCT_REQ_)
#if defined(_ONESTACK_PRODUCT_REQ_)
if (isFeatureSupportedInCurrentMode(FEATURE_IPV6_DELEGATION))
#endif
{
void* pGW_setTopologyMode = GW_setTopologyMode;
obj->pGW_SetTopologyMode = (fpGW_SetTopologyMode)pGW_setTopologyMode;
}
Copy link

Copilot AI Feb 12, 2026

Choose a reason for hiding this comment

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

When _ONESTACK_PRODUCT_REQ_ is defined but FEATURE_IPV6_DELEGATION is not supported, this block skips assigning obj->pGW_SetTopologyMode. Since obj is allocated with malloc (not zeroed), pGW_SetTopologyMode may contain an indeterminate value, which can lead to a crash/UB if the callback is invoked. Initialize the struct (e.g., zero-initialize or explicitly set pGW_SetTopologyMode = NULL in the non-supported path).

Copilot uses AI. Check for mistakes.
CcspCMAgentSsp_LDFLAGS += -lnet
endif
if ONESTACK_PRODUCT_REQ
CcspCMAgentSsp_LDFLAGS += -ldevicemode -lonestack_syscfg -lonestack_log -lrdkb_feature_mode_gate
Copy link

Copilot AI Feb 12, 2026

Choose a reason for hiding this comment

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

_ONESTACK_PRODUCT_REQ_ is used as the C preprocessor feature flag throughout the code, but the build system change introduces an Automake conditional named ONESTACK_PRODUCT_REQ and only adds link libraries here. As-is, enabling the conditional won’t define _ONESTACK_PRODUCT_REQ_, so the new code paths (and header changes guarded by _ONESTACK_PRODUCT_REQ_) won’t compile in as intended. Add a consistent compile-time definition (e.g., CcspCMAgentSsp_CPPFLAGS += -D_ONESTACK_PRODUCT_REQ_ under this conditional, or switch the C guards to match the defined macro).

Suggested change
CcspCMAgentSsp_LDFLAGS += -ldevicemode -lonestack_syscfg -lonestack_log -lrdkb_feature_mode_gate
CcspCMAgentSsp_LDFLAGS += -ldevicemode -lonestack_syscfg -lonestack_log -lrdkb_feature_mode_gate
CcspCMAgentSsp_CPPFLAGS += -D_ONESTACK_PRODUCT_REQ_

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.

1 participant