Skip to content

Commit eeb4f20

Browse files
committed
RDKB-63098: [ONESTACK]-Handle IPv6 delegation for business
vs residential Partner ID as part of single build Reason for change: Prefix delegation handling Test Procedure: - Build OneStack Image - In Business-mode, Check dibbler server is started and server.conf has prefix-delegation class - In Residential-mode, check whether device behaves as a non-CBR device Risks: None Priority: P1 Signed-off-by: rirfha948 <rasina_irfhan@comcast.com>
1 parent ea304a3 commit eeb4f20

File tree

11 files changed

+188
-42
lines changed

11 files changed

+188
-42
lines changed

source/firewall/Makefile.am

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,3 +43,8 @@ nfq_handler_LDADD = $(top_builddir)/source/syscfg/lib/libsyscfg.la \
4343
if CORE_NET_LIB_FEATURE_SUPPORT
4444
AM_LDFLAGS += -lnet
4545
endif
46+
47+
if ONESTACK_PRODUCT_REQ
48+
AM_LDFLAGS += -ldevicemode -lrdkb_feature_mode_gate
49+
endif
50+

source/firewall/firewall.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -627,7 +627,8 @@ int prepare_multinet_filter_output_v6(FILE *fp);
627627
*/
628628
int prepare_ipv6_rule_ex_mode(FILE *raw_fp, FILE *mangle_fp, FILE *nat_fp, FILE *filter_fp);
629629
#endif
630-
#if defined(CISCO_CONFIG_DHCPV6_PREFIX_DELEGATION) && !defined(_CBR_PRODUCT_REQ_)
630+
#if (defined(CISCO_CONFIG_DHCPV6_PREFIX_DELEGATION) && !defined(_CBR_PRODUCT_REQ_)) \
631+
|| defined(_ONESTACK_PRODUCT_REQ_)
631632
/**
632633
* @brief Prepare IPv6 MultiNet rules with DHCPv6 prefix delegation support.
633634
*

source/firewall/firewall_ipv6.c

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,9 @@
9898
#include <net/if.h>
9999
#endif
100100

101+
#ifdef _ONESTACK_PRODUCT_REQ_
102+
#include <rdkb_feature_mode_gate.h>
103+
#endif
101104
void* bus_handle ;
102105
int sysevent_fd;
103106
char sysevent_ip[19];
@@ -862,11 +865,17 @@ void do_ipv6_filter_table(FILE *fp){
862865
}
863866
#endif /*_HUB4_PRODUCT_REQ_*/
864867

865-
#if defined(CISCO_CONFIG_DHCPV6_PREFIX_DELEGATION) && ! defined(_CBR_PRODUCT_REQ_)
868+
#if (defined(CISCO_CONFIG_DHCPV6_PREFIX_DELEGATION) && !defined(_CBR_PRODUCT_REQ_)) || defined(_ONESTACK_PRODUCT_REQ_)
869+
#if defined(_ONESTACK_PRODUCT_REQ_)
870+
if ( isFeatureSupportedInCurrentMode(FEATURE_IPV6_DELEGATION) == true)
871+
#endif
872+
{
873+
866874
/*Add a simple logic here to make traffic allowed for lan interfaces
867875
* exclude primary lan*/
868876
prepare_ipv6_multinet(fp);
869-
#endif
877+
}
878+
#endif
870879
#if !defined(_XER5_PRODUCT_REQ_) && !defined (_SCER11BEL_PRODUCT_REQ_) && !defined(_COSA_QCA_ARM_) //wan0 is not applicable for XER5
871880
/* not allow ping wan0 from brlan0 */
872881
int i;
@@ -1717,9 +1726,17 @@ void do_ipv6_filter_table(FILE *fp){
17171726
FIREWALL_DEBUG("Exiting prepare_ipv6_firewall \n");
17181727
}
17191728

1720-
#if defined(CISCO_CONFIG_DHCPV6_PREFIX_DELEGATION) && ! defined(_CBR_PRODUCT_REQ_)
1721-
static int prepare_ipv6_multinet(FILE *fp)
1729+
#if (defined(CISCO_CONFIG_DHCPV6_PREFIX_DELEGATION) && !defined(_CBR_PRODUCT_REQ_)) \
1730+
|| defined(_ONESTACK_PRODUCT_REQ_)
1731+
int prepare_ipv6_multinet(FILE *fp)
17221732
{
1733+
#ifdef _ONESTACK_PRODUCT_REQ_
1734+
if (!isFeatureSupportedInCurrentMode(FEATURE_IPV6_DELEGATION))
1735+
{
1736+
/* PD feature disabled */
1737+
return 0;
1738+
}
1739+
#endif
17231740
char active_insts[32] = {0};
17241741
char lan_pd_if[128] = {0};
17251742
char *p = NULL;

source/scripts/init/c_registration/15_dhcpv6_client.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ const char* SERVICE_CUSTOM_EVENTS[] = {
5757
"lan-status|/usr/bin/service_dhcpv6_client",
5858
NULL
5959
};
60-
#elif defined(CISCO_CONFIG_DHCPV6_PREFIX_DELEGATION)
60+
#elif defined(CISCO_CONFIG_DHCPV6_PREFIX_DELEGATION) || defined(_ONESTACK_PRODUCT_REQ_)
6161
const char* SERVICE_CUSTOM_EVENTS[] = {
6262
"erouter_mode-updated|/etc/utopia/service.d/service_dhcpv6_client.sh",
6363
"phylink_wan_state|/etc/utopia/service.d/service_dhcpv6_client.sh",

source/scripts/init/c_registration/15_dhcpv6_server.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ const char* SERVICE_CUSTOM_EVENTS[] = {
4747
"dhcpv6_server-restart|/usr/bin/service_ipv6",
4848
NULL
4949
};
50-
#elif defined (CISCO_CONFIG_DHCPV6_PREFIX_DELEGATION)
50+
#elif defined(CISCO_CONFIG_DHCPV6_PREFIX_DELEGATION) || defined(_ONESTACK_PRODUCT_REQ_)
5151
const char* SERVICE_CUSTOM_EVENTS[] = {
5252
"dhcpv6_option_changed|/etc/utopia/service.d/service_dhcpv6_server.sh|NULL|"TUPLE_FLAG_EVENT,
5353
NULL

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
#define SERVICE_NAME "routed"
4545
#define SERVICE_DEFAULT_HANDLER "/etc/utopia/service.d/service_routed.sh"
4646

47-
#ifdef CISCO_CONFIG_DHCPV6_PREFIX_DELEGATION
47+
#if defined(CISCO_CONFIG_DHCPV6_PREFIX_DELEGATION) || defined(_ONESTACK_PRODUCT_REQ_)
4848
const char* SERVICE_CUSTOM_EVENTS[] = {
4949
"wan-status|/etc/utopia/service.d/service_routed.sh",
5050
"lan-status|/etc/utopia/service.d/service_routed.sh",

source/service_ipv6/Makefile.am

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ AM_CPPFLAGS = -I$(top_srcdir)/source/include \
2525

2626
AM_LDFLAGS = -lccsp_common -lsecure_wrapper $(DBUS_LIBS)
2727

28+
if ONESTACK_PRODUCT_REQ
29+
AM_LDFLAGS += -ldevicemode -lonestack_syscfg -lonestack_log -lrdkb_feature_mode_gate
30+
endif
2831
service_ipv6_SOURCES = service_ipv6.c service_ipv6_main.c
2932

3033
service_ipv6_LDADD = $(top_builddir)/source/util/utils/libutopiautil.la \

source/service_ipv6/service_ipv6.c

Lines changed: 33 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,9 @@
5353
#include "ccsp_memory.h"
5454
#endif
5555

56+
#ifdef _ONESTACK_PRODUCT_REQ_
57+
#include <rdkb_feature_mode_gate.h>
58+
#endif
5659
#ifdef _HUB4_PRODUCT_REQ_
5760
#include "ccsp_dm_api.h"
5861
#include "ccsp_custom.h"
@@ -391,10 +394,21 @@ STATIC int get_dhcpv6s_pool_cfg(struct serv_ipv6 *si6, dhcpv6s_pool_cfg_t *cfg)
391394
DHCPV6S_SYSCFG_GETI(DHCPV6S_NAME, "pool", cfg->index, "", 0, "X_RDKCENTRAL_COM_DNSServersEnabled", cfg->X_RDKCENTRAL_COM_DNSServersEnabled);
392395

393396
#ifdef MULTILAN_FEATURE
394-
#ifdef CISCO_CONFIG_DHCPV6_PREFIX_DELEGATION
395-
DHCPV6S_SYSCFG_GETS(DHCPV6S_NAME, "pool", cfg->index, "", 0, "IAInterface", iface_name);
396-
#else
397-
DHCPV6S_SYSCFG_GETS(DHCPV6S_NAME, "pool", cfg->index, "", 0, "Interface", iface_name);
397+
#if defined(CISCO_CONFIG_DHCPV6_PREFIX_DELEGATION) || defined(_ONESTACK_PRODUCT_REQ_)
398+
#if defined(_ONESTACK_PRODUCT_REQ_)
399+
if (isFeatureSupportedInCurrentMode(FEATURE_IPV6_DELEGATION) == true)
400+
#endif
401+
{
402+
DHCPV6S_SYSCFG_GETS(DHCPV6S_NAME, "pool", cfg->index, "", 0, "IAInterface", iface_name);
403+
}
404+
#endif
405+
#if !defined(CISCO_CONFIG_DHCPV6_PREFIX_DELEGATION) || defined(_ONESTACK_PRODUCT_REQ_)
406+
#if defined(_ONESTACK_PRODUCT_REQ_)
407+
if (isFeatureSupportedInCurrentMode(FEATURE_IPV6_DELEGATION) == false)
408+
#endif
409+
{
410+
DHCPV6S_SYSCFG_GETS(DHCPV6S_NAME, "pool", cfg->index, "", 0, "Interface", iface_name);
411+
}
398412
#endif
399413
#else
400414
DHCPV6S_SYSCFG_GETS(DHCPV6S_NAME, "pool", cfg->index, "", 0, "IAInterface", cfg->interface);
@@ -606,7 +620,7 @@ STATIC int get_prefix_info(const char *prefix, char *value, unsigned int val_le
606620
STATIC int get_active_lanif(struct serv_ipv6 *si6, unsigned int insts[], unsigned int *num)
607621
{
608622
int i = 0;
609-
#if !defined(MULTILAN_FEATURE) || defined CISCO_CONFIG_DHCPV6_PREFIX_DELEGATION
623+
#if !defined(MULTILAN_FEATURE) || defined CISCO_CONFIG_DHCPV6_PREFIX_DELEGATION || defined(_ONESTACK_PRODUCT_REQ_)
610624
char active_insts[32] = {0};
611625
char lan_pd_if[128] = {0};
612626
char *p = NULL;
@@ -628,7 +642,11 @@ STATIC int get_active_lanif(struct serv_ipv6 *si6, unsigned int insts[], unsigne
628642
unsigned int max_active_if_count = 0;
629643
int primary_l3_instance = 0;
630644

631-
#ifdef CISCO_CONFIG_DHCPV6_PREFIX_DELEGATION
645+
#if defined(CISCO_CONFIG_DHCPV6_PREFIX_DELEGATION) || defined(_ONESTACK_PRODUCT_REQ_)
646+
#if defined(_ONESTACK_PRODUCT_REQ_)
647+
if (isFeatureSupportedInCurrentMode(FEATURE_IPV6_DELEGATION))
648+
#endif
649+
{
632650
syscfg_get(NULL, "lan_pd_interfaces", lan_pd_if, sizeof(lan_pd_if));
633651
if (lan_pd_if[0] == '\0') {
634652
*num = 0;
@@ -648,7 +666,14 @@ STATIC int get_active_lanif(struct serv_ipv6 *si6, unsigned int insts[], unsigne
648666

649667
p = strtok(NULL, " ");
650668
}
651-
#else
669+
}
670+
#endif
671+
#if !defined(CISCO_CONFIG_DHCPV6_PREFIX_DELEGATION) || defined(_ONESTACK_PRODUCT_REQ_)
672+
#if defined(_ONESTACK_PRODUCT_REQ_)
673+
if (!isFeatureSupportedInCurrentMode(FEATURE_IPV6_DELEGATION))
674+
#endif
675+
{
676+
652677
/* Get active bridge count from PSM */
653678
if (!bus_handle) {
654679
fprintf(stderr, "DBUS not connected, returning \n");
@@ -718,6 +743,7 @@ STATIC int get_active_lanif(struct serv_ipv6 *si6, unsigned int insts[], unsigne
718743
}
719744
/* Set active IPv6 instances */
720745
sysevent_set(si6->sefd, si6->setok, "ipv6_active_inst", active_if_list, 0);
746+
}
721747
#endif
722748

723749

source/service_routed/Makefile.am

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,11 @@
1919

2020
bin_PROGRAMS = service_routed
2121

22-
AM_LDFLAGS = -lsecure_wrapper
22+
AM_CPPFLAGS = -I$(top_srcdir)/source/include \
23+
-I$(top_srcdir)/source/util/utils \
24+
$(DBUS_CFLAGS)
25+
26+
AM_LDFLAGS = -lsecure_wrapper -lccsp_common $(DBUS_LIBS)
2327

2428
service_routed_SOURCES = service_routed.c service_routed_main.c
2529

@@ -29,8 +33,8 @@ service_routed_CFLAGS = -I$(top_srcdir)/source \
2933
-I$(top_srcdir)/source/utapi/lib \
3034
-I$(top_srcdir)/source/util/utils \
3135
-I${PKG_CONFIG_SYSROOT_DIR}$(includedir)/dbus-1.0 \
32-
-I${PKG_CONFIG_SYSROOT_DIR}$(libdir)/dbus-1.0/include
33-
36+
-I${PKG_CONFIG_SYSROOT_DIR}$(libdir)/dbus-1.0/include \
37+
-I${PKG_CONFIG_SYSROOT_DIR}$(includedir)
3438

3539
service_routed_LDADD = $(top_builddir)/source/util/utils/libutopiautil.la \
3640
$(top_builddir)/source/services/lib/libsrvmgr.la \
@@ -40,6 +44,10 @@ service_routed_LDADD = $(top_builddir)/source/util/utils/libutopiautil.la \
4044
$(top_builddir)/source/utctx/lib/libutctx.la \
4145
$(top_builddir)/source/ulog/libulog.la \
4246
-ltelemetry_msgsender
47+
service_routed_LDFLAGS = -L${PKG_CONFIG_SYSROOT_DIR}${libdir}
48+
if ONESTACK_PRODUCT_REQ
49+
service_routed_LDFLAGS += -ldevicemode -lonestack_syscfg -lonestack_log -lrdkb_feature_mode_gate
50+
endif
4351
if CORE_NET_LIB_FEATURE_SUPPORT
44-
service_routed_LDFLAGS = -lnet
52+
service_routed_LDFLAGS += -lnet
4553
endif

0 commit comments

Comments
 (0)