Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ AC_ARG_ENABLE([dhcp_manager],
],
[echo "dhcp manager is disabled"])
AM_CONDITIONAL(DHCPMANAGER_ENABLED, test "x$DHCPMANAGER_SUPPORT_ENABLED" = xtrue)

AM_CONDITIONAL([ONESTACK_PRODUCT_REQ], [test "x$ONESTACK_PRODUCT_REQ" = "xtrue"])
dnl Checks for header files.
AC_CHECK_HEADERS([limits.h memory.h stdlib.h string.h sys/socket.h unistd.h])

Expand Down
4 changes: 4 additions & 0 deletions source/WanManager/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,7 @@ wanmanager_SOURCES += wanmgr_dhcp_event_handler.c
else
wanmanager_LDADD += -ldhcp_client_utils
endif

if ONESTACK_PRODUCT_REQ
wanmanager_LDADD += -ldevicemode -lonestack_syscfg -lonestack_log -lrdkb_feature_mode_gate
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.

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

endif
50 changes: 41 additions & 9 deletions source/WanManager/wanmgr_dhcp_legacy_apis.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@
#include <string.h>
#include <unistd.h>
#include "secure_wrapper.h"

#ifdef _ONESTACK_PRODUCT_REQ_
#include <rdkb_feature_mode_gate.h>
#endif
#if defined(_DT_WAN_Manager_Enable_)
int _get_shell_output2(char * cmd, char * dststr)
{
Expand Down Expand Up @@ -226,12 +228,16 @@ WanMgr_DmlDhcpv6Init
{
DSLHDMAGNT_CALLBACK * pEntry = NULL;
CcspTraceWarning(("Inside %s %d \n", __FUNCTION__, __LINE__));
#if defined(CISCO_CONFIG_DHCPV6_PREFIX_DELEGATION) && ! defined(_CBR_PRODUCT_REQ_) && ! defined(_BCI_FEATURE_REQ)
#if defined(CISCO_CONFIG_DHCPV6_PREFIX_DELEGATION) && ! defined(_CBR_PRODUCT_REQ_) && ! defined(_BCI_FEATURE_REQ) && !defined(_ONESTACK_PRODUCT_REQ_)

#else
/* 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.
if (!isFeatureSupportedInCurrentMode(FEATURE_IPV6_DELEGATION))
#endif
{
/* handle message from wan dhcp6 client */
WanMgr_DmlDhcpv6SMsgHandler(NULL);
}
#endif


Expand Down Expand Up @@ -734,16 +740,34 @@ dhcpv6c_dbg_thrd(void * in)
sprintf(v6pref+strlen(v6pref), "/%d", pref_len);
else
{
#if defined(CISCO_CONFIG_DHCPV6_PREFIX_DELEGATION)
#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);
}
Comment on lines +743 to +757
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.
#endif
}
#endif
char cmd[100];
#if defined(CISCO_CONFIG_DHCPV6_PREFIX_DELEGATION) && defined(_CBR_PRODUCT_REQ_)
#if defined(CISCO_CONFIG_DHCPV6_PREFIX_DELEGATION) && \
defined(_CBR_PRODUCT_REQ_) && \
!defined(_ONESTACK_PRODUCT_REQ_)
#else

#ifdef _ONESTACK_PRODUCT_REQ_
if (!isFeatureSupportedInCurrentMode(FEATURE_IPV6_DELEGATION))
#endif
{
char out1[100];
char *token = NULL;char *pt;
char s[2] = ",";
Expand Down Expand Up @@ -812,6 +836,7 @@ dhcpv6c_dbg_thrd(void * in)
}
}
}
}
#endif
char previous_v6pref[128] = {0};
sysevent_get(sysevent_fd, sysevent_token, "ipv6_prefix", previous_v6pref, sizeof(previous_v6pref));
Expand Down Expand Up @@ -1229,14 +1254,21 @@ dhcpv6c_dbg_thrd(void * in)
v_secure_system("sysevent set firewall-restart");
bRestartFirewall = FALSE;
}
#if defined(CISCO_CONFIG_DHCPV6_PREFIX_DELEGATION) && (defined(_CBR_PRODUCT_REQ_) || defined(_BCI_FEATURE_REQ))
#if defined(CISCO_CONFIG_DHCPV6_PREFIX_DELEGATION) && \
(defined(_CBR_PRODUCT_REQ_) || defined(_BCI_FEATURE_REQ_)) && \
!defined(_ONESTACK_PRODUCT_REQ_)

