Skip to content

RDKB-63740: Handling Utopia sysevent registration#254

Open
Deepak-Rathn wants to merge 1 commit intodevelopfrom
topic/RDKB-63740
Open

RDKB-63740: Handling Utopia sysevent registration#254
Deepak-Rathn wants to merge 1 commit intodevelopfrom
topic/RDKB-63740

Conversation

@Deepak-Rathn
Copy link

Reason for change: Some utopia scripts were customized for BCI platforms. service_dhcpv6_server_bci.sh,service_routed_bci.sh,service_dhcpv6_client_arm_bci.sh,service_ipv4_bci.sh
Test Procedure: check if bci scripts are installed and its registering CUSTOM events for xb10 Onestack
Priority: P1
Risks: Low

@Deepak-Rathn Deepak-Rathn requested a review from a team as a code owner March 5, 2026 04:13
Copilot AI review requested due to automatic review settings March 5, 2026 04:13
@Deepak-Rathn Deepak-Rathn requested a review from a team as a code owner March 5, 2026 04:13
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Updates the utopia C-registration binaries to register BCI-specific handlers/custom sysevents for Onestack/BCI platforms (per RDKB-63740), so customized *_bci.sh scripts get invoked for relevant sysevents.

Changes:

  • Add Onestack-only devicemode header/linking support for the registration binaries.
  • Register routed, dhcpv6_server, dhcpv6_client, and ipv4 with BCI handler paths and BCI custom-event tuples when building for _COSA_FOR_BCI_ / _ONESTACK_PRODUCT_REQ_.
  • Introduce BCI-specific custom event arrays for those services.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
source/services/lib/srvmgr.h Onestack-only include of devicemode.h.
source/scripts/init/c_registration/Makefile.am Link -ldevicemode for Onestack builds.
source/scripts/init/c_registration/20_routing.c Add BCI handler/events and select them for BCI/Onestack.
source/scripts/init/c_registration/15_dhcpv6_server.c Add BCI handler/events and select them for BCI/Onestack.
source/scripts/init/c_registration/15_dhcpv6_client.c Add BCI handler/events and select them for BCI/Onestack.
source/scripts/init/c_registration/02_ipv4.c Add BCI handler/events and select them for BCI/Onestack.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Comment on lines +86 to +90
#if defined(_COSA_FOR_BCI_) || defined(_ONESTACK_PRODUCT_REQ_)
sm_register(SERVICE_NAME, SERVICE_DEFAULT_HANDLER_BCI, SERVICE_CUSTOM_EVENTS_BCI);
#else
sm_register(SERVICE_NAME, SERVICE_DEFAULT_HANDLER, SERVICE_CUSTOM_EVENTS);
#endif // _COSA_FOR_BCI_ || _ONESTACK_PRODUCT_REQ_
Copy link

Copilot AI Mar 5, 2026

Choose a reason for hiding this comment

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

srv_register() selects SERVICE_CUSTOM_EVENTS_BCI when _COSA_FOR_BCI_ or _ONESTACK_PRODUCT_REQ_ is defined, but SERVICE_CUSTOM_EVENTS_BCI is only declared in the #else branch (not when CORE_NET_LIB or CISCO_CONFIG_DHCPV6_PREFIX_DELEGATION is defined). This can cause compilation failures for those macro combinations; align the preprocessor conditions or ensure the BCI array exists in all branches.

Suggested change
#if defined(_COSA_FOR_BCI_) || defined(_ONESTACK_PRODUCT_REQ_)
sm_register(SERVICE_NAME, SERVICE_DEFAULT_HANDLER_BCI, SERVICE_CUSTOM_EVENTS_BCI);
#else
sm_register(SERVICE_NAME, SERVICE_DEFAULT_HANDLER, SERVICE_CUSTOM_EVENTS);
#endif // _COSA_FOR_BCI_ || _ONESTACK_PRODUCT_REQ_
#if (defined(_COSA_FOR_BCI_) || defined(_ONESTACK_PRODUCT_REQ_)) && !defined(CORE_NET_LIB) && !defined(CISCO_CONFIG_DHCPV6_PREFIX_DELEGATION)
sm_register(SERVICE_NAME, SERVICE_DEFAULT_HANDLER_BCI, SERVICE_CUSTOM_EVENTS_BCI);
#else
sm_register(SERVICE_NAME, SERVICE_DEFAULT_HANDLER, SERVICE_CUSTOM_EVENTS);
#endif // (_COSA_FOR_BCI_ || _ONESTACK_PRODUCT_REQ_) && !CORE_NET_LIB && !CISCO_CONFIG_DHCPV6_PREFIX_DELEGATION

