Skip to content

Comments

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

Open
rirfha948 wants to merge 3 commits intordkcentral:mainfrom
rirfha948:main
Open

RDKB-63098: Handle IPv6 delegation for business vs residential Partner ID as part of single build#188
rirfha948 wants to merge 3 commits intordkcentral:mainfrom
rirfha948:main

Conversation

@rirfha948
Copy link

Reason for change: Added One Stack MACRO handling
Test Procedure:

  1. Is this a Bug or a User Story (US)?

User Story

  1. If it is a User Story:
    • Have all dependent PRs from other components been listed (if any)?

    • Does the commit message include both the User Story ticket and the Subtask ticket?

Yes
* Will be all changes related to the User Story squashed and merged in a single commit?
No
* Has the PR been raised only after completing all changes for the User Story (no partial changes)?
Yes
* Has code development for the User Story been completed?
* If yes, has the Gerrit topic or list of all dependent PRs across components (including meta-layer changes) been shared?
Yes

  1. Is there a validation log available in the Jira ticket for verifying builds with the updated generic-srcrev.inc across all platforms?
    • If yes, have the links to validation comments been shared?

rirfha948 and others added 3 commits February 18, 2026 11:02
Reason for change: Added Single Build- OneStack handling
Test Procedure:
  - TBD
Risks: None
Priority: P3
Signed-off-by: rirfha948 <rasina_irfhan@comcast.com>
Reason for change: Added Single Build- OneStack 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 19, 2026 04:46
@rirfha948 rirfha948 requested a review from a team as a code owner February 19, 2026 04:46
Copy link
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 pull request implements runtime feature detection for IPv6 delegation to support both business and residential Partner IDs in a single build for OneStack products. The changes introduce the _ONESTACK_PRODUCT_REQ_ macro and use the isFeatureSupportedInCurrentMode(FEATURE_IPV6_DELEGATION) function to determine at runtime whether IPv6 delegation should be enabled, replacing the previous compile-time-only approach.

Changes:

  • Added runtime feature detection using isFeatureSupportedInCurrentMode() to conditionally enable IPv6 delegation based on product mode
  • Integrated rdkb_feature_mode_gate library and related OneStack dependencies into the build system
  • Modified DHCPv6 client operations (start/stop) and prefix handling logic to support both delegation modes in a single binary

Reviewed changes

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

File Description
source/WanManager/wanmgr_dhcpv6_apis.c Added runtime feature detection for DHCPv6 client operations and IPv6 prefix delegation/handling with conditional compilation using _ONESTACK_PRODUCT_REQ_
source/WanManager/wanmgr_dhcp_legacy_apis.c Updated legacy DHCPv6 APIs with runtime feature checks for prefix length handling and server restart operations
source/WanManager/Makefile.am Added linker dependencies for OneStack libraries (devicemode, onestack_syscfg, onestack_log, rdkb_feature_mode_gate)
configure.ac Added AM_CONDITIONAL for ONESTACK_PRODUCT_REQ to enable OneStack feature detection in the build system

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

