RDKB-63098: Handle IPv6 delegation for business vs residential Partner ID as part of single build#188
RDKB-63098: Handle IPv6 delegation for business vs residential Partner ID as part of single build#188rirfha948 wants to merge 3 commits intordkcentral:mainfrom
Conversation
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>
There was a problem hiding this comment.
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)) | ||
| { | ||
|
|
There was a problem hiding this comment.
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.
| #if defined(_ONESTACK_PRODUCT_REQ_) | ||
| if (isFeatureSupportedInCurrentMode(FEATURE_IPV6_DELEGATION)) | ||
| #endif | ||
| { |
There was a problem hiding this comment.
There is trailing whitespace after the opening brace on line 2203. This should be removed to maintain clean code formatting.
| { | |
| { |
| { | ||
| sysevent_set(sysevent_fd, sysevent_token, "dhcpv6_client-start", "", 0); | ||
| } | ||
| else |
There was a problem hiding this comment.
There is trailing whitespace after "else" on line 575. This should be removed to maintain clean code formatting.
| else | |
| else |
| #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); |
There was a problem hiding this comment.
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.
| 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); | ||
| } |
There was a problem hiding this comment.
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.
| 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); | |
| } |
| @@ -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__)); | |||
There was a problem hiding this comment.
Spelling error: "Callin" should be "Calling". This typo exists in the comment on line 569 and is visible in the context of this change.
| CcspTraceInfo(("%s Callin service_dhcpv6_client.sh enable \n", __func__)); | |
| CcspTraceInfo(("%s Calling service_dhcpv6_client.sh enable \n", __func__)); |
| /* handle message from wan dchcp6 client */ | ||
| WanMgr_DmlDhcpv6SMsgHandler(NULL); | ||
|
|
||
| #ifdef _ONESTACK_PRODUCT_REQ_ |
There was a problem hiding this comment.
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.
| #ifdef _ONESTACK_PRODUCT_REQ_ | |
| #ifdef _ONESTACK_PRODUCT_REQ_ |
| #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); | ||
| } |
There was a problem hiding this comment.
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.
| #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); | ||
| } |
There was a problem hiding this comment.
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.
| @@ -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 | |||
There was a problem hiding this comment.
Spelling error: "actuall" should be "actual". This typo exists in the comment on line 448 and is visible in the context of this 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 |
|
@rirfha948 @guto86 |
| !defined(_ONESTACK_PRODUCT_REQ_) | ||
|
|
||
| #else | ||
| #ifdef _ONESTACK_PRODUCT_REQ_ |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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)) |
There was a problem hiding this comment.
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 &"); |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
why are we setting ipv6_prefix from wan manager, it should be ideally set from DHCP manager when DHCP manager is enabled.
Reason for change: Added One Stack MACRO handling
Test Procedure:
Risks: None
Priority: P1
Signed-off-by: rirfha948 rasina_irfhan@comcast.com
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?
generic-srcrev.incacross all platforms?