Skip to content
Open
Show file tree
Hide file tree
Changes from 5 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
3 changes: 3 additions & 0 deletions source/DHCPServerUtils/DHCPv6Server/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,6 @@ libCcspDhcpMgr_Dhcpv6Server_la_SOURCES += service_ipv6.c
endif

libCcspDhcpMgr_Dhcpv6Server_la_LIBADD = -lccsp_common -ltelemetry_msgsender -lulog -lsyscfg -lsysevent -ltime_conversion -lprint_uptime -lnet
if ONESTACK_PRODUCT_REQ
libCcspDhcpMgr_Dhcpv6Server_la_LIBADD += -ldevicemode -lonestack_syscfg -lonestack_log -lrdkb_feature_mode_gate
endif
48 changes: 32 additions & 16 deletions source/DHCPServerUtils/DHCPv6Server/dhcpv6server_function.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* If not stated otherwise in this file or this component's LICENSE file the
* following copyright and licenses apply:

Check failure on line 3 in source/DHCPServerUtils/DHCPv6Server/dhcpv6server_function.c

View workflow job for this annotation

GitHub Actions / call-fossid-workflow / Fossid Annotate PR

FossID License Issue Detected

Source code with 'Apache-2.0' license found in local file 'source/DHCPServerUtils/DHCPv6Server/dhcpv6server_function.c' (Match: rdkb/components/opensource/ccsp/CcspPandM/rdkb/components/opensource/ccsp/CcspPandM/1, 2002 lines, url: https://code.rdkcentral.com/r/plugins/gitiles/rdkb/components/opensource/ccsp/CcspPandM/+archive/RDKB-TEST-RELEASE-1.tar.gz, file: source-arm/TR-181/board_sbapi/cosa_dhcpv6_apis.c)

Check failure on line 3 in source/DHCPServerUtils/DHCPv6Server/dhcpv6server_function.c

View workflow job for this annotation

GitHub Actions / call-fossid-workflow / Fossid Annotate PR

FossID License Issue Detected

Source code with 'Apache-2.0' license found in local file 'source/DHCPServerUtils/DHCPv6Server/dhcpv6server_function.c' (Match: rdkb/components/opensource/ccsp/CcspPandM/rdkb/components/opensource/ccsp/CcspPandM/1, 2002 lines, url: https://code.rdkcentral.com/r/plugins/gitiles/rdkb/components/opensource/ccsp/CcspPandM/+archive/RDKB-RELEASE-TEST-DUNFELL-1.tar.gz, file: source-arm/TR-181/board_sbapi/cosa_dhcpv6_apis.c)
*
* Copyright 2020 RDK Management
*
Expand All @@ -17,7 +17,7 @@
* limitations under the License.
*/

/**********************************************************************

Check failure on line 20 in source/DHCPServerUtils/DHCPv6Server/dhcpv6server_function.c

View workflow job for this annotation

GitHub Actions / call-fossid-workflow / Fossid Annotate PR

FossID License Issue Detected

Source code with 'Apache-2.0' license found in local file 'source/DHCPServerUtils/DHCPv6Server/dhcpv6server_function.c' (Match: rdkb/components/opensource/ccsp/CcspPandM/rdkb/components/opensource/ccsp/CcspPandM/1, 1985 lines, url: https://code.rdkcentral.com/r/plugins/gitiles/rdkb/components/opensource/ccsp/CcspPandM/+archive/RDKB-TEST-RELEASE-1.tar.gz, file: arch/intel_usg/boards/arm_shared/source/TR-181/board_sbapi/cosa_dhcpv6_apis.c)
Copyright [2014] [Cisco Systems, Inc.]

Licensed under the Apache License, Version 2.0 (the "License");
Expand Down Expand Up @@ -47,7 +47,9 @@
#include "sysevent/sysevent.h"
#include "cosa_apis_util.h"
#include "ifl.h"

#ifdef _ONESTACK_PRODUCT_REQ_
#include <rdkb_feature_mode_gate.h>
#endif
extern void* g_pDslhDmlAgent;
extern ANSC_HANDLE bus_handle;
extern char g_Subsystem[32];
Expand Down Expand Up @@ -76,7 +78,7 @@
//#include "cosa_ip_apis.h"
#include "cosa_common_util.h"

#if defined(CISCO_CONFIG_DHCPV6_PREFIX_DELEGATION) && defined(_COSA_BCM_MIPS_)
#if defined((CISCO_CONFIG_DHCPV6_PREFIX_DELEGATION) && defined(_COSA_BCM_MIPS_)) || defined(_ONESTACK_PRODUCT_REQ_)
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.

The preprocessor expression uses defined((... && defined(...))), which is invalid: defined only accepts a single macro identifier. This will not compile. Use (defined(CISCO_CONFIG_DHCPV6_PREFIX_DELEGATION) && defined(_COSA_BCM_MIPS_)) || defined(_ONESTACK_PRODUCT_REQ_) instead.

Suggested change
#if defined((CISCO_CONFIG_DHCPV6_PREFIX_DELEGATION) && defined(_COSA_BCM_MIPS_)) || defined(_ONESTACK_PRODUCT_REQ_)
#if (defined(CISCO_CONFIG_DHCPV6_PREFIX_DELEGATION) && defined(_COSA_BCM_MIPS_)) || defined(_ONESTACK_PRODUCT_REQ_)

Copilot uses AI. Check for mistakes.
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 preprocessor condition is invalid C: defined cannot take an expression like (CISCO_CONFIG_DHCPV6_PREFIX_DELEGATION) && defined(_COSA_BCM_MIPS_). This will fail compilation. Rewrite as #if (defined(CISCO_CONFIG_DHCPV6_PREFIX_DELEGATION) && defined(_COSA_BCM_MIPS_)) || defined(_ONESTACK_PRODUCT_REQ_).

Suggested change
#if defined((CISCO_CONFIG_DHCPV6_PREFIX_DELEGATION) && defined(_COSA_BCM_MIPS_)) || defined(_ONESTACK_PRODUCT_REQ_)
#if (defined(CISCO_CONFIG_DHCPV6_PREFIX_DELEGATION) && defined(_COSA_BCM_MIPS_)) || defined(_ONESTACK_PRODUCT_REQ_)

Copilot uses AI. Check for mistakes.
#include <netinet/in.h>
#endif

Expand Down Expand Up @@ -223,11 +225,15 @@

#define DHCPS6V_SERVER_RESTART_FIFO "/tmp/ccsp-dhcpv6-server-restart-fifo.txt"

#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
/*

//Todo: Adapt for One stack Product
void CosaDmlDhcpv6sRestartOnLanStarted(void * arg)
{
UNREFERENCED_PARAMETER(arg);
Expand Down Expand Up @@ -290,7 +296,7 @@
//OnlyTrigger = (int *)arg;

DHCPVS_DEBUG_PRINT
#if defined(CISCO_CONFIG_DHCPV6_PREFIX_DELEGATION) && ! defined(DHCPV6_PREFIX_FIX)
#if defined ((CISCO_CONFIG_DHCPV6_PREFIX_DELEGATION) && ! defined(DHCPV6_PREFIX_FIX)) || defined(_ONESTACK_PRODUCT_REQ_)
UNREFERENCED_PARAMETER(OnlyTrigger);
ifl_set_event("dhcpv6_server-restart", "");
#else
Comment on lines +299 to 302
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.

Same issue here: defined ((CISCO_CONFIG_DHCPV6_PREFIX_DELEGATION) && ! defined(DHCPV6_PREFIX_FIX)) is not valid preprocessor syntax and will fail compilation. Wrap the expression outside of defined, e.g. (defined(CISCO_CONFIG_DHCPV6_PREFIX_DELEGATION) && !defined(DHCPV6_PREFIX_FIX)) || defined(_ONESTACK_PRODUCT_REQ_).

Copilot uses AI. Check for mistakes.
Comment on lines +299 to 302
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 #if is not valid: defined ((CISCO_CONFIG_DHCPV6_PREFIX_DELEGATION) && ! defined(DHCPV6_PREFIX_FIX)) passes an expression to defined, which will not compile. Use normal boolean composition instead, e.g. #if (defined(CISCO_CONFIG_DHCPV6_PREFIX_DELEGATION) && !defined(DHCPV6_PREFIX_FIX)) || defined(_ONESTACK_PRODUCT_REQ_).

Copilot uses AI. Check for mistakes.
Expand Down Expand Up @@ -1479,7 +1485,7 @@
char responseCode[10];
struct stat check_ConfigFile;
errno_t rc = -1;
#ifdef CISCO_CONFIG_DHCPV6_PREFIX_DELEGATION
#if defined(CISCO_CONFIG_DHCPV6_PREFIX_DELEGATION) || defined(_ONESTACK_PRODUCT_REQ_)
pd_pool_t pd_pool;
ia_pd_t ia_pd;
#endif
Expand All @@ -1490,7 +1496,11 @@
BOOL bBadPrefixFormat = FALSE;
if (!fp)
goto EXIT;
#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
Comment on lines +1499 to +1502
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.

OneStack-specific code calls isFeatureSupportedInCurrentMode(FEATURE_IPV6_DELEGATION), but this file doesn’t declare/define that symbol or the feature macro. Unless provided by an included header, _ONESTACK_PRODUCT_REQ_ builds will fail to compile; consider adding a shared feature header and including it here.

Copilot uses AI. Check for mistakes.
{
/* handle logic:
* 1) divide the Operator-delegated prefix to sub-prefixes
* 2) further break the first of these sub-prefixes into /64 interface-prefixes for lan interface
Expand All @@ -1505,6 +1515,7 @@
ifl_set_event("service_ipv6-status", "error");
return;
}
}
#endif
/*Begin write configuration */
fprintf(fp, "log-level 8\n");
Expand Down Expand Up @@ -1670,9 +1681,13 @@
fprintf(fp, " valid-lifetime %lu\n", validTime);
}
fprintf(fp, " }\n");
}
AnscFreeMemory(pTmp3);
#ifdef CISCO_CONFIG_DHCPV6_PREFIX_DELEGATION
}
AnscFreeMemory(pTmp3);
#if defined(CISCO_CONFIG_DHCPV6_PREFIX_DELEGATION) || defined(_ONESTACK_PRODUCT_REQ_)
#if defined(_ONESTACK_PRODUCT_REQ_)
if (isFeatureSupportedInCurrentMode(FEATURE_IPV6_DELEGATION))
#endif
{
DHCPMGR_LOG_INFO("[%s] %d - See if need to emit pd-class, sDhcpv6ServerPool[Index].Cfg.IAPDEnable: %d, Index: %d\n",
__FUNCTION__, __LINE__, sDhcpv6ServerPool[Index].Cfg.IAPDEnable, Index);
if (sDhcpv6ServerPool[Index].Cfg.IAPDEnable) {
Expand All @@ -1683,7 +1698,7 @@
DHCPMGR_LOG_INFO("[%s] %d emit pd-length pd_pool.pd_length: %d\n",
__FUNCTION__, __LINE__, pd_pool.pd_length);
fprintf(fp, " pd-class {\n");
#if defined (_CBR_PRODUCT_REQ_) || defined (CISCO_CONFIG_DHCPV6_PREFIX_DELEGATION)
#if defined (_CBR_PRODUCT_REQ_) || defined (CISCO_CONFIG_DHCPV6_PREFIX_DELEGATION) || defined(_ONESTACK_PRODUCT_REQ_)
fprintf(fp, " pd-pool %s /%d\n", pd_pool.start, pd_pool.prefix_length);
#else
fprintf(fp, " pd-pool %s - %s /%d\n", pd_pool.start, pd_pool.end, pd_pool.prefix_length);
Expand All @@ -1694,12 +1709,13 @@
fprintf(fp, " T2 %s\n", ia_pd.t2);
fprintf(fp, " prefered-lifetime %s\n", ia_pd.pretm);
fprintf(fp, " valid-lifetime %s\n", ia_pd.vldtm);
}
fprintf(fp, " }\n");
}
}
}
fprintf(fp, " }\n");
}
}
}
#endif
}
}
OPTIONS:
/* For options */
for ( Index2 = 0 ; Index2 < uDhcpv6ServerPoolOptionNum[Index]; Index2++ )
Expand Down
35 changes: 30 additions & 5 deletions source/DHCPServerUtils/DHCPv6Server/service_ipv6.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/************************************************************************************

Check failure on line 1 in source/DHCPServerUtils/DHCPv6Server/service_ipv6.c

View workflow job for this annotation

GitHub Actions / call-fossid-workflow / Fossid Annotate PR

FossID License Issue Detected

Source code with 'BSD-Intel' license found in local file 'source/DHCPServerUtils/DHCPv6Server/service_ipv6.c' (Match: rdkb/components/opensource/ccsp/Utopia/rdkb/components/opensource/ccsp/Utopia/1, 1900 lines, url: https://code.rdkcentral.com/r/plugins/gitiles/rdkb/components/opensource/ccsp/Utopia/+archive/RDKB-RELEASE-TEST-DUNFELL-1.tar.gz, file: source/service_ipv6/service_ipv6.c)

Check failure on line 1 in source/DHCPServerUtils/DHCPv6Server/service_ipv6.c

View workflow job for this annotation

GitHub Actions / call-fossid-workflow / Fossid Annotate PR

FossID License Issue Detected

Source code with 'BSD-Intel' license found in local file 'source/DHCPServerUtils/DHCPv6Server/service_ipv6.c' (Match: rdkb/components/opensource/ccsp/Utopia/rdkb/components/opensource/ccsp/Utopia/2101, 1900 lines, url: https://code.rdkcentral.com/r/plugins/gitiles/rdkb/components/opensource/ccsp/Utopia/+archive/rdk-dev-2101.tar.gz, file: source/service_ipv6/service_ipv6.c)
If not stated otherwise in this file or this component's LICENSE file the
following copyright and licenses apply:

Expand Down Expand Up @@ -56,7 +56,9 @@
#include <ccsp_base_api.h>
#include "ccsp_memory.h"
#endif

#ifdef _ONESTACK_PRODUCT_REQ_
#include <rdkb_feature_mode_gate.h>
#endif
#define PROG_NAME "SERVICE-IPV6"

#if defined(INTEL_PUMA7) || defined(MULTILAN_FEATURE)
Expand Down Expand Up @@ -380,10 +382,21 @@
DHCPV6S_SYSCFG_GETI(DHCPV6S_NAME, "pool", cfg->index, "", 0, "X_RDKCENTRAL_COM_DNSServersEnabled", cfg->X_RDKCENTRAL_COM_DNSServersEnabled);

#ifdef MULTILAN_FEATURE
#ifdef 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
{
DHCPV6S_SYSCFG_GETS(DHCPV6S_NAME, "pool", cfg->index, "", 0, "IAInterface", iface_name);
#else
}
#endif
#if !defined(CISCO_CONFIG_DHCPV6_PREFIX_DELEGATION) || defined(_ONESTACK_PRODUCT_REQ_)
#if defined(_ONESTACK_PRODUCT_REQ_)
if (!isFeatureSupportedInCurrentMode(FEATURE_IPV6_DELEGATION))
#endif
{
DHCPV6S_SYSCFG_GETS(DHCPV6S_NAME, "pool", cfg->index, "", 0, "Interface", iface_name);
}
Comment on lines +385 to +399
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.

The new OneStack runtime gating calls isFeatureSupportedInCurrentMode(FEATURE_IPV6_DELEGATION), but neither symbol is defined in this file. _ONESTACK_PRODUCT_REQ_ builds will fail to compile unless a shared header is added and included here (the helper is currently only file-local in cosa_dhcpv6_dml.c).

Copilot uses AI. Check for mistakes.
#endif
#else
DHCPV6S_SYSCFG_GETS(DHCPV6S_NAME, "pool", cfg->index, "", 0, "IAInterface", cfg->interface);
Expand Down Expand Up @@ -594,7 +607,7 @@
static int get_active_lanif(unsigned int insts[], unsigned int *num)
{
int i = 0;
#if !defined(MULTILAN_FEATURE) || defined CISCO_CONFIG_DHCPV6_PREFIX_DELEGATION
#if !defined(MULTILAN_FEATURE) || defined CISCO_CONFIG_DHCPV6_PREFIX_DELEGATION || defined(_ONESTACK_PRODUCT_REQ_)
char active_insts[32] = {0};
char lan_pd_if[128] = {0};
char *p = NULL;
Expand All @@ -616,7 +629,11 @@
unsigned int max_active_if_count = 0;
int primary_l3_instance = 0;

#ifdef 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
{
syscfg_get(NULL, "lan_pd_interfaces", lan_pd_if, sizeof(lan_pd_if));
if (lan_pd_if[0] == '\0') {
*num = 0;
Expand All @@ -636,6 +653,13 @@

p = strtok(NULL, " ");
}
}
#endif
#if !defined(CISCO_CONFIG_DHCPV6_PREFIX_DELEGATION) || defined(_ONESTACK_PRODUCT_REQ_)
#if defined(_ONESTACK_PRODUCT_REQ_)
if (!isFeatureSupportedInCurrentMode(FEATURE_IPV6_DELEGATION))
#endif
{
Comment on lines +658 to +662
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.

In get_active_lanif, the #if !defined(CISCO_CONFIG_DHCPV6_PREFIX_DELEGATION) || defined(_ONESTACK_PRODUCT_REQ_) block opens a { (line 660) but the corresponding logic and closing brace are placed in the #else branch. This produces unmatched braces / incorrect compilation depending on macros. Please restructure so the runtime if/else (OneStack) wraps both PD and non-PD implementations within the same compiled branch.

Copilot uses AI. Check for mistakes.
#else
/* Get active bridge count from PSM */
Comment on lines +658 to 664
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.