#else
#ifdef _ONESTACK_PRODUCT_REQ_
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.

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

if (!isFeatureSupportedInCurrentMode(FEATURE_IPV6_DELEGATION))
#endif
{
#ifdef LAN_MGR_SUPPORT
v_secure_system("sysevent set dhcpv6_raserver-restart");
#else
v_secure_system("sysevent set zebra-restart");
#endif
}
#endif
}

Expand Down
158 changes: 118 additions & 40 deletions source/WanManager/wanmgr_dhcpv6_apis.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,10 @@ extern token_t sysevent_token;
extern ANSC_HANDLE bus_handle;
extern char g_Subsystem[32];

#if defined(CISCO_CONFIG_DHCPV6_PREFIX_DELEGATION) && defined(_COSA_BCM_MIPS_)
#ifdef _ONESTACK_PRODUCT_REQ_
#include <rdkb_feature_mode_gate.h>
#endif
#if (defined(CISCO_CONFIG_DHCPV6_PREFIX_DELEGATION) && defined(_COSA_BCM_MIPS_)) || defined(_ONESTACK_PRODUCT_REQ_)
#include <netinet/in.h>
#endif
#define CLIENT_DUID_FILE "/var/lib/dibbler/client-duid"
Expand Down Expand Up @@ -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.
had to be removed */
#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.
sysevent_set(sysevent_fd, sysevent_token, "dhcpv6_client-stop", "", 0);
}
else
{
#if defined(CORE_NET_LIB)
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
Copy Markdown
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
}
Comment on lines +451 to +464
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 451-464 appear to use hard tabs, while the codebase generally uses spaces for indentation (e.g., lines 447, 476-477). This inconsistency should be corrected to maintain uniform code style.

Suggested change
if (isFeatureSupportedInCurrentMode(FEATURE_IPV6_DELEGATION))
{
sysevent_set(sysevent_fd, sysevent_token, "dhcpv6_client-stop", "", 0);
}
else
{
#if defined(CORE_NET_LIB)
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 &");
#endif
}
if (isFeatureSupportedInCurrentMode(FEATURE_IPV6_DELEGATION))
{
sysevent_set(sysevent_fd, sysevent_token, "dhcpv6_client-stop", "", 0);
}
else
{
#if defined(CORE_NET_LIB)
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 &");
#endif
}

Copilot uses AI. Check for mistakes.
#else
#if defined(CISCO_CONFIG_DHCPV6_PREFIX_DELEGATION) && ! defined(DHCPV6_PREFIX_FIX)
sysevent_set(sysevent_fd, sysevent_token, "dhcpv6_client-stop", "", 0);
sysevent_set(sysevent_fd, sysevent_token, "dhcpv6_client-stop", "", 0);
#elif defined(CORE_NET_LIB)
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__));
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 &");
v_secure_system("/etc/utopia/service.d/service_dhcpv6_client.sh disable &");
#endif
#endif

