Skip to content
Open
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
9 changes: 8 additions & 1 deletion source/service_routed/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,13 @@ 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

service_routed_LDFLAGS =

if CORE_NET_LIB_FEATURE_SUPPORT
service_routed_LDFLAGS = -lnet
service_routed_LDFLAGS += -lnet
endif

if ONESTACK_PRODUCT_REQ
service_routed_LDFLAGS += -L${PKG_CONFIG_SYSROOT_DIR}$(libdir) -lrdkb_feature_mode_gate
endif
33 changes: 30 additions & 3 deletions source/service_routed/service_routed.c
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,10 @@ static const char* const service_routed_component_id = "ccsp.routed";
#include <libnet.h>
#endif

#if defined(_ONESTACK_PRODUCT_REQ_)
#include <rdkb_feature_mode_gate.h>
#endif

#define ZEBRA_PID_FILE "/var/zebra.pid"
#define RIPD_PID_FILE "/var/ripd.pid"
#define ZEBRA_CONF_FILE "/var/zebra.conf"
Expand Down Expand Up @@ -136,7 +140,7 @@ struct serv_routed {
bool wan_ready;
};

#if defined (_CBR_PRODUCT_REQ_) || defined (_BWG_PRODUCT_REQ_) || defined (_CBR2_PRODUCT_REQ_)
#if defined (_CBR_PRODUCT_REQ_) || defined (_BWG_PRODUCT_REQ_) || defined (_CBR2_PRODUCT_REQ_) || defined (_XB10_PRODUCT_REQ_)
#ifdef _BWG_PRODUCT_REQ_
Comment on lines +143 to 144
Copy link

Copilot AI Feb 13, 2026

Choose a reason for hiding this comment

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

Adding XB10_PRODUCT_REQ to this block enables IsFileExists() (which uses struct stat/stat()), but <sys/stat.h> is only included for _CBR/_BWG/_CBR2. XB10 builds may fail to compile with unknown 'struct stat' / implicit 'stat'. Include <sys/stat.h> when XB10_PRODUCT_REQ is defined (or include it unconditionally in the IsFileExists block).

Copilot uses AI. Check for mistakes.
#define LOG_FILE "/rdklogs/logs/ArmConsolelog.txt.0"
#else
Expand Down Expand Up @@ -2124,10 +2128,19 @@ STATIC int radv_restart(struct serv_routed *sr)
return radv_start(sr);
}

#if defined(_ONESTACK_PRODUCT_REQ_)
static BOOL IsRIPConflictingFeaturesEnabled(void)
{
// TODO: Add check to see if any conflicting feature of RIP
// like MAP-T are enabled
return FALSE;
Comment on lines +2132 to +2136
Copy link

Copilot AI Feb 13, 2026

Choose a reason for hiding this comment

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

IsRIPConflictingFeaturesEnabled() introduces the BOOL return type, but this file otherwise uses C99 bool (and BOOL is not declared anywhere in this translation unit). This can break builds depending on include order/toolchain. Prefer using bool (from <stdbool.h>) and return true/false, or include the header that defines BOOL within the same compile-time guard.

Suggested change
static BOOL IsRIPConflictingFeaturesEnabled(void)
{
// TODO: Add check to see if any conflicting feature of RIP
// like MAP-T are enabled
return FALSE;
static bool IsRIPConflictingFeaturesEnabled(void)
{
// TODO: Add check to see if any conflicting feature of RIP
// like MAP-T are enabled
return false;

Copilot uses AI. Check for mistakes.
}
#endif

STATIC int rip_start(struct serv_routed *sr)
{
char enable[16];
#if defined (_CBR_PRODUCT_REQ_) || defined (_BWG_PRODUCT_REQ_) || defined (_CBR2_PRODUCT_REQ_)
#if defined (_CBR_PRODUCT_REQ_) || defined (_BWG_PRODUCT_REQ_) || defined (_CBR2_PRODUCT_REQ_) || defined (_XB10_PRODUCT_REQ_)
char ripd_conf_status[16];
#endif
if (!serv_can_start(sr->sefd, sr->setok, "rip"))
Expand Down Expand Up @@ -2172,7 +2185,21 @@ sleep(45); /*sleep upto update ripd.conf after reboot*/
sysevent_set(sr->sefd, sr->setok, "rip-status", "error", 0);
return -1;
}
#if defined (_CBR_PRODUCT_REQ_) || defined (_BWG_PRODUCT_REQ_) || defined (_CBR2_PRODUCT_REQ_)
#if defined (_CBR_PRODUCT_REQ_) || defined (_BWG_PRODUCT_REQ_) || defined (_CBR2_PRODUCT_REQ_) || defined (_XB10_PRODUCT_REQ_)
#if defined(_ONESTACK_PRODUCT_REQ_)
if (!isFeatureSupportedInCurrentMode(FEATURE_TRUE_STATIC_IP))
{
DEG_PRINT("RIP enable rejected, unsupported mode\n");
t2_event_d("RIP_NotSupported", 1);
return -1;
}
else if (IsRIPConflictingFeaturesEnabled())
{
DEG_PRINT("RIP enable rejected due to conflicting features\n");
t2_event_d("RIP_NotSupported", 1);
Comment on lines +2193 to +2199
Copy link

Copilot AI Feb 13, 2026

Choose a reason for hiding this comment

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

New RIPv2 feature/mode gating logic in rip_start() is currently untested by the existing service_routed gtests (which exercise rip_start(), but won't hit this branch unless the relevant product/onestack macros are enabled and isFeatureSupportedInCurrentMode() is mocked). Adding a unit test for the "unsupported mode" path would help prevent regressions (e.g., verifying rip-status updates and that routed startup behavior matches expectations).

Suggested change
t2_event_d("RIP_NotSupported", 1);
return -1;
}
else if (IsRIPConflictingFeaturesEnabled())
{
DEG_PRINT("RIP enable rejected due to conflicting features\n");
t2_event_d("RIP_NotSupported", 1);
t2_event_d("RIP_NotSupported", 1);
sysevent_set(sr->sefd, sr->setok, "rip-status", "error", 0);
return -1;
}
else if (IsRIPConflictingFeaturesEnabled())
{
DEG_PRINT("RIP enable rejected due to conflicting features\n");
t2_event_d("RIP_NotSupported", 1);
sysevent_set(sr->sefd, sr->setok, "rip-status", "error", 0);

Copilot uses AI. Check for mistakes.
return -1;
}
Comment on lines 2188 to 2201
Copy link

Copilot AI Feb 13, 2026

Choose a reason for hiding this comment

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

On unsupported mode / conflicting features, rip_start() returns -1 after setting "rip-status" to "starting". This leaves rip-status stuck at "starting" and also causes serv_routed_start() to fail ("routed-status" becomes "error"), even though the intended outcome seems to be "don't start RIP" rather than "fail routed". Consider moving the feature/conflict gate before setting statuses/generating config, and either set an appropriate terminal rip-status (e.g., "error"/"not-supported") and return 0, or explicitly handle this case so routed can still start RA/routes/firewall.

Copilot uses AI. Check for mistakes.
#endif
int retries=0;
while (retries<20) {
memset(ripd_conf_status,0,sizeof(ripd_conf_status));
Expand Down
Loading