The #if ... #else structure around the non-PD path is inverted/broken: the PSM-based logic is currently under the #else of #if !defined(CISCO_CONFIG_DHCPV6_PREFIX_DELEGATION) || defined(_ONESTACK_PRODUCT_REQ_), which means it will be compiled only when CISCO_CONFIG_DHCPV6_PREFIX_DELEGATION is defined and ONESTACK is not. For non-PD builds (and ONESTACK builds), this instead compiles an empty block, leaving *num unset and skipping the intended PSM path. Restructure this to match the earlier pattern in get_dhcpv6s_pool_cfg: #if defined(CISCO_CONFIG_DHCPV6_PREFIX_DELEGATION) || defined(_ONESTACK_PRODUCT_REQ_) (with an ONESTACK runtime if) for the PD syscfg path, and a single #else for the PSM path.

Copilot uses AI. Check for mistakes.
if (!bus_handle) {
Expand Down Expand Up @@ -706,6 +730,7 @@
}
/* Set active IPv6 instances */
ifl_set_event( "ipv6_active_inst", active_if_list);
}
#endif


Expand Down
3 changes: 3 additions & 0 deletions source/TR-181/board_sbapi/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,6 @@ libCcspDhcpMgr_board_sbapi_la_CPPFLAGS = -I$(top_srcdir)/source/TR-181/include \
libCcspDhcpMgr_board_sbapi_la_SOURCES = cosa_dhcpv6_apis.c cosa_dhcpv4_apis.c ../middle_layer_src/cosa_apis_util.c cosa_dhcpv4_webconfig_apis.c lan_webconfig_param.c macbinding_webconfig_param.c cosa_x_cisco_com_devicecontrol_apis.c