#ifdef _COSA_BCM_ARM_
if (TRUE == WanManager_IsApplicationRunning (CLIENT_BIN, NULL))
{
Expand Down Expand Up @@ -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.
#ifdef _ONESTACK_PRODUCT_REQ_
if (isFeatureSupportedInCurrentMode(FEATURE_IPV6_DELEGATION))
{
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.
{
#if defined(CORE_NET_LIB)
v_secure_system("/usr/bin/service_dhcpv6_client dhcpv6_client_service_enable");
CcspTraceInfo(("%s Calling service_dhcpv6_client.c with dhcpv6_client_service_enable from wanmgr_dhcpv6_apis.c\n", __func__));
#else
v_secure_system("/etc/utopia/service.d/service_dhcpv6_client.sh enable &");
#endif
}
Comment on lines +571 to +583
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. The same indentation inconsistency found in the "stop" operation above is repeated here. Lines 570-584 should use spaces for indentation to match the codebase style.

Suggested change
if (isFeatureSupportedInCurrentMode(FEATURE_IPV6_DELEGATION))
{
sysevent_set(sysevent_fd, sysevent_token, "dhcpv6_client-start", "", 0);
}
else
{
#if defined(CORE_NET_LIB)
v_secure_system("/usr/bin/service_dhcpv6_client dhcpv6_client_service_enable");
CcspTraceInfo(("%s Calling service_dhcpv6_client.c with dhcpv6_client_service_enable from wanmgr_dhcpv6_apis.c\n", __func__));
#else
v_secure_system("/etc/utopia/service.d/service_dhcpv6_client.sh enable &");
#endif
}
if (isFeatureSupportedInCurrentMode(FEATURE_IPV6_DELEGATION))
{
sysevent_set(sysevent_fd, sysevent_token, "dhcpv6_client-start", "", 0);
}
else
{
#if defined(CORE_NET_LIB)
v_secure_system("/usr/bin/service_dhcpv6_client dhcpv6_client_service_enable");
CcspTraceInfo(("%s Calling service_dhcpv6_client.c with dhcpv6_client_service_enable from wanmgr_dhcpv6_apis.c\n", __func__));
#else
v_secure_system("/etc/utopia/service.d/service_dhcpv6_client.sh enable &");
#endif
}

Copilot uses AI. Check for mistakes.
#else
#if defined(CISCO_CONFIG_DHCPV6_PREFIX_DELEGATION) && ! defined(DHCPV6_PREFIX_FIX)
sysevent_set(sysevent_fd, sysevent_token, "dhcpv6_client-start", "", 0);
sysevent_set(sysevent_fd, sysevent_token, "dhcpv6_client-start", "", 0);
#elif defined(CORE_NET_LIB)
v_secure_system("/usr/bin/service_dhcpv6_client dhcpv6_client_service_enable");
CcspTraceInfo(("%s Calling service_dhcpv6_client.c with dhcpv6_client_service_enable from wanmgr_dhcpv6_apis.c\n", __func__));
v_secure_system("/usr/bin/service_dhcpv6_client dhcpv6_client_service_enable");
CcspTraceInfo(("%s Calling service_dhcpv6_client.c with dhcpv6_client_service_enable from wanmgr_dhcpv6_apis.c\n", __func__));
#else
v_secure_system("/etc/utopia/service.d/service_dhcpv6_client.sh enable &");
#endif

#endif
#ifdef _COSA_BCM_ARM_
/* Dibbler-init is called to set the pre-configuration for dibbler */
CcspTraceInfo(("%s dibbler-init.sh Called \n", __func__));
Expand Down Expand Up @@ -1774,13 +1808,24 @@ ANSC_STATUS wanmgr_handle_dhcpv6_event_data(DML_VIRTUAL_IFACE * pVirtIf)
if (strcmp(pDhcp6cInfoCur->sitePrefix, pNewIpcMsg->sitePrefix) != 0)
{
CcspTraceInfo(("%s %d new prefix = %s, current prefix = %s \n", __FUNCTION__, __LINE__, pNewIpcMsg->sitePrefix, pDhcp6cInfoCur->sitePrefix));
#if defined(CISCO_CONFIG_DHCPV6_PREFIX_DELEGATION)
/* Use the delegated prefix length directly for platforms that support prefix delegation to LAN clients */
strncpy(prefix, pVirtIf->IP.Ipv6Data.sitePrefix, sizeof(prefix) - 1);
#else
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
Copy Markdown
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?

#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);
Comment on lines +1811 to +1828
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.
Copy link
Copy Markdown

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.

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.

Hello @snayak002c
This is correct as per the latest dhcp-manager design working along with other RDK components.
The earlier implementation of the dhcp-manager, trying to replace RDK WAN components, has been deprecated and removed.
Please refer to the links below for the DHCP Manager design.
https://github.com/rdkcentral/dhcp-manager/tree/develop/docs

https://wiki.rdkcentral.com/pages/viewpage.action?spaceKey=WG&title=LLD+-+DHCP+and+WAN+manager+integration

}
}
}
Expand Down Expand Up @@ -1977,11 +2022,22 @@ int setUpLanPrefixIPv6(DML_VIRTUAL_IFACE* pVirtIf)
char previousPrefix[BUFLEN_48] = {0};
char previousPrefix_vldtime[BUFLEN_48] = {0};
char previousPrefix_prdtime[BUFLEN_48] = {0};
#if defined(CISCO_CONFIG_DHCPV6_PREFIX_DELEGATION)
/* Use the delegated prefix length directly for platforms that support prefix delegation to LAN clients */
strncpy(lanPrefix, pVirtIf->IP.Ipv6Data.sitePrefix, sizeof(lanPrefix) - 1);
#else
strncat(lanPrefix, "/64", sizeof(lanPrefix) - strlen(lanPrefix) - 1);
#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(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);
}
Comment on lines +2027 to +2040
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.
#endif
sysevent_get(sysevent_fd, sysevent_token, SYSEVENT_FIELD_IPV6_PREFIX, previousPrefix, sizeof(previousPrefix));
sysevent_get(sysevent_fd, sysevent_token, SYSEVENT_FIELD_IPV6_PREFIXVLTIME, previousPrefix_vldtime, sizeof(previousPrefix_vldtime));
Expand Down Expand Up @@ -2086,11 +2142,22 @@ int setUpLanPrefixIPv6(DML_VIRTUAL_IFACE* pVirtIf)
syscfg_set_string(SYSCFG_FIELD_IPV6_PREFIX_ADDRESS, pVirtIf->IP.Ipv6Data.pdIfAddress);
sysevent_set(sysevent_fd, sysevent_token, SYSEVENT_FIELD_TR_BRLAN0_DHCPV6_SERVER_ADDRESS, set_value, 0);
CcspTraceInfo(("%s %d new prefix = %s\n", __FUNCTION__, __LINE__, pVirtIf->IP.Ipv6Data.sitePrefix));
#if defined(CISCO_CONFIG_DHCPV6_PREFIX_DELEGATION)
/* Use the delegated prefix length directly for platforms that support prefix delegation to LAN clients */
strncpy(prefix, pVirtIf->IP.Ipv6Data.sitePrefix, sizeof(prefix) - 1);
#else
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))
#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);
}
Comment on lines +2147 to +2160
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(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);
}
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);
}

Copilot uses AI. Check for mistakes.
#endif
sysevent_set(sysevent_fd, sysevent_token, SYSEVENT_FIELD_IPV6_PREFIX, prefix, 0);
sysevent_set(sysevent_fd, sysevent_token, "lan_prefix", prefix, 0);
Expand Down Expand Up @@ -2129,21 +2196,32 @@ int setUpLanPrefixIPv6(DML_VIRTUAL_IFACE* pVirtIf)

CcspTraceWarning(("%s: setting lan-restart\n", __FUNCTION__));
sysevent_set(sysevent_fd, sysevent_token, "lan-restart", "1", 0);
#if defined(CISCO_CONFIG_DHCPV6_PREFIX_DELEGATION) && ! defined(DHCPV6_PREFIX_FIX)
CcspTraceWarning(("%s: setting dhcpv6_server-restart\n", __FUNCTION__));
sysevent_set(sysevent_fd, sysevent_token, "dhcpv6_server-restart", "", 0);
#else
// 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)
#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
{
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.
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);
}
Comment on lines +2199 to 2224
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.
write( fd, str, sizeof(str) );
close(fd);
#endif
#endif
#endif
Expand All @@ -2157,7 +2235,7 @@ ANSC_STATUS WanMgr_Handle_Dhcpv6_NetLink_Address_Event(IPv6NetLinkAddrEvent *pst

if( NULL == pstAddrEvent )
{
CcspTraceError(("%s %d - Invalid memory \n", __FUNCTION__, __LINE__));
CcspTraceError(("%s %d - Invalid memory \n", __FUNCTION__, __LINE__));
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.

This line was changed from using spaces to tabs for indentation. This change appears unrelated to the OneStack feature being added and creates inconsistency with line 2239 which still uses spaces. It would be better to keep the original indentation or ensure both lines use the same indentation style.

Suggested change
CcspTraceError(("%s %d - Invalid memory \n", __FUNCTION__, __LINE__));
CcspTraceError(("%s %d - Invalid memory \n", __FUNCTION__, __LINE__));

Copilot uses AI. Check for mistakes.
return ret;
}

Expand Down