Skip to content
Open
3 changes: 3 additions & 0 deletions source/firewall/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ firewall_SOURCES += firewall_lib.c firewall_dsl.c rabid.c
AM_LDFLAGS += -lrdkconfig
endif

if ONESTACK_PRODUCT_REQ
AM_LDFLAGS += -ldevicemode -lonestack_syscfg -lonestack_log -lrdkb_feature_mode_gate
endif
nfq_handler_SOURCES = raw_socket_send.c nfq_handler.c

firewall_LDADD = $(top_builddir)/source/syscfg/lib/libsyscfg.la \
Expand Down
3 changes: 2 additions & 1 deletion source/firewall/firewall.h
Original file line number Diff line number Diff line change
Expand Up @@ -619,7 +619,8 @@ int prepare_multinet_filter_output_v6(FILE *fp);
*/
int prepare_ipv6_rule_ex_mode(FILE *raw_fp, FILE *mangle_fp, FILE *nat_fp, FILE *filter_fp);
#endif
#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_)
/**
* @brief Prepare IPv6 MultiNet rules with DHCPv6 prefix delegation support.
*
Expand Down
25 changes: 21 additions & 4 deletions source/firewall/firewall_ipv6.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* If not stated otherwise in this file or this component's Licenses.txt file the

Check failure on line 2 in source/firewall/firewall_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/firewall/firewall_ipv6.c' (Match: rdkb/components/opensource/ccsp/Utopia/rdkb/components/opensource/ccsp/Utopia/1, 2460 lines, url: https://code.rdkcentral.com/r/plugins/gitiles/rdkb/components/opensource/ccsp/Utopia/+archive/RDKB-TEST-RELEASE-1.tar.gz, file: source/firewall/firewall.c)

Check failure on line 2 in source/firewall/firewall_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/firewall/firewall_ipv6.c' (Match: rdkb/components/opensource/ccsp/Utopia/rdkb/components/opensource/ccsp/Utopia/1, 2460 lines, url: https://code.rdkcentral.com/r/plugins/gitiles/rdkb/components/opensource/ccsp/Utopia/+archive/RDKB-RELEASE-TEST-DUNFELL-1.tar.gz, file: source/firewall/firewall.c)
* following copyright and licenses apply:
*
* Copyright 2015 RDK Management
Expand Down Expand Up @@ -98,6 +98,9 @@
#include <net/if.h>
#endif

#ifdef _ONESTACK_PRODUCT_REQ_
#include <rdkb_feature_mode_gate.h>
#endif
void* bus_handle ;
int sysevent_fd;
char sysevent_ip[19];
Expand Down Expand Up @@ -862,11 +865,17 @@
}
#endif /*_HUB4_PRODUCT_REQ_*/

#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_)
#if defined(_ONESTACK_PRODUCT_REQ_)
if ( isFeatureSupportedInCurrentMode(FEATURE_IPV6_DELEGATION) == true)
#endif
{

/*Add a simple logic here to make traffic allowed for lan interfaces
* exclude primary lan*/
prepare_ipv6_multinet(fp);
#endif
}
#endif
#if !defined(_XER5_PRODUCT_REQ_) && !defined (_SCER11BEL_PRODUCT_REQ_) && !defined(_COSA_QCA_ARM_) //wan0 is not applicable for XER5
/* not allow ping wan0 from brlan0 */
int i;
Expand Down Expand Up @@ -1705,9 +1714,17 @@
FIREWALL_DEBUG("Exiting prepare_ipv6_firewall \n");
}