#ifdef _ONESTACK_PRODUCT_REQ_
if (isFeatureSupportedInCurrentMode(FEATURE_IPV6_DELEGATION))
{

Copy link

Copilot AI Feb 19, 2026

Choose a reason for hiding this comment

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

There is an empty line (line 453) inside the if block that serves no purpose. This should be removed to maintain clean code formatting and consistency with the rest of the codebase.

Suggested change

Copilot uses AI. Check for mistakes.
#if defined(_ONESTACK_PRODUCT_REQ_)
if (isFeatureSupportedInCurrentMode(FEATURE_IPV6_DELEGATION))
#endif
{
Copy link

Copilot AI Feb 19, 2026

Choose a reason for hiding this comment

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

There is trailing whitespace after the opening brace on line 2203. This should be removed to maintain clean code formatting.

Suggested change
{
{

Copilot uses AI. Check for mistakes.
{
sysevent_set(sysevent_fd, sysevent_token, "dhcpv6_client-start", "", 0);
}
else
Copy link

Copilot AI Feb 19, 2026

Choose a reason for hiding this comment

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

There is trailing whitespace after "else" on line 575. This should be removed to maintain clean code formatting.

Suggested change
else
else

Copilot uses AI. Check for mistakes.
Comment on lines +1811 to +1828
#if defined(CISCO_CONFIG_DHCPV6_PREFIX_DELEGATION) || defined(_ONESTACK_PRODUCT_REQ_)
#if defined(_ONESTACK_PRODUCT_REQ_)
if (isFeatureSupportedInCurrentMode(FEATURE_IPV6_DELEGATION))
#endif
{
/* Use the delegated prefix length directly for platforms that support prefix delegation to LAN clients */
strncpy(prefix, pVirtIf->IP.Ipv6Data.sitePrefix, sizeof(prefix) - 1);
}
#endif
#if !defined(CISCO_CONFIG_DHCPV6_PREFIX_DELEGATION) || defined(_ONESTACK_PRODUCT_REQ_)
#if defined(_ONESTACK_PRODUCT_REQ_)
if (!isFeatureSupportedInCurrentMode(FEATURE_IPV6_DELEGATION))
#endif
{
strncat(prefix, "/64", sizeof(prefix) - 1);
}
#endif
sysevent_set(sysevent_fd, sysevent_token, SYSEVENT_FIELD_IPV6_PREFIX, prefix, 0);
sysevent_set(sysevent_fd, sysevent_token, SYSEVENT_FIELD_IPV6_PREFIX, prefix, 0);
Copy link

Copilot AI Feb 19, 2026

Choose a reason for hiding this comment

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

The indentation in this block uses tabs instead of spaces, which is inconsistent with the surrounding code. Lines 1811-1828 appear to use hard tabs for indentation, while the codebase generally uses spaces for indentation. This inconsistency should be corrected to maintain uniform code style.

Copilot uses AI. Check for mistakes.
Comment on lines +2027 to +2040
if (isFeatureSupportedInCurrentMode(FEATURE_IPV6_DELEGATION))
#endif
{
/* Use the delegated prefix length directly for platforms that support prefix delegation to LAN clients */
strncpy(lanPrefix, pVirtIf->IP.Ipv6Data.sitePrefix, sizeof(lanPrefix) - 1);
}
#endif
#if !defined(CISCO_CONFIG_DHCPV6_PREFIX_DELEGATION) || defined(_ONESTACK_PRODUCT_REQ_)
#if defined(_ONESTACK_PRODUCT_REQ_)
if (!isFeatureSupportedInCurrentMode(FEATURE_IPV6_DELEGATION))
#endif
{
strncat(lanPrefix, "/64", sizeof(lanPrefix) - strlen(lanPrefix) - 1);
}
Copy link

Copilot AI Feb 19, 2026

Choose a reason for hiding this comment

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

The indentation in this block uses tabs instead of spaces, which is inconsistent with the surrounding code. This inconsistency should be corrected to maintain uniform code style.

Suggested change
if (isFeatureSupportedInCurrentMode(FEATURE_IPV6_DELEGATION))
#endif
{
/* Use the delegated prefix length directly for platforms that support prefix delegation to LAN clients */
strncpy(lanPrefix, pVirtIf->IP.Ipv6Data.sitePrefix, sizeof(lanPrefix) - 1);
}
#endif
#if !defined(CISCO_CONFIG_DHCPV6_PREFIX_DELEGATION) || defined(_ONESTACK_PRODUCT_REQ_)
#if defined(_ONESTACK_PRODUCT_REQ_)
if (!isFeatureSupportedInCurrentMode(FEATURE_IPV6_DELEGATION))
#endif
{
strncat(lanPrefix, "/64", sizeof(lanPrefix) - strlen(lanPrefix) - 1);
}
if (isFeatureSupportedInCurrentMode(FEATURE_IPV6_DELEGATION))
#endif
{
/* Use the delegated prefix length directly for platforms that support prefix delegation to LAN clients */
strncpy(lanPrefix, pVirtIf->IP.Ipv6Data.sitePrefix, sizeof(lanPrefix) - 1);
}
#endif
#if !defined(CISCO_CONFIG_DHCPV6_PREFIX_DELEGATION) || defined(_ONESTACK_PRODUCT_REQ_)
#if defined(_ONESTACK_PRODUCT_REQ_)
if (!isFeatureSupportedInCurrentMode(FEATURE_IPV6_DELEGATION))
#endif
{
strncat(lanPrefix, "/64", sizeof(lanPrefix) - strlen(lanPrefix) - 1);
}

Copilot uses AI. Check for mistakes.
@@ -548,15 +567,30 @@ static int _dibbler_client_operation(char * arg)
/*TCXB6 is also calling service_dhcpv6_client.sh but the actuall script is installed from meta-rdk-oem layer as the intel specific code
had to be removed */
CcspTraceInfo(("%s Callin service_dhcpv6_client.sh enable \n", __func__));
Copy link

Copilot AI Feb 19, 2026

Choose a reason for hiding this comment

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

Spelling error: "Callin" should be "Calling". This typo exists in the comment on line 569 and is visible in the context of this change.

Suggested change
CcspTraceInfo(("%s Callin service_dhcpv6_client.sh enable \n", __func__));
CcspTraceInfo(("%s Calling service_dhcpv6_client.sh enable \n", __func__));

Copilot uses AI. Check for mistakes.
/* handle message from wan dchcp6 client */
WanMgr_DmlDhcpv6SMsgHandler(NULL);

#ifdef _ONESTACK_PRODUCT_REQ_
Copy link

Copilot AI Feb 19, 2026

Choose a reason for hiding this comment

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

The preprocessor directive is indented with spaces, which is inconsistent with standard C preprocessor directive style. Preprocessor directives typically start at column 0. While this code will compile correctly, it deviates from conventional style.

Suggested change
#ifdef _ONESTACK_PRODUCT_REQ_
#ifdef _ONESTACK_PRODUCT_REQ_

Copilot uses AI. Check for mistakes.
Comment on lines +743 to +757
#if defined(CISCO_CONFIG_DHCPV6_PREFIX_DELEGATION) || defined(_ONESTACK_PRODUCT_REQ_)
#if defined(_ONESTACK_PRODUCT_REQ_)
if (isFeatureSupportedInCurrentMode(FEATURE_IPV6_DELEGATION))
#endif
{
sprintf(v6pref+strlen(v6pref), "/%d", pref_len);
#else
}
#endif
#if !defined(CISCO_CONFIG_DHCPV6_PREFIX_DELEGATION) || defined(_ONESTACK_PRODUCT_REQ_)
#if defined(_ONESTACK_PRODUCT_REQ_)
if (!isFeatureSupportedInCurrentMode(FEATURE_IPV6_DELEGATION))
#endif
{
sprintf(v6pref+strlen(v6pref), "/%d", 64);
}
Copy link

Copilot AI Feb 19, 2026

Choose a reason for hiding this comment

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

The indentation in this section uses mixed indentation styles - preprocessor directives with leading spaces and inconsistent indentation of the if statement and braces. This should be normalized to follow consistent indentation standards throughout the file.

Copilot uses AI. Check for mistakes.
Comment on lines +2199 to 2224
#if (defined(CISCO_CONFIG_DHCPV6_PREFIX_DELEGATION) && ! defined(DHCPV6_PREFIX_FIX)) || defined(_ONESTACK_PRODUCT_REQ_)
#if defined(_ONESTACK_PRODUCT_REQ_)
if (isFeatureSupportedInCurrentMode(FEATURE_IPV6_DELEGATION))
#endif
{
CcspTraceWarning(("%s: setting dhcpv6_server-restart\n", __FUNCTION__));
sysevent_set(sysevent_fd, sysevent_token, "dhcpv6_server-restart", "", 0);
}
#endif
#if !defined(CISCO_CONFIG_DHCPV6_PREFIX_DELEGATION) || defined(_ONESTACK_PRODUCT_REQ_)
#if defined(_ONESTACK_PRODUCT_REQ_)
if (!isFeatureSupportedInCurrentMode(FEATURE_IPV6_DELEGATION))
#endif
{
fprintf(stderr, "open dhcpv6 server restart fifo when writing.\n");
return 1;
// Below code copied from CosaDmlDHCPv6sTriggerRestart(FALSE) PAm function.
int fd = 0;
char str[32] = "restart";
fd= open(DHCPS6V_SERVER_RESTART_FIFO, O_RDWR);
if (fd < 0)
{
fprintf(stderr, "open dhcpv6 server restart fifo when writing.\n");
return 1;
}
write( fd, str, sizeof(str) );
close(fd);
}
Copy link

Copilot AI Feb 19, 2026

Choose a reason for hiding this comment

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

The indentation in this block uses tabs instead of spaces, which is inconsistent with the surrounding code. This inconsistency should be corrected to maintain uniform code style.

Copilot uses AI. Check for mistakes.
@@ -444,15 +447,31 @@ static int _dibbler_client_operation(char * arg)
CcspTraceInfo(("%s stop\n", __func__));
/*TCXB6 is also calling service_dhcpv6_client.sh but the actuall script is installed from meta-rdk-oem layer as the intel specific code
Copy link

Copilot AI Feb 19, 2026

Choose a reason for hiding this comment

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

Spelling error: "actuall" should be "actual". This typo exists in the comment on line 448 and is visible in the context of this change.

Suggested change
/*TCXB6 is also calling service_dhcpv6_client.sh but the actuall script is installed from meta-rdk-oem layer as the intel specific code
/*TCXB6 is also calling service_dhcpv6_client.sh but the actual script is installed from meta-rdk-oem layer as the intel specific code

Copilot uses AI. Check for mistakes.
@kartikg33
Copy link
Contributor

@rirfha948 @guto86
What is "OneStack"? Do we need a feature flag for this IPv6 change or could we just make this a default functionality?

!defined(_ONESTACK_PRODUCT_REQ_)

#else
#ifdef _ONESTACK_PRODUCT_REQ_
Copy link
Contributor

Choose a reason for hiding this comment

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

More build flags?
Why can't we write a generic code?

endif

if ONESTACK_PRODUCT_REQ
wanmanager_LDADD += -ldevicemode -lonestack_syscfg -lonestack_log -lrdkb_feature_mode_gate
Copy link
Contributor

Choose a reason for hiding this comment

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

What are these libraries?
What is the difference between existing rdk libaraies?

strncat(prefix, "/64", sizeof(prefix) - 1);
#if defined(CISCO_CONFIG_DHCPV6_PREFIX_DELEGATION) || defined(_ONESTACK_PRODUCT_REQ_)
#if defined(_ONESTACK_PRODUCT_REQ_)
if (isFeatureSupportedInCurrentMode(FEATURE_IPV6_DELEGATION))
Copy link
Contributor

Choose a reason for hiding this comment

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

As per the rdk design, we control the features based on the PSM/other DB internal to the app.
Why do we need all these implementations just to know if a platform supports prefix delegation?

v_secure_system("/usr/bin/service_dhcpv6_client dhcpv6_client_service_disable");
CcspTraceInfo(("%s Calling service_dhcpv6_client.c with dhcpv6_client_service_disable from wanmgr_dhcpv6_apis.c\n", __func__));
#else
v_secure_system("/etc/utopia/service.d/service_dhcpv6_client.sh disable &");
Copy link
Contributor

Choose a reason for hiding this comment

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

What service_dhcpv6_client.sh script is resposible for?

}
#endif
sysevent_set(sysevent_fd, sysevent_token, SYSEVENT_FIELD_IPV6_PREFIX, prefix, 0);
sysevent_set(sysevent_fd, sysevent_token, SYSEVENT_FIELD_IPV6_PREFIX, prefix, 0);

Choose a reason for hiding this comment

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

why are we setting ipv6_prefix from wan manager, it should be ideally set from DHCP manager when DHCP manager is enabled.

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.

5 participants