libCcspDhcpMgr_board_sbapi_la_LDFLAGS = -lccsp_common -lhal_moca -lulog -lsyscfg -lsysevent -ltime_conversion -llmapi -lwebconfig_framework -lmsgpackc -lcm_mgnt -lnanomsg
if ONESTACK_PRODUCT_REQ
libCcspDhcpMgr_board_sbapi_la_LDFLAGS += -ldevicemode -lonestack_syscfg -lonestack_log -lrdkb_feature_mode_gate
endif
Comment on lines 39 to +42
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.

if ONESTACK_PRODUCT_REQ introduces an Automake conditional that is not defined in this repository’s configure.ac/m4 macros. This will cause automake to fail. Define AM_CONDITIONAL([ONESTACK_PRODUCT_REQ], ...) (and the option/define that controls it) or switch to an existing conditional.

Suggested change
libCcspDhcpMgr_board_sbapi_la_LDFLAGS = -lccsp_common -lhal_moca -lulog -lsyscfg -lsysevent -ltime_conversion -llmapi -lwebconfig_framework -lmsgpackc -lcm_mgnt -lnanomsg
if ONESTACK_PRODUCT_REQ
libCcspDhcpMgr_board_sbapi_la_LDFLAGS += -ldevicemode -lonestack_syscfg -lonestack_log -lrdkb_feature_mode_gate
endif
libCcspDhcpMgr_board_sbapi_la_LDFLAGS = -lccsp_common -lhal_moca -lulog -lsyscfg -lsysevent -ltime_conversion -llmapi -lwebconfig_framework -lmsgpackc -lcm_mgnt -lnanomsg -ldevicemode -lonestack_syscfg -lonestack_log -lrdkb_feature_mode_gate

Copilot uses AI. Check for mistakes.
Loading