#if defined(CISCO_CONFIG_DHCPV6_PREFIX_DELEGATION) && ! defined(_CBR_PRODUCT_REQ_)
static int prepare_ipv6_multinet(FILE *fp)
#if (defined(CISCO_CONFIG_DHCPV6_PREFIX_DELEGATION) && !defined(_CBR_PRODUCT_REQ_)) \
|| defined(_ONESTACK_PRODUCT_REQ_)
int prepare_ipv6_multinet(FILE *fp)
{
#ifdef _ONESTACK_PRODUCT_REQ_
if (!isFeatureSupportedInCurrentMode(FEATURE_IPV6_DELEGATION))
{
/* PD feature disabled */
return 0;
}
#endif
Comment on lines +1719 to +1727
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.

Within prepare_ipv6_multinet(), the code later does a do/while loop that formats with the first token from strtok(active_insts, " "). If the sysevent value "multinet-instances" is empty, strtok returns NULL and that loop will dereference a NULL pointer. Add an early return when the first token is NULL (or switch to a while(token != NULL) loop).

Copilot uses AI. Check for mistakes.
char active_insts[32] = {0};
char lan_pd_if[128] = {0};
char *p = NULL;
Comment on lines +1719 to 1730
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.

In prepare_ipv6_multinet(), after p = strtok(active_insts, " ") the code uses a do { ... } while (...) loop further down. If active_insts is empty, p will be NULL and the first iteration will still execute, leading to undefined behavior when formatting %s with p. Add a NULL check before entering the loop or convert to while (p != NULL) so an empty instance list is handled safely.

Copilot uses AI. Check for mistakes.
Expand Down
2 changes: 1 addition & 1 deletion source/scripts/init/c_registration/15_dhcpv6_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ const char* SERVICE_CUSTOM_EVENTS[] = {
"lan-status|/usr/bin/service_dhcpv6_client",
NULL
};
#elif defined(CISCO_CONFIG_DHCPV6_PREFIX_DELEGATION)
#elif defined(CISCO_CONFIG_DHCPV6_PREFIX_DELEGATION) || defined(_ONESTACK_PRODUCT_REQ_)
const char* SERVICE_CUSTOM_EVENTS[] = {
"erouter_mode-updated|/etc/utopia/service.d/service_dhcpv6_client.sh",
"phylink_wan_state|/etc/utopia/service.d/service_dhcpv6_client.sh",
Expand Down
2 changes: 1 addition & 1 deletion source/scripts/init/c_registration/15_dhcpv6_server.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ const char* SERVICE_CUSTOM_EVENTS[] = {
"dhcpv6_server-restart|/usr/bin/service_ipv6",
NULL
};
#elif defined (CISCO_CONFIG_DHCPV6_PREFIX_DELEGATION)
#elif defined(CISCO_CONFIG_DHCPV6_PREFIX_DELEGATION) || defined(_ONESTACK_PRODUCT_REQ_)
const char* SERVICE_CUSTOM_EVENTS[] = {
"dhcpv6_option_changed|/etc/utopia/service.d/service_dhcpv6_server.sh|NULL|"TUPLE_FLAG_EVENT,
NULL
Expand Down
2 changes: 1 addition & 1 deletion source/scripts/init/c_registration/20_routing.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* If not stated otherwise in this file or this component's Licenses.txt file the

Check failure on line 2 in source/scripts/init/c_registration/20_routing.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/scripts/init/c_registration/20_routing.c' (Match: rdkb/components/opensource/ccsp/Utopia/rdkb/components/opensource/ccsp/Utopia/1, 119 lines, url: https://code.rdkcentral.com/r/plugins/gitiles/rdkb/components/opensource/ccsp/Utopia/+archive/RDKB-RELEASE-TEST-DUNFELL-1.tar.gz, file: source/scripts/init/c_registration/20_routing.c)
* following copyright and licenses apply:
*
* Copyright 2015 RDK Management
Expand Down Expand Up @@ -44,7 +44,7 @@
#define SERVICE_NAME "routed"
#define SERVICE_DEFAULT_HANDLER "/etc/utopia/service.d/service_routed.sh"

#ifdef CISCO_CONFIG_DHCPV6_PREFIX_DELEGATION
#if defined(CISCO_CONFIG_DHCPV6_PREFIX_DELEGATION) || defined(_ONESTACK_PRODUCT_REQ_)
const char* SERVICE_CUSTOM_EVENTS[] = {
"wan-status|/etc/utopia/service.d/service_routed.sh",
"lan-status|/etc/utopia/service.d/service_routed.sh",
Expand Down
3 changes: 3 additions & 0 deletions source/service_ipv6/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ AM_CPPFLAGS = -I$(top_srcdir)/source/include \

AM_LDFLAGS = -lccsp_common -lsecure_wrapper $(DBUS_LIBS)

if ONESTACK_PRODUCT_REQ
AM_LDFLAGS += -ldevicemode -lonestack_syscfg -lonestack_log -lrdkb_feature_mode_gate
endif
service_ipv6_SOURCES = service_ipv6.c service_ipv6_main.c

service_ipv6_LDADD = $(top_builddir)/source/util/utils/libutopiautil.la \
Expand Down
40 changes: 33 additions & 7 deletions source/service_ipv6/service_ipv6.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/************************************************************************************

Check failure on line 1 in source/service_ipv6/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/service_ipv6/service_ipv6.c' (Match: rdkb/components/opensource/ccsp/Utopia/rdkb/components/opensource/ccsp/Utopia/1, 2355 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/service_ipv6/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/service_ipv6/service_ipv6.c' (Match: rdkb/components/opensource/ccsp/Utopia/rdkb/components/opensource/ccsp/Utopia/2101, 2355 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 Licenses.txt file the
following copyright and licenses apply:

Expand Down Expand Up @@ -53,6 +53,9 @@
#include "ccsp_memory.h"
#endif

#ifdef _ONESTACK_PRODUCT_REQ_
#include <rdkb_feature_mode_gate.h>
#endif
#ifdef _HUB4_PRODUCT_REQ_
#include "ccsp_dm_api.h"
#include "ccsp_custom.h"
Expand Down Expand Up @@ -391,10 +394,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
DHCPV6S_SYSCFG_GETS(DHCPV6S_NAME, "pool", cfg->index, "", 0, "IAInterface", iface_name);
#else
DHCPV6S_SYSCFG_GETS(DHCPV6S_NAME, "pool", cfg->index, "", 0, "Interface", iface_name);
#if defined(CISCO_CONFIG_DHCPV6_PREFIX_DELEGATION) || defined(_ONESTACK_PRODUCT_REQ_)
#if defined(_ONESTACK_PRODUCT_REQ_)
if (isFeatureSupportedInCurrentMode(FEATURE_IPV6_DELEGATION) == true)
#endif
{
DHCPV6S_SYSCFG_GETS(DHCPV6S_NAME, "pool", cfg->index, "", 0, "IAInterface", iface_name);
}
#endif
#if !defined(CISCO_CONFIG_DHCPV6_PREFIX_DELEGATION) || defined(_ONESTACK_PRODUCT_REQ_)
#if defined(_ONESTACK_PRODUCT_REQ_)
if (isFeatureSupportedInCurrentMode(FEATURE_IPV6_DELEGATION) == false)
#endif
{
DHCPV6S_SYSCFG_GETS(DHCPV6S_NAME, "pool", cfg->index, "", 0, "Interface", iface_name);
}
Comment on lines +397 to +411
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-specific behavior is now introduced in get_dhcpv6s_pool_cfg() to choose between IAInterface vs Interface based on FEATURE_IPV6_DELEGATION, but the existing service_ipv6 unit tests don’t build with ONESTACK_PRODUCT_REQ and don’t validate either branch. Add unit tests that exercise both feature states (mocking isFeatureSupportedInCurrentMode) to ensure the correct syscfg key is read.

Copilot uses AI. Check for mistakes.
#endif
#else
DHCPV6S_SYSCFG_GETS(DHCPV6S_NAME, "pool", cfg->index, "", 0, "IAInterface", cfg->interface);
Expand Down Expand Up @@ -606,7 +620,7 @@
STATIC int get_active_lanif(struct serv_ipv6 *si6, 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 @@ -628,7 +642,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 @@ -648,7 +666,14 @@

p = strtok(NULL, " ");
}
#else
}
#endif
#if !defined(CISCO_CONFIG_DHCPV6_PREFIX_DELEGATION) || defined(_ONESTACK_PRODUCT_REQ_)
#if defined(_ONESTACK_PRODUCT_REQ_)
if (!isFeatureSupportedInCurrentMode(FEATURE_IPV6_DELEGATION))
#endif
{

/* Get active bridge count from PSM */
if (!bus_handle) {
fprintf(stderr, "DBUS not connected, returning \n");
Expand Down Expand Up @@ -718,6 +743,7 @@
}
/* Set active IPv6 instances */
sysevent_set(si6->sefd, si6->setok, "ipv6_active_inst", active_if_list, 0);
}
#endif


Expand Down
11 changes: 8 additions & 3 deletions source/service_routed/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,11 @@

bin_PROGRAMS = service_routed

AM_LDFLAGS = -lsecure_wrapper
AM_CPPFLAGS = -I$(top_srcdir)/source/include \
-I$(top_srcdir)/source/util/utils \
$(DBUS_CFLAGS)

AM_LDFLAGS = -lccsp_common -lsecure_wrapper $(DBUS_LIBS)

service_routed_SOURCES = service_routed.c service_routed_main.c

Expand All @@ -29,8 +33,8 @@ service_routed_CFLAGS = -I$(top_srcdir)/source \
-I$(top_srcdir)/source/utapi/lib \
-I$(top_srcdir)/source/util/utils \
-I${PKG_CONFIG_SYSROOT_DIR}$(includedir)/dbus-1.0 \
-I${PKG_CONFIG_SYSROOT_DIR}$(libdir)/dbus-1.0/include

-I${PKG_CONFIG_SYSROOT_DIR}$(libdir)/dbus-1.0/include \
-I${PKG_CONFIG_SYSROOT_DIR}$(includedir)

service_routed_LDADD = $(top_builddir)/source/util/utils/libutopiautil.la \
$(top_builddir)/source/services/lib/libsrvmgr.la \
Expand All @@ -40,6 +44,7 @@ service_routed_LDADD = $(top_builddir)/source/util/utils/libutopiautil.la \
$(top_builddir)/source/utctx/lib/libutctx.la \
$(top_builddir)/source/ulog/libulog.la \
-ltelemetry_msgsender
AM_LDFLAGS += -L${PKG_CONFIG_SYSROOT_DIR}$(libdir) -ldevicemode -lonestack_syscfg -lonestack_log -lrdkb_feature_mode_gate
if CORE_NET_LIB_FEATURE_SUPPORT
service_routed_LDFLAGS = -lnet
endif
Loading
Loading