-
Notifications
You must be signed in to change notification settings - Fork 42
RDKB-63098: [ONESTACK]-Handle IPv6 delegation for business vs residential Partner ID as part of single build #238
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Changes from 7 commits
c2e4e85
a8c6b12
31e5822
0443b75
d979af5
9280c3f
33c34ce
1243c22
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| 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
|
||||||||||||||||||||||||||||||
| * following copyright and licenses apply: | ||||||||||||||||||||||||||||||
| * | ||||||||||||||||||||||||||||||
| * Copyright 2015 RDK Management | ||||||||||||||||||||||||||||||
|
|
@@ -97,6 +97,9 @@ | |||||||||||||||||||||||||||||
| #include <netinet/in.h> | ||||||||||||||||||||||||||||||
| #include <net/if.h> | ||||||||||||||||||||||||||||||
| #endif | ||||||||||||||||||||||||||||||
| #ifdef _ONESTACK_PRODUCT_REQ_ | ||||||||||||||||||||||||||||||
| #include <rdkb_feature_mode_gate.h> | ||||||||||||||||||||||||||||||
| #endif | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| void* bus_handle ; | ||||||||||||||||||||||||||||||
| int sysevent_fd; | ||||||||||||||||||||||||||||||
|
|
@@ -1246,18 +1249,41 @@ | |||||||||||||||||||||||||||||
| sysevent_get(sysevent_fd, sysevent_token, "previous_ipv6_prefix", prev_prefix, sizeof(prev_prefix)); | ||||||||||||||||||||||||||||||
| #endif | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| #ifdef WAN_FAILOVER_SUPPORTED | ||||||||||||||||||||||||||||||
| #ifdef WAN_FAILOVER_SUPPORTED | ||||||||||||||||||||||||||||||
| if (0 == checkIfULAEnabled()) | ||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||
| sysevent_get(sysevent_fd, sysevent_token, "ipv6_prefix_ula", prefix, sizeof(prefix)); | ||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||
| else | ||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||
| #ifdef _ONESTACK_PRODUCT_REQ_ | ||||||||||||||||||||||||||||||
| if(isFeatureSupportedInCurrentMode(FEATURE_IPV6_DELEGATION)) | ||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||
| sysevent_get(sysevent_fd, sysevent_token, "ipv6_prefix_delegation", prefix, sizeof(prefix)); | ||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||
| else | ||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||
| sysevent_get(sysevent_fd, sysevent_token, "ipv6_prefix", prefix, sizeof(prefix)); | ||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||
| #else | ||||||||||||||||||||||||||||||
| sysevent_get(sysevent_fd, sysevent_token, "ipv6_prefix", prefix, sizeof(prefix)); | ||||||||||||||||||||||||||||||
| #endif | ||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| #else | ||||||||||||||||||||||||||||||
| #ifdef _ONESTACK_PRODUCT_REQ_ | ||||||||||||||||||||||||||||||
| if(isFeatureSupportedInCurrentMode(FEATURE_IPV6_DELEGATION)) | ||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||
| sysevent_get(sysevent_fd, sysevent_token, "ipv6_prefix_delegation", prefix, sizeof(prefix)); | ||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||
| else | ||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||
| sysevent_get(sysevent_fd, sysevent_token, "ipv6_prefix", prefix, sizeof(prefix)); | ||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||
| #else | ||||||||||||||||||||||||||||||
| #else | ||||||||||||||||||||||||||||||
| sysevent_get(sysevent_fd, sysevent_token, "ipv6_prefix", prefix, sizeof(prefix)); | ||||||||||||||||||||||||||||||
| #endif | ||||||||||||||||||||||||||||||
| #endif | ||||||||||||||||||||||||||||||
| #endif | ||||||||||||||||||||||||||||||
| #ifdef FEATURE_MAPE | ||||||||||||||||||||||||||||||
| if (prev_prefix[0] != '\0' && prefix[0] != '\0' && strcmp(prev_prefix, prefix) != 0) | ||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||
|
|
@@ -1267,8 +1293,14 @@ | |||||||||||||||||||||||||||||
| if ( '\0' != prefix[0] ) { | ||||||||||||||||||||||||||||||
| //fprintf(fp, "-A FORWARD ! -s %s -i %s -m limit --limit 10/sec -j LOG --log-level %d --log-prefix \"UTOPIA: FW. IPv6 FORWARD anti-spoofing\"\n", prefix, lan_ifname,syslog_level); | ||||||||||||||||||||||||||||||
| //fprintf(fp, "-A FORWARD ! -s %s -i %s -m limit --limit 10/sec -j REJECT --reject-with icmp6-adm-prohibited\n", prefix, lan_ifname); | ||||||||||||||||||||||||||||||
| #ifdef _COSA_FOR_BCI_ | ||||||||||||||||||||||||||||||
| #if defined (_COSA_FOR_BCI_) || defined (_ONESTACK_PRODUCT_REQ_) | ||||||||||||||||||||||||||||||
| /* adding forward rule for PD traffic */ | ||||||||||||||||||||||||||||||
| #ifdef _ONESTACK_PRODUCT_REQ_ | ||||||||||||||||||||||||||||||
| if(isFeatureSupportedInCurrentMode(FEATURE_IPV6_DELEGATION)) | ||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||
| fprintf(fp, "-A FORWARD -s %s -i %s -j ACCEPT\n", prefix, lan_ifname); | ||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||
| #else | ||||||||||||||||||||||||||||||
| fprintf(fp, "-A FORWARD -s %s -i %s -j ACCEPT\n", prefix, lan_ifname); | ||||||||||||||||||||||||||||||
| if (strncasecmp(firewall_levelv6, "Custom", strlen("Custom")) == 0) | ||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||
|
|
@@ -1280,6 +1312,7 @@ | |||||||||||||||||||||||||||||
| fprintf(fp, "-A FORWARD -d %s -o %s -j ACCEPT\n", prefix, lan_ifname); | ||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||
| #endif | ||||||||||||||||||||||||||||||
| #endif | ||||||||||||||||||||||||||||||
| FIREWALL_DEBUG("current_wan_ifname is %s default_wan_ifname is %s lan_ifname is %s wan6_ifname %s \n" COMMA current_wan_ifname COMMA default_wan_ifname COMMA lan_ifname COMMA wan6_ifname); | ||||||||||||||||||||||||||||||
| if (strcmp(current_wan_ifname,default_wan_ifname ) == 0) | ||||||||||||||||||||||||||||||
|
|
@@ -2053,10 +2086,25 @@ | |||||||||||||||||||||||||||||
| memset(prefix,0,sizeof(prefix)); | ||||||||||||||||||||||||||||||
| int i ; | ||||||||||||||||||||||||||||||
| if ( ULA_IPV6 == type) | ||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||
| sysevent_get(sysevent_fd, sysevent_token, "ipv6_prefix_ula", prefix, sizeof(prefix)); | ||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||
| else | ||||||||||||||||||||||||||||||
| sysevent_get(sysevent_fd, sysevent_token, "ipv6_prefix", prefix, sizeof(prefix)); | ||||||||||||||||||||||||||||||
| if (strlen(prefix) != 0 ) | ||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||
| #ifdef _ONESTACK_PRODUCT_REQ_ | ||||||||||||||||||||||||||||||
| if(isFeatureSupportedInCurrentMode(FEATURE_IPV6_DELEGATION)) | ||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||
| sysevent_get(sysevent_fd, sysevent_token, "ipv6_prefix_delegation", prefix, sizeof(prefix)); | ||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||
| else | ||||||||||||||||||||||||||||||
|
Comment on lines
+2093
to
+2099
|
||||||||||||||||||||||||||||||
| { | |
| if(isFeatureSupportedInCurrentMode(FEATURE_IPV6_DELEGATION)) | |
| { | |
| sysevent_get(sysevent_fd, sysevent_token, "ipv6_prefix_delegation", prefix, sizeof(prefix)); | |
| } | |
| else | |
| { | |
| #ifdef _ONESTACK_PRODUCT_REQ_ | |
| if(isFeatureSupportedInCurrentMode(FEATURE_IPV6_DELEGATION)) | |
| { | |
| sysevent_get(sysevent_fd, sysevent_token, "ipv6_prefix_delegation", prefix, sizeof(prefix)); | |
| } | |
| else | |
| #endif |
| 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/15_dhcpv6_server.c
|
||||||
| * following copyright and licenses apply: | ||||||
| * | ||||||
| * Copyright 2015 RDK Management | ||||||
|
|
@@ -35,10 +35,17 @@ | |||||
|
|
||||||
| #include <stdio.h> | ||||||
| #include "srvmgr.h" | ||||||
| #ifdef _ONESTACK_PRODUCT_REQ_ | ||||||
| #include <rdkb_feature_mode_gate.h> | ||||||
| #endif | ||||||
|
|
||||||
| const char* SERVICE_NAME = "dhcpv6_server"; | ||||||
| const char* SERVICE_DEFAULT_HANDLER = "/etc/utopia/service.d/service_dhcpv6_server.sh"; | ||||||
|
|
||||||
| #if defined(_ONESTACK_PRODUCT_REQ_) | ||||||
| const char** SERVICE_CUSTOM_EVENTS = NULL; | ||||||
| #endif | ||||||
|
Comment on lines
+45
to
+47
|
||||||
|
|
||||||
| #if defined(_CBR_PRODUCT_REQ_) && !defined(_CBR2_PRODUCT_REQ_) | ||||||
| const char* SERVICE_CUSTOM_EVENTS[] = { | ||||||
|
Comment on lines
+45
to
50
|
||||||
| "dhcpv6_option_changed|/usr/bin/service_ipv6", | ||||||
|
|
@@ -47,11 +54,29 @@ | |||||
| "dhcpv6_server-restart|/usr/bin/service_ipv6", | ||||||
| NULL | ||||||
| }; | ||||||
| #elif defined (CISCO_CONFIG_DHCPV6_PREFIX_DELEGATION) | ||||||
| #elif defined(CISCO_CONFIG_DHCPV6_PREFIX_DELEGATION) | ||||||
| const char* SERVICE_CUSTOM_EVENTS[] = { | ||||||
| "dhcpv6_option_changed|/etc/utopia/service.d/service_dhcpv6_server.sh|NULL|"TUPLE_FLAG_EVENT, | ||||||
| NULL | ||||||
|
Comment on lines
45
to
60
|
||||||
| }; | ||||||
| #elif defined(_ONESTACK_PRODUCT_REQ_) | ||||||
| const char* SERVICE_CUSTOM_EVENTS_RESIDENTIAL[] = { | ||||||
| "lan-status|/etc/utopia/service.d/service_dhcpv6_server.sh", | ||||||
| "ipv6_nameserver|/etc/utopia/service.d/service_dhcpv6_server.sh", | ||||||
| "ipv6_domain|/etc/utopia/service.d/service_dhcpv6_server.sh", | ||||||
| "ipv6_ntp_server|/etc/utopia/service.d/service_dhcpv6_server.sh", | ||||||
| "dhcp_domain|/etc/utopia/service.d/service_dhcpv6_server.sh", | ||||||
| "current_lan_ipv6address|/etc/utopia/service.d/service_dhcpv6_server.sh", | ||||||
| NULL | ||||||
|
||||||
| NULL | |
| NULL |
| 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
|
||||||||||
| * following copyright and licenses apply: | ||||||||||
| * | ||||||||||
| * Copyright 2015 RDK Management | ||||||||||
|
|
@@ -40,11 +40,16 @@ | |||||||||
| #endif | ||||||||||
| #include "srvmgr.h" | ||||||||||
| #include "secure_wrapper.h" | ||||||||||
| #ifdef _ONESTACK_PRODUCT_REQ_ | ||||||||||
| #include <rdkb_feature_mode_gate.h> | ||||||||||
| #endif | ||||||||||
|
|
||||||||||
| #define SERVICE_NAME "routed" | ||||||||||
| #define SERVICE_DEFAULT_HANDLER "/etc/utopia/service.d/service_routed.sh" | ||||||||||
|
|
||||||||||
| #ifdef CISCO_CONFIG_DHCPV6_PREFIX_DELEGATION | ||||||||||
| #if defined(_ONESTACK_PRODUCT_REQ_) | ||||||||||
| const char** SERVICE_CUSTOM_EVENTS = NULL; | ||||||||||
|
Comment on lines
+49
to
+50
|
||||||||||
| #if defined(_ONESTACK_PRODUCT_REQ_) | |
| const char** SERVICE_CUSTOM_EVENTS = NULL; | |
| #if defined(_ONESTACK_PRODUCT_REQ_) && !defined(CISCO_CONFIG_DHCPV6_PREFIX_DELEGATION) | |
| const char* const *SERVICE_CUSTOM_EVENTS = NULL; |
Copilot
AI
Feb 27, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OneStack introduces const char** SERVICE_CUSTOM_EVENTS = NULL; but this file also defines const char* SERVICE_CUSTOM_EVENTS[] under CISCO_CONFIG_DHCPV6_PREFIX_DELEGATION. If both macros are enabled, this will not compile (symbol redefinition). Please restructure/guard so only one SERVICE_CUSTOM_EVENTS definition exists for any macro combination.
Copilot
AI
Mar 2, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This introduces a duplicate definition of SERVICE_CUSTOM_EVENTS when both _ONESTACK_PRODUCT_REQ_ and CISCO_CONFIG_DHCPV6_PREFIX_DELEGATION are defined (pointer + array with the same identifier), which will fail compilation. Fix by making the OneStack pointer declaration mutually exclusive with the other SERVICE_CUSTOM_EVENTS[] declarations (e.g., fold it into the same #if/#elif/#else chain), or rename the OneStack-selected pointer (e.g., SERVICE_CUSTOM_EVENTS_PTR) and pass that to sm_register().
Copilot
AI
Feb 27, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using preprocessor directives inside array initialization is non-standard and could cause compilation issues or unexpected behavior depending on the compiler. If WAN_FAILOVER_SUPPORTED is not defined, this will result in a trailing comma before NULL, which while typically handled by most C compilers, is technically a C99 feature and may not be portable. Consider defining two complete separate arrays or restructuring to avoid conditionals within the array.
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -132,3 +132,6 @@ endif | |||||
| if ENABLE_HOTSPOT_SERVICE | ||||||
| 15_hotspot_SOURCES = 15_hotspot.c | ||||||
| endif | ||||||
| if ONESTACK_PRODUCT_REQ | ||||||
| LDFLAGS += -lrdkb_feature_mode_gate | ||||||
|
||||||
| LDFLAGS += -lrdkb_feature_mode_gate | |
| 02_devicemode_LDADD = -lrdkb_feature_mode_gate |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isFeatureSupportedInCurrentMode()is called inside theWAN_FAILOVER_SUPPORTEDbranch without an_ONESTACK_PRODUCT_REQ_guard, but the header/library are only included/linked for ONESTACK builds. IfWAN_FAILOVER_SUPPORTEDis enabled on a non-ONESTACK build this will fail to compile/link. Please wrap these calls with#ifdef _ONESTACK_PRODUCT_REQ_(and fall back toipv6_prefixotherwise), or make the feature-gate dependency unconditional for the configs that enable this path.