Copilot uses AI. Check for mistakes.
Comment on lines +121 to +126
void srv_register(void) {
#if defined(_COSA_FOR_BCI_) || defined(_ONESTACK_PRODUCT_REQ_)
sm_register(SERVICE_NAME, SERVICE_DEFAULT_HANDLER_BCI, SERVICE_CUSTOM_EVENTS_BCI);
#else
sm_register(SERVICE_NAME, SERVICE_DEFAULT_HANDLER, SERVICE_CUSTOM_EVENTS);
#endif // _COSA_FOR_BCI_ || _ONESTACK_PRODUCT_REQ_
Copy link

Copilot AI Mar 5, 2026

Choose a reason for hiding this comment

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

srv_register() selects SERVICE_CUSTOM_EVENTS_BCI when _COSA_FOR_BCI_ or _ONESTACK_PRODUCT_REQ_ is defined, but SERVICE_CUSTOM_EVENTS_BCI is only declared in the final #else branch. If _ONESTACK_PRODUCT_REQ_ is used together with the earlier platform branches (e.g., CORE_NET_LIB+XB6/CBR), this will not compile. Consider defining a BCI custom-events array for each branch or making the selection logic match the declarations.

Copilot uses AI. Check for mistakes.
Comment on lines +95 to +99
#if defined(_COSA_FOR_BCI_) || defined(_ONESTACK_PRODUCT_REQ_)
sm_register(SERVICE_NAME, SERVICE_DEFAULT_HANDLER_BCI, SERVICE_CUSTOM_EVENTS_BCI);
#else
sm_register(SERVICE_NAME, SERVICE_DEFAULT_HANDLER, SERVICE_CUSTOM_EVENTS);
#endif // _COSA_FOR_BCI_ || _ONESTACK_PRODUCT_REQ_
Copy link

Copilot AI Mar 5, 2026

Choose a reason for hiding this comment

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

srv_register() selects SERVICE_CUSTOM_EVENTS_BCI when _COSA_FOR_BCI_ or _ONESTACK_PRODUCT_REQ_ is defined, but SERVICE_CUSTOM_EVENTS_BCI is only declared under the #else (non-CISCO_CONFIG_DHCPV6_PREFIX_DELEGATION) branch. If both _ONESTACK_PRODUCT_REQ_ and CISCO_CONFIG_DHCPV6_PREFIX_DELEGATION are enabled, this will fail to compile; either declare the BCI array in both branches or adjust the selection condition.

Suggested change
#if defined(_COSA_FOR_BCI_) || defined(_ONESTACK_PRODUCT_REQ_)
sm_register(SERVICE_NAME, SERVICE_DEFAULT_HANDLER_BCI, SERVICE_CUSTOM_EVENTS_BCI);
#else
sm_register(SERVICE_NAME, SERVICE_DEFAULT_HANDLER, SERVICE_CUSTOM_EVENTS);
#endif // _COSA_FOR_BCI_ || _ONESTACK_PRODUCT_REQ_
#if (defined(_COSA_FOR_BCI_) || defined(_ONESTACK_PRODUCT_REQ_)) && !defined(CISCO_CONFIG_DHCPV6_PREFIX_DELEGATION)
sm_register(SERVICE_NAME, SERVICE_DEFAULT_HANDLER_BCI, SERVICE_CUSTOM_EVENTS_BCI);
#else
sm_register(SERVICE_NAME, SERVICE_DEFAULT_HANDLER, SERVICE_CUSTOM_EVENTS);
#endif // (_COSA_FOR_BCI_ || _ONESTACK_PRODUCT_REQ_) && !CISCO_CONFIG_DHCPV6_PREFIX_DELEGATION

Copilot uses AI. Check for mistakes.
"staticroute-restart|/etc/utopia/service.d/service_routed_bci.sh|NULL|"TUPLE_FLAG_EVENT,
#ifdef WAN_FAILOVER_SUPPORTED
"routeset-ula|/usr/bin/service_routed|NULL|"TUPLE_FLAG_EVENT,
"routeunset-ula|/usr/bin//service_routed|NULL|"TUPLE_FLAG_EVENT,
Copy link

Copilot AI Mar 5, 2026

Choose a reason for hiding this comment

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

The handler path for routeunset-ula contains a double slash (/usr/bin//service_routed). This is likely unintended and makes the tuple inconsistent with routeset-ula; normalize the path to a single slash to avoid brittle lookups.

Suggested change
"routeunset-ula|/usr/bin//service_routed|NULL|"TUPLE_FLAG_EVENT,
"routeunset-ula|/usr/bin/service_routed|NULL|"TUPLE_FLAG_EVENT,

Copilot uses AI. Check for mistakes.
"dhcp_domain|/etc/utopia/service.d/service_dhcpv6_server_bci.sh",
"current_lan_ipv6address|/etc/utopia/service.d/service_dhcpv6_server_bci.sh",
NULL
}
Copy link

Copilot AI Mar 5, 2026

Choose a reason for hiding this comment

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

SERVICE_CUSTOM_EVENTS_BCI is missing a terminating semicolon (};). As written, this will not compile.

Suggested change
}
};

Copilot uses AI. Check for mistakes.
Comment on lines +75 to +84
}
#endif


void srv_register(void) {
#if defined(_COSA_FOR_BCI_) || defined(_ONESTACK_PRODUCT_REQ_)
sm_register(SERVICE_NAME, SERVICE_DEFAULT_HANDLER_BCI, SERVICE_CUSTOM_EVENTS_BCI);
#else
sm_register(SERVICE_NAME, SERVICE_DEFAULT_HANDLER, SERVICE_CUSTOM_EVENTS);
#endif // _COSA_FOR_BCI_ || _ONESTACK_PRODUCT_REQ_
Copy link

Copilot AI Mar 5, 2026

Choose a reason for hiding this comment

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

srv_register() selects SERVICE_CUSTOM_EVENTS_BCI when _COSA_FOR_BCI_ or _ONESTACK_PRODUCT_REQ_ is defined, but SERVICE_CUSTOM_EVENTS_BCI is only declared in the #else branch (i.e., not for _CBR_PRODUCT_REQ_... nor CISCO_CONFIG_DHCPV6_PREFIX_DELEGATION). This can cause build failures depending on macro combinations. Consider defining SERVICE_CUSTOM_EVENTS_BCI for all branches (or gating the sm_register(...BCI...) path to only the branches where the BCI array exists).

Suggested change
}
#endif
void srv_register(void) {
#if defined(_COSA_FOR_BCI_) || defined(_ONESTACK_PRODUCT_REQ_)
sm_register(SERVICE_NAME, SERVICE_DEFAULT_HANDLER_BCI, SERVICE_CUSTOM_EVENTS_BCI);
#else
sm_register(SERVICE_NAME, SERVICE_DEFAULT_HANDLER, SERVICE_CUSTOM_EVENTS);
#endif // _COSA_FOR_BCI_ || _ONESTACK_PRODUCT_REQ_
};
#endif
void srv_register(void) {
/*
* Use the BCI handler and BCI custom events only when:
* - _COSA_FOR_BCI_ or _ONESTACK_PRODUCT_REQ_ is defined, and
* - we are in the configuration where SERVICE_CUSTOM_EVENTS_BCI exists
* (i.e. not the _CBR_PRODUCT_REQ_ or CISCO_CONFIG_DHCPV6_PREFIX_DELEGATION branches).
*/
#if (defined(_COSA_FOR_BCI_) || defined(_ONESTACK_PRODUCT_REQ_)) && \
!((defined(_CBR_PRODUCT_REQ_) && !defined(_CBR2_PRODUCT_REQ_)) || \
defined(CISCO_CONFIG_DHCPV6_PREFIX_DELEGATION))
sm_register(SERVICE_NAME, SERVICE_DEFAULT_HANDLER_BCI, SERVICE_CUSTOM_EVENTS_BCI);
#else
sm_register(SERVICE_NAME, SERVICE_DEFAULT_HANDLER, SERVICE_CUSTOM_EVENTS);
#endif /* BCI handler selection */

Copilot uses AI. Check for mistakes.
Copilot AI review requested due to automatic review settings March 5, 2026 07:42
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 6 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Comment on lines +79 to +89
void srv_register(void) {
sm_register(SERVICE_NAME, SERVICE_DEFAULT_HANDLER, SERVICE_CUSTOM_EVENTS);
#if defined(_ONESTACK_PRODUCT_REQ_)
if(is_devicemode_business())
{
sm_register(SERVICE_NAME, SERVICE_DEFAULT_HANDLER_BCI, SERVICE_CUSTOM_EVENTS_BCI);
}
else
{
sm_register(SERVICE_NAME, SERVICE_DEFAULT_HANDLER, SERVICE_CUSTOM_EVENTS);
}
#endif // _ONESTACK_PRODUCT_REQ_
Copy link

Copilot AI Mar 5, 2026

Choose a reason for hiding this comment

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

srv_register() no longer registers the service when ONESTACK_PRODUCT_REQ is not defined because the sm_register() call is entirely inside an #if without a corresponding #else. This is a functional regression for non-Onestack builds. Additionally, SERVICE_CUSTOM_EVENTS_BCI is only declared in the final #else branch (not in the CBR_PRODUCT_REQ / CISCO_CONFIG_DHCPV6_PREFIX_DELEGATION branches), but it’s referenced whenever ONESTACK_PRODUCT_REQ is set, which can cause build failures depending on feature macros. Add an #else path that registers the default handler/events, and ensure SERVICE_CUSTOM_EVENTS_BCI is defined (or aliased) for all relevant branches.

Copilot uses AI. Check for mistakes.
Comment on lines 85 to +95
void srv_register(void) {
sm_register(SERVICE_NAME, SERVICE_DEFAULT_HANDLER, SERVICE_CUSTOM_EVENTS);
#if defined(_ONESTACK_PRODUCT_REQ_)
if(is_devicemode_business())
{
sm_register(SERVICE_NAME, SERVICE_DEFAULT_HANDLER_BCI, SERVICE_CUSTOM_EVENTS_BCI);
}
else
{
sm_register(SERVICE_NAME, SERVICE_DEFAULT_HANDLER, SERVICE_CUSTOM_EVENTS);
}
#endif // _ONESTACK_PRODUCT_REQ_
Copy link

Copilot AI Mar 5, 2026

Choose a reason for hiding this comment

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

srv_register() no longer registers the service when ONESTACK_PRODUCT_REQ is not defined because the sm_register() call is entirely inside an #if without a corresponding #else. This is a functional regression for non-Onestack builds. Also, SERVICE_CUSTOM_EVENTS_BCI is only defined in the non-CORE_NET_LIB / non-CISCO_CONFIG_DHCPV6_PREFIX_DELEGATION branch, but it’s referenced whenever ONESTACK_PRODUCT_REQ is set; if CORE_NET_LIB is enabled (common), this will not compile. Add an #else path that always registers the default handler/events for non-Onestack builds, and ensure SERVICE_CUSTOM_EVENTS_BCI is defined (or aliased) for all branches where it may be referenced.

Copilot uses AI. Check for mistakes.
Comment on lines 121 to +131
void srv_register(void) {
sm_register(SERVICE_NAME, SERVICE_DEFAULT_HANDLER, SERVICE_CUSTOM_EVENTS);
#if defined(_ONESTACK_PRODUCT_REQ_)
if(is_devicemode_business())
{
sm_register(SERVICE_NAME, SERVICE_DEFAULT_HANDLER_BCI, SERVICE_CUSTOM_EVENTS_BCI);
}
else
{
sm_register(SERVICE_NAME, SERVICE_DEFAULT_HANDLER, SERVICE_CUSTOM_EVENTS);
}
#endif //_ONESTACK_PRODUCT_REQ_
Copy link

Copilot AI Mar 5, 2026

Choose a reason for hiding this comment

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

srv_register() no longer registers the service when ONESTACK_PRODUCT_REQ is not defined because the sm_register() call is entirely inside an #if without a corresponding #else. This is a functional regression for non-Onestack builds. Also, SERVICE_CUSTOM_EVENTS_BCI is only defined in the final #else branch of the platform-specific SERVICE_CUSTOM_EVENTS selection, but it’s referenced whenever ONESTACK_PRODUCT_REQ is set; for builds that take the earlier branches, this will not compile. Add an #else path that always registers the default handler/events for non-Onestack builds, and ensure SERVICE_CUSTOM_EVENTS_BCI is defined (or aliased) in all branches where it may be referenced.

Copilot uses AI. Check for mistakes.
Comment on lines +38 to +40
#if defined(_ONESTACK_PRODUCT_REQ_)
#include "devicemode.h"
#endif // _ONESTACK_PRODUCT_REQ_
Copy link

Copilot AI Mar 5, 2026

Choose a reason for hiding this comment

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

Including devicemode.h from srvmgr.h makes this generic service-manager header depend on an external Onestack-only header for every translation unit that includes srvmgr.h (many c_registration programs, plus libsrvmgr itself). To keep dependencies localized and reduce build breakage risk when the header isn’t available in some build environments, consider removing this include from srvmgr.h and instead including devicemode.h only in the few .c files that call is_devicemode_business() (still under ONESTACK_PRODUCT_REQ).

Suggested change
#if defined(_ONESTACK_PRODUCT_REQ_)
#include "devicemode.h"
#endif // _ONESTACK_PRODUCT_REQ_

Copilot uses AI. Check for mistakes.
Comment on lines +95 to +104
#if defined(_ONESTACK_PRODUCT_REQ_)
if(is_devicemode_business())
{
sm_register(SERVICE_NAME, SERVICE_DEFAULT_HANDLER_BCI, SERVICE_CUSTOM_EVENTS_BCI);
}
else
{
sm_register(SERVICE_NAME, SERVICE_DEFAULT_HANDLER, SERVICE_CUSTOM_EVENTS);
}
#endif // _ONESTACK_PRODUCT_REQ_
Copy link

Copilot AI Mar 5, 2026

Choose a reason for hiding this comment

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

srv_register() no longer registers the service when ONESTACK_PRODUCT_REQ is not defined because the sm_register() call is entirely inside an #if without a corresponding #else. This is a functional regression for non-Onestack builds. Also, SERVICE_CUSTOM_EVENTS_BCI is only defined in the non-CISCO_CONFIG_DHCPV6_PREFIX_DELEGATION branch, but it’s referenced unconditionally whenever ONESTACK_PRODUCT_REQ is set, which can cause build failures when CISCO_CONFIG_DHCPV6_PREFIX_DELEGATION is enabled. Add an #else path that registers the default handler/events, and ensure SERVICE_CUSTOM_EVENTS_BCI is defined (or aliased) for all preprocessor branches where it may be referenced.

Copilot uses AI. Check for mistakes.
Comment on lines +82 to +85
#ifdef WAN_FAILOVER_SUPPORTED
"routeset-ula|/usr/bin/service_routed|NULL|"TUPLE_FLAG_EVENT,
"routeunset-ula|/usr/bin//service_routed|NULL|"TUPLE_FLAG_EVENT,
#endif
Copy link

Copilot AI Mar 5, 2026

Choose a reason for hiding this comment

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

The custom event handler path for "routeunset-ula" uses "/usr/bin//service_routed" (double slash). This should be a valid executable path (likely "/usr/bin/service_routed"); otherwise the event will invoke a non-existent handler or rely on path normalization inconsistently.

Copilot uses AI. Check for mistakes.
Copilot AI review requested due to automatic review settings March 5, 2026 10:40
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 7 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Comment on lines +95 to +103
#if defined(_ONESTACK_PRODUCT_REQ_)
if(is_devicemode_business())
{
sm_register(SERVICE_NAME, SERVICE_DEFAULT_HANDLER_BCI, SERVICE_CUSTOM_EVENTS_BCI);
}
else
{
sm_register(SERVICE_NAME, SERVICE_DEFAULT_HANDLER, SERVICE_CUSTOM_EVENTS);
}
Copy link

Copilot AI Mar 5, 2026

Choose a reason for hiding this comment

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

SERVICE_CUSTOM_EVENTS_BCI is declared only in the #else branch of #ifdef CISCO_CONFIG_DHCPV6_PREFIX_DELEGATION, but srv_register() uses it whenever _ONESTACK_PRODUCT_REQ_ and business mode are true. If CISCO_CONFIG_DHCPV6_PREFIX_DELEGATION is enabled in an Onestack build, this will fail to compile. Define the BCI array in both branches (or add a fallback) before using it.

Copilot uses AI. Check for mistakes.
Comment on lines +122 to +130
#if defined(_ONESTACK_PRODUCT_REQ_)
if(is_devicemode_business())
{
sm_register(SERVICE_NAME, SERVICE_DEFAULT_HANDLER_BCI, SERVICE_CUSTOM_EVENTS_BCI);
}
else
{
sm_register(SERVICE_NAME, SERVICE_DEFAULT_HANDLER, SERVICE_CUSTOM_EVENTS);
}
Copy link

Copilot AI Mar 5, 2026

Choose a reason for hiding this comment

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

SERVICE_CUSTOM_EVENTS_BCI is only defined in the final #else branch of the platform selection, but srv_register() references it for Onestack business mode unconditionally. If an Onestack build falls into one of the earlier branches (e.g., _COSA_INTEL_USG_ARM_... or the CORE_NET_LIB branch), this will fail to compile. Define the BCI custom-events array (or an alias/fallback pointer) in all branches that can be built with _ONESTACK_PRODUCT_REQ_.

Copilot uses AI. Check for mistakes.
NULL
};
#elif defined (CISCO_CONFIG_DHCPV6_PREFIX_DELEGATION)
IN_CISCO_CONFIG_DHCPV6_PREFIX_DELEGATION
Copy link

Copilot AI Mar 5, 2026

Choose a reason for hiding this comment

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

The standalone token IN_CISCO_CONFIG_DHCPV6_PREFIX_DELEGATION is not valid C and will cause a compilation error. If this was meant as a comment or debug marker, remove it or convert it into a proper comment/preprocessor directive.

Suggested change
IN_CISCO_CONFIG_DHCPV6_PREFIX_DELEGATION
/* IN_CISCO_CONFIG_DHCPV6_PREFIX_DELEGATION */

Copilot uses AI. Check for mistakes.
Comment on lines +81 to +89
#if defined(_ONESTACK_PRODUCT_REQ_)
if(is_devicemode_business())
{
sm_register(SERVICE_NAME, SERVICE_DEFAULT_HANDLER_BCI, SERVICE_CUSTOM_EVENTS_BCI);
}
else
{
sm_register(SERVICE_NAME, SERVICE_DEFAULT_HANDLER, SERVICE_CUSTOM_EVENTS);
}
Copy link

Copilot AI Mar 5, 2026

Choose a reason for hiding this comment

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

SERVICE_CUSTOM_EVENTS_BCI is only defined in the #else branch, but srv_register() references it whenever _ONESTACK_PRODUCT_REQ_ and is_devicemode_business() are true. If the build defines _CBR_PRODUCT_REQ_ or CISCO_CONFIG_DHCPV6_PREFIX_DELEGATION, this will fail to compile. Define SERVICE_CUSTOM_EVENTS_BCI (or a fallback alias) in all preprocessor branches, or guard the business-mode registration so it only uses the BCI array when it exists.

Copilot uses AI. Check for mistakes.
Comment on lines 61 to 64
#elif defined(CISCO_CONFIG_DHCPV6_PREFIX_DELEGATION)
IN_CISCO_CONFIG_DHCPV6_PREFIX_DELEGATION_SPACE
const char* SERVICE_CUSTOM_EVENTS[] = {
"erouter_mode-updated|/etc/utopia/service.d/service_dhcpv6_client.sh",
Copy link

Copilot AI Mar 5, 2026

Choose a reason for hiding this comment

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

The standalone token IN_CISCO_CONFIG_DHCPV6_PREFIX_DELEGATION_SPACE is not valid C and will cause a compilation error. If this was meant as a comment/marker, remove it or replace it with a proper comment.

Copilot uses AI. Check for mistakes.
Comment on lines 70 to 73
#else
IN_ELSE_SPACE
const char* SERVICE_CUSTOM_EVENTS[] = {
"current_ipv4_link_state|/etc/utopia/service.d/service_dhcpv6_client.sh",
Copy link

Copilot AI Mar 5, 2026

Choose a reason for hiding this comment

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

The standalone token IN_ELSE_SPACE is not valid C and will cause a compilation error. If this was meant as a comment/marker, remove it or replace it with a proper comment.

Copilot uses AI. Check for mistakes.
Comment on lines 87 to +96
void srv_register(void) {
#if defined(_ONESTACK_PRODUCT_REQ_)
if(is_devicemode_business())
{
sm_register(SERVICE_NAME, SERVICE_DEFAULT_HANDLER_BCI, SERVICE_CUSTOM_EVENTS_BCI);
}
else
{
sm_register(SERVICE_NAME, SERVICE_DEFAULT_HANDLER, SERVICE_CUSTOM_EVENTS);
}
Copy link

Copilot AI Mar 5, 2026

Choose a reason for hiding this comment

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

SERVICE_CUSTOM_EVENTS_BCI is only defined in the final #else branch, but srv_register() references it for Onestack business mode regardless of whether CORE_NET_LIB or CISCO_CONFIG_DHCPV6_PREFIX_DELEGATION are defined. This can break builds where those macros are enabled. Define the BCI custom-events array (or a fallback pointer) in all branches, or guard the business-mode registration accordingly.

Copilot uses AI. Check for mistakes.
Copilot AI review requested due to automatic review settings March 5, 2026 12:38
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.

Comments suppressed due to low confidence (1)

source/scripts/init/c_registration/20_routing.c:85

  • The handler path for routeunset-ula is "/usr/bin//service_routed" (double slash). While it may resolve on most systems, it’s inconsistent with the corresponding routeset-ula entry and can break any tooling that expects normalized paths; update it to "/usr/bin/service_routed".
                                        "routeset-ula|/usr/bin/service_routed|NULL|"TUPLE_FLAG_EVENT,
                                        "routeunset-ula|/usr/bin//service_routed|NULL|"TUPLE_FLAG_EVENT,
                                        #endif

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Comment on lines +81 to +85
#if defined(_ONESTACK_PRODUCT_REQ_)
if(is_devicemode_business())
{
sm_register(SERVICE_NAME, SERVICE_DEFAULT_HANDLER_BCI, SERVICE_CUSTOM_EVENTS_BCI);
}
Copy link

Copilot AI Mar 5, 2026

Choose a reason for hiding this comment

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

In _ONESTACK_PRODUCT_REQ_ builds, srv_register() can call sm_register(..., SERVICE_CUSTOM_EVENTS_BCI), but SERVICE_CUSTOM_EVENTS_BCI is only defined in the #else branch (not for _CBR_PRODUCT_REQ_ or CISCO_CONFIG_DHCPV6_PREFIX_DELEGATION). This will fail to compile for those configurations; define SERVICE_CUSTOM_EVENTS_BCI for all preprocessor branches (or gate the business-mode branch on the same conditions).

Copilot uses AI. Check for mistakes.
Comment on lines 48 to 50
#if defined(CORE_NET_LIB)
IN_CORE_NET_LIB_SPACE
const char* SERVICE_CUSTOM_EVENTS[] = {
Copy link

Copilot AI Mar 5, 2026

Choose a reason for hiding this comment

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

IN_CORE_NET_LIB_SPACE is a stray token at global scope (not defined anywhere in the repo) and will cause a compile error when CORE_NET_LIB is enabled. Remove it, or replace it with a real preprocessor directive/macro that is actually defined.

Copilot uses AI. Check for mistakes.
NULL
};
#elif defined(CISCO_CONFIG_DHCPV6_PREFIX_DELEGATION)
IN_CISCO_CONFIG_DHCPV6_PREFIX_DELEGATION_SPACE
Copy link

Copilot AI Mar 5, 2026

Choose a reason for hiding this comment

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

IN_CISCO_CONFIG_DHCPV6_PREFIX_DELEGATION_SPACE is a stray token at global scope (not defined anywhere in the repo) and will cause a compile error when CISCO_CONFIG_DHCPV6_PREFIX_DELEGATION is enabled. Remove it, or replace it with a real preprocessor directive/macro that is actually defined.

Suggested change
IN_CISCO_CONFIG_DHCPV6_PREFIX_DELEGATION_SPACE

Copilot uses AI. Check for mistakes.
const char* SERVICE_DEFAULT_HANDLER_BCI = "/etc/utopia/service.d/service_dhcpv6_server_bci.sh";

#if defined(_CBR_PRODUCT_REQ_) && !defined(_CBR2_PRODUCT_REQ_)
IN__CBR_PRODUCT_REQ_SPACE
Copy link

Copilot AI Mar 5, 2026

Choose a reason for hiding this comment

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

IN__CBR_PRODUCT_REQ_SPACE is a stray token at global scope (not defined anywhere in the repo) and will cause a compile error when _CBR_PRODUCT_REQ_ is enabled. Remove it, or replace it with a real preprocessor directive/macro that is actually defined.

Suggested change
IN__CBR_PRODUCT_REQ_SPACE

Copilot uses AI. Check for mistakes.
Reason for change: Some utopia scripts were customized for BCI platforms. service_dhcpv6_server_bci.sh,service_routed_bci.sh,service_dhcpv6_client_arm_bci.sh,service_ipv4_bci.sh
Test Procedure: check if bci scripts are installed and its registering CUSTOM events for xb10 Onestack
Priority: P1
Risks: Low

Signed-off-by: Deepak_m <deepak_m@comcast.com>
Copilot AI review requested due to automatic review settings March 7, 2026 09:52
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

LDFLAGS += -lsecure_wrapper

if ONESTACK_PRODUCT_REQ
AM_LDFLAGS += -ldevicemode
Copy link

Copilot AI Mar 7, 2026

Choose a reason for hiding this comment

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

The ONESTACK build adds -ldevicemode but does not add a library search path (e.g., -L${PKG_CONFIG_SYSROOT_DIR}$(libdir)). In this repo, other ONESTACK makefiles that link -ldevicemode also add an explicit -L to the sysroot libdir, suggesting the default link search path may not include it in cross builds. Consider mirroring that pattern here to avoid ONESTACK link failures.

Suggested change
AM_LDFLAGS += -ldevicemode
AM_LDFLAGS += -L${PKG_CONFIG_SYSROOT_DIR}$(libdir) -ldevicemode

Copilot uses AI. Check for mistakes.
Comment on lines 45 to +46
#define SERVICE_DEFAULT_HANDLER "/etc/utopia/service.d/service_dhcpv6_client.sh"
#define SERVICE_DEFAULT_HANDLER_BCI "/etc/utopia/service.d/service_dhcpv6_client_arm_bci.sh"
Copy link

Copilot AI Mar 7, 2026

Choose a reason for hiding this comment

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

PR description says to "check if bci scripts are installed" before registering custom events, but the code switches handlers purely on is_devicemode_business() and unconditionally registers ..._arm_bci.sh when true. Consider adding an explicit existence check for the BCI handler script (and falling back to the default handler/events if missing) so sysevent registration doesn't point to a non-existent path.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants