diff --git a/configure.ac b/configure.ac index 7e375d24..556b46e1 100644 --- a/configure.ac +++ b/configure.ac @@ -231,6 +231,7 @@ AM_CONDITIONAL(BCI_SUPPORT, test x"$bci_support" = x"true") # Check ra_monitor_support AM_CONDITIONAL([RA_MONITOR_SUPPORT], [test "$RA_MONITOR_SUPPORT" = "yes"]) +AM_CONDITIONAL([ONESTACK_PRODUCT_REQ], [test "x$ONESTACK_PRODUCT_REQ" = "xtrue"]) # Checks for header files. AC_CHECK_HEADERS([stdlib.h string.h unistd.h]) diff --git a/source/DHCPServerUtils/DHCPv6Server/Makefile.am b/source/DHCPServerUtils/DHCPv6Server/Makefile.am index 4de4b329..58bc4ffb 100644 --- a/source/DHCPServerUtils/DHCPv6Server/Makefile.am +++ b/source/DHCPServerUtils/DHCPv6Server/Makefile.am @@ -38,3 +38,6 @@ libCcspDhcpMgr_Dhcpv6Server_la_SOURCES += service_ipv6.c endif libCcspDhcpMgr_Dhcpv6Server_la_LIBADD = -lccsp_common -ltelemetry_msgsender -lulog -lsyscfg -lsysevent -ltime_conversion -lprint_uptime -lnet +if ONESTACK_PRODUCT_REQ +libCcspDhcpMgr_Dhcpv6Server_la_LIBADD += -ldevicemode -lonestack_syscfg -lonestack_log -lrdkb_feature_mode_gate +endif diff --git a/source/DHCPServerUtils/DHCPv6Server/dhcpv6server_function.c b/source/DHCPServerUtils/DHCPv6Server/dhcpv6server_function.c index 9f6dfd79..c63e17d0 100644 --- a/source/DHCPServerUtils/DHCPv6Server/dhcpv6server_function.c +++ b/source/DHCPServerUtils/DHCPv6Server/dhcpv6server_function.c @@ -47,7 +47,9 @@ #include "sysevent/sysevent.h" #include "cosa_apis_util.h" #include "ifl.h" - +#ifdef _ONESTACK_PRODUCT_REQ_ +#include +#endif extern void* g_pDslhDmlAgent; extern ANSC_HANDLE bus_handle; extern char g_Subsystem[32]; @@ -76,7 +78,7 @@ extern int executeCmd(char *cmd); //#include "cosa_ip_apis.h" #include "cosa_common_util.h" -#if defined(CISCO_CONFIG_DHCPV6_PREFIX_DELEGATION) && defined(_COSA_BCM_MIPS_) +#if defined((CISCO_CONFIG_DHCPV6_PREFIX_DELEGATION) && defined(_COSA_BCM_MIPS_)) || defined(_ONESTACK_PRODUCT_REQ_) #include #endif @@ -223,11 +225,15 @@ void dhcpv6_server_init() #define DHCPS6V_SERVER_RESTART_FIFO "/tmp/ccsp-dhcpv6-server-restart-fifo.txt" -#if defined(CISCO_CONFIG_DHCPV6_PREFIX_DELEGATION) && ! defined(_CBR_PRODUCT_REQ_) && ! defined(_BCI_FEATURE_REQ) +#if (defined(CISCO_CONFIG_DHCPV6_PREFIX_DELEGATION) && \ + !defined(_CBR_PRODUCT_REQ_) && \ + !defined(_BCI_FEATURE_REQ_)) || \ + defined(_ONESTACK_PRODUCT_REQ_) + #else /* - +//Todo: Adapt for One stack Product void CosaDmlDhcpv6sRestartOnLanStarted(void * arg) { UNREFERENCED_PARAMETER(arg); @@ -290,7 +296,7 @@ int CosaDmlDHCPv6sTriggerRestart(BOOL OnlyTrigger) //OnlyTrigger = (int *)arg; DHCPVS_DEBUG_PRINT - #if defined(CISCO_CONFIG_DHCPV6_PREFIX_DELEGATION) && ! defined(DHCPV6_PREFIX_FIX) + #if defined ((CISCO_CONFIG_DHCPV6_PREFIX_DELEGATION) && ! defined(DHCPV6_PREFIX_FIX)) || defined(_ONESTACK_PRODUCT_REQ_) UNREFERENCED_PARAMETER(OnlyTrigger); ifl_set_event("dhcpv6_server-restart", ""); #else @@ -1479,7 +1485,7 @@ void __cosa_dhcpsv6_refresh_config() char responseCode[10]; struct stat check_ConfigFile; errno_t rc = -1; -#ifdef CISCO_CONFIG_DHCPV6_PREFIX_DELEGATION +#if defined(CISCO_CONFIG_DHCPV6_PREFIX_DELEGATION) || defined(_ONESTACK_PRODUCT_REQ_) pd_pool_t pd_pool; ia_pd_t ia_pd; #endif @@ -1490,7 +1496,11 @@ void __cosa_dhcpsv6_refresh_config() BOOL bBadPrefixFormat = FALSE; if (!fp) goto EXIT; -#if defined(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 + { /* handle logic: * 1) divide the Operator-delegated prefix to sub-prefixes * 2) further break the first of these sub-prefixes into /64 interface-prefixes for lan interface @@ -1505,6 +1515,7 @@ void __cosa_dhcpsv6_refresh_config() ifl_set_event("service_ipv6-status", "error"); return; } + } #endif /*Begin write configuration */ fprintf(fp, "log-level 8\n"); @@ -1670,9 +1681,13 @@ void __cosa_dhcpsv6_refresh_config() fprintf(fp, " valid-lifetime %lu\n", validTime); } fprintf(fp, " }\n"); - } - AnscFreeMemory(pTmp3); -#ifdef CISCO_CONFIG_DHCPV6_PREFIX_DELEGATION + } + AnscFreeMemory(pTmp3); +#if defined(CISCO_CONFIG_DHCPV6_PREFIX_DELEGATION) || defined(_ONESTACK_PRODUCT_REQ_) +#if defined(_ONESTACK_PRODUCT_REQ_) + if (isFeatureSupportedInCurrentMode(FEATURE_IPV6_DELEGATION)) +#endif + { DHCPMGR_LOG_INFO("[%s] %d - See if need to emit pd-class, sDhcpv6ServerPool[Index].Cfg.IAPDEnable: %d, Index: %d\n", __FUNCTION__, __LINE__, sDhcpv6ServerPool[Index].Cfg.IAPDEnable, Index); if (sDhcpv6ServerPool[Index].Cfg.IAPDEnable) { @@ -1683,7 +1698,7 @@ void __cosa_dhcpsv6_refresh_config() DHCPMGR_LOG_INFO("[%s] %d emit pd-length pd_pool.pd_length: %d\n", __FUNCTION__, __LINE__, pd_pool.pd_length); fprintf(fp, " pd-class {\n"); -#if defined (_CBR_PRODUCT_REQ_) || defined (CISCO_CONFIG_DHCPV6_PREFIX_DELEGATION) +#if defined (_CBR_PRODUCT_REQ_) || defined (CISCO_CONFIG_DHCPV6_PREFIX_DELEGATION) || defined(_ONESTACK_PRODUCT_REQ_) fprintf(fp, " pd-pool %s /%d\n", pd_pool.start, pd_pool.prefix_length); #else fprintf(fp, " pd-pool %s - %s /%d\n", pd_pool.start, pd_pool.end, pd_pool.prefix_length); @@ -1694,12 +1709,13 @@ void __cosa_dhcpsv6_refresh_config() fprintf(fp, " T2 %s\n", ia_pd.t2); fprintf(fp, " prefered-lifetime %s\n", ia_pd.pretm); fprintf(fp, " valid-lifetime %s\n", ia_pd.vldtm); - } - fprintf(fp, " }\n"); - } - } + } + fprintf(fp, " }\n"); + } + } + } #endif - } + } OPTIONS: /* For options */ for ( Index2 = 0 ; Index2 < uDhcpv6ServerPoolOptionNum[Index]; Index2++ ) diff --git a/source/DHCPServerUtils/DHCPv6Server/service_ipv6.c b/source/DHCPServerUtils/DHCPv6Server/service_ipv6.c index f744ac62..2a7b3957 100644 --- a/source/DHCPServerUtils/DHCPv6Server/service_ipv6.c +++ b/source/DHCPServerUtils/DHCPv6Server/service_ipv6.c @@ -56,7 +56,9 @@ #include #include "ccsp_memory.h" #endif - +#ifdef _ONESTACK_PRODUCT_REQ_ +#include +#endif #define PROG_NAME "SERVICE-IPV6" #if defined(INTEL_PUMA7) || defined(MULTILAN_FEATURE) @@ -380,10 +382,21 @@ static int get_dhcpv6s_pool_cfg(dhcpv6s_pool_cfg_t *cfg) 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 +#if defined(CISCO_CONFIG_DHCPV6_PREFIX_DELEGATION) || defined(_ONESTACK_PRODUCT_REQ_) + #if defined(_ONESTACK_PRODUCT_REQ_) + if (isFeatureSupportedInCurrentMode(FEATURE_IPV6_DELEGATION)) + #endif + { DHCPV6S_SYSCFG_GETS(DHCPV6S_NAME, "pool", cfg->index, "", 0, "IAInterface", iface_name); -#else + } +#endif +#if !defined(CISCO_CONFIG_DHCPV6_PREFIX_DELEGATION) || defined(_ONESTACK_PRODUCT_REQ_) + #if defined(_ONESTACK_PRODUCT_REQ_) + if (!isFeatureSupportedInCurrentMode(FEATURE_IPV6_DELEGATION)) + #endif + { DHCPV6S_SYSCFG_GETS(DHCPV6S_NAME, "pool", cfg->index, "", 0, "Interface", iface_name); + } #endif #else DHCPV6S_SYSCFG_GETS(DHCPV6S_NAME, "pool", cfg->index, "", 0, "IAInterface", cfg->interface); @@ -594,7 +607,7 @@ static int get_prefix_info(const char *prefix, char *value, unsigned int val_le static int get_active_lanif(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; @@ -616,7 +629,11 @@ static int get_active_lanif(unsigned int insts[], unsigned int *num) 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; @@ -636,6 +653,13 @@ static int get_active_lanif(unsigned int insts[], unsigned int *num) p = strtok(NULL, " "); } + } +#endif +#if !defined(CISCO_CONFIG_DHCPV6_PREFIX_DELEGATION) || defined(_ONESTACK_PRODUCT_REQ_) + #if defined(_ONESTACK_PRODUCT_REQ_) + if (!isFeatureSupportedInCurrentMode(FEATURE_IPV6_DELEGATION)) + #endif + { #else /* Get active bridge count from PSM */ if (!bus_handle) { @@ -706,6 +730,7 @@ static int get_active_lanif(unsigned int insts[], unsigned int *num) } /* Set active IPv6 instances */ ifl_set_event( "ipv6_active_inst", active_if_list); + } #endif diff --git a/source/TR-181/board_sbapi/Makefile.am b/source/TR-181/board_sbapi/Makefile.am index 3ef64108..8e2d4d79 100644 --- a/source/TR-181/board_sbapi/Makefile.am +++ b/source/TR-181/board_sbapi/Makefile.am @@ -37,3 +37,6 @@ libCcspDhcpMgr_board_sbapi_la_CPPFLAGS = -I$(top_srcdir)/source/TR-181/include \ libCcspDhcpMgr_board_sbapi_la_SOURCES = cosa_dhcpv6_apis.c cosa_dhcpv4_apis.c ../middle_layer_src/cosa_apis_util.c cosa_dhcpv4_webconfig_apis.c lan_webconfig_param.c macbinding_webconfig_param.c cosa_x_cisco_com_devicecontrol_apis.c libCcspDhcpMgr_board_sbapi_la_LDFLAGS = -lccsp_common -lhal_moca -lulog -lsyscfg -lsysevent -ltime_conversion -llmapi -lwebconfig_framework -lmsgpackc -lcm_mgnt -lnanomsg +if ONESTACK_PRODUCT_REQ +libCcspDhcpMgr_board_sbapi_la_LDFLAGS += -ldevicemode -lonestack_syscfg -lonestack_log -lrdkb_feature_mode_gate +endif diff --git a/source/TR-181/board_sbapi/cosa_dhcpv6_apis.c b/source/TR-181/board_sbapi/cosa_dhcpv6_apis.c index b11b14e9..6c809149 100644 --- a/source/TR-181/board_sbapi/cosa_dhcpv6_apis.c +++ b/source/TR-181/board_sbapi/cosa_dhcpv6_apis.c @@ -83,6 +83,9 @@ #include "ifl.h" //#include +#ifdef _ONESTACK_PRODUCT_REQ_ +#include +#endif #define DHCPV6_BINARY "dibbler-client" extern void* g_pDslhDmlAgent; extern ANSC_HANDLE bus_handle; @@ -1046,7 +1049,7 @@ BOOL tagPermitted(int tag) #include "cosa_drg_common.h" #include "cosa_common_util.h" -#if defined(CISCO_CONFIG_DHCPV6_PREFIX_DELEGATION) && defined(_COSA_BCM_MIPS_) +#if (defined(CISCO_CONFIG_DHCPV6_PREFIX_DELEGATION) && defined(_COSA_BCM_MIPS_)) || defined(_ONESTACK_PRODUCT_REQ_) #include #endif @@ -1117,7 +1120,7 @@ enum { DHCPV6_SERVER_TYPE_STATELESS }; -#if defined(CISCO_CONFIG_DHCPV6_PREFIX_DELEGATION) && defined(_COSA_BCM_MIPS_) +#if (defined(CISCO_CONFIG_DHCPV6_PREFIX_DELEGATION) && defined(_COSA_BCM_MIPS_)) || defined(_ONESTACK_PRODUCT_REQ_) #define MAX_LAN_IF_NUM 3 /*erouter topology mode*/ @@ -1227,10 +1230,21 @@ void setpool_into_utopia( PUCHAR uniqueName, PUCHAR table1Name, ULONG table1Inde SETI_INTO_UTOPIA(uniqueName, table1Name, table1Index, "", 0, "instancenumber", pEntry->Cfg.InstanceNumber) SETS_INTO_UTOPIA(uniqueName, table1Name, table1Index, "", 0, "alias", pEntry->Cfg.Alias) SETI_INTO_UTOPIA(uniqueName, table1Name, table1Index, "", 0, "Order", pEntry->Cfg.Order) -#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 + { SETS_INTO_UTOPIA(uniqueName, table1Name, table1Index, "", 0, "IAInterface", pEntry->Cfg.Interface) -#else + } +#endif +#if !defined(CISCO_CONFIG_DHCPV6_PREFIX_DELEGATION) || defined(_ONESTACK_PRODUCT_REQ_) + #if defined(_ONESTACK_PRODUCT_REQ_) + if (!isFeatureSupportedInCurrentMode(FEATURE_IPV6_DELEGATION)) + #endif + { SETS_INTO_UTOPIA(uniqueName, table1Name, table1Index, "", 0, "Interface", pEntry->Cfg.Interface) + } #endif SETS_INTO_UTOPIA(uniqueName, table1Name, table1Index, "", 0, "VendorClassID", pEntry->Cfg.VendorClassID) SETS_INTO_UTOPIA(uniqueName, table1Name, table1Index, "", 0, "UserClassID", pEntry->Cfg.UserClassID) @@ -1251,10 +1265,21 @@ void setpool_into_utopia( PUCHAR uniqueName, PUCHAR table1Name, ULONG table1Inde SETI_INTO_UTOPIA(uniqueName, table1Name, table1Index, "", 0, "DUIDExclude", pEntry->Cfg.DUIDExclude) SETI_INTO_UTOPIA(uniqueName, table1Name, table1Index, "", 0, "bEnabled", pEntry->Cfg.bEnabled) SETI_INTO_UTOPIA(uniqueName, table1Name, table1Index, "", 0, "Status", pEntry->Info.Status) -#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 + { SETS_INTO_UTOPIA(uniqueName, table1Name, table1Index, "", 0, "IANAInterfacePrefixes", pEntry->Info.IANAPrefixes) -#else + } +#endif +#if !defined(CISCO_CONFIG_DHCPV6_PREFIX_DELEGATION) || defined(_ONESTACK_PRODUCT_REQ_) + #if defined(_ONESTACK_PRODUCT_REQ_) + if (!isFeatureSupportedInCurrentMode(FEATURE_IPV6_DELEGATION)) + #endif + { SETS_INTO_UTOPIA(uniqueName, table1Name, table1Index, "", 0, "IANAPrefixes", pEntry->Info.IANAPrefixes) + } #endif SETS_INTO_UTOPIA(uniqueName, table1Name, table1Index, "", 0, "IAPDPrefixes", pEntry->Info.IAPDPrefixes) SETI_INTO_UTOPIA(uniqueName, table1Name, table1Index, "", 0, "RapidEnable", pEntry->Cfg.RapidEnable) @@ -1280,10 +1305,21 @@ void unsetpool_from_utopia( PUCHAR uniqueName, PUCHAR table1Name, ULONG table1In UNSET_INTO_UTOPIA(uniqueName, table1Name, table1Index, "", 0, "instancenumber" ) UNSET_INTO_UTOPIA(uniqueName, table1Name, table1Index, "", 0, "alias") UNSET_INTO_UTOPIA(uniqueName, table1Name, table1Index, "", 0, "Order") -#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 + { UNSET_INTO_UTOPIA(uniqueName, table1Name, table1Index, "", 0, "IAInterface") -#else + } +#endif +#if !defined(CISCO_CONFIG_DHCPV6_PREFIX_DELEGATION) || defined(_ONESTACK_PRODUCT_REQ_) + #if defined(_ONESTACK_PRODUCT_REQ_) + if (!isFeatureSupportedInCurrentMode(FEATURE_IPV6_DELEGATION)) + #endif + { UNSET_INTO_UTOPIA(uniqueName, table1Name, table1Index, "", 0, "Interface") + } #endif UNSET_INTO_UTOPIA(uniqueName, table1Name, table1Index, "", 0, "VendorClassID") UNSET_INTO_UTOPIA(uniqueName, table1Name, table1Index, "", 0, "UserClassID") @@ -1304,10 +1340,21 @@ void unsetpool_from_utopia( PUCHAR uniqueName, PUCHAR table1Name, ULONG table1In UNSET_INTO_UTOPIA(uniqueName, table1Name, table1Index, "", 0, "DUIDExclude") UNSET_INTO_UTOPIA(uniqueName, table1Name, table1Index, "", 0, "bEnabled") UNSET_INTO_UTOPIA(uniqueName, table1Name, table1Index, "", 0, "Status") -#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 + { UNSET_INTO_UTOPIA(uniqueName, table1Name, table1Index, "", 0, "IANAInterfacePrefixes") -#else + } +#endif +#if !defined(CISCO_CONFIG_DHCPV6_PREFIX_DELEGATION) || defined(_ONESTACK_PRODUCT_REQ_) + #if defined(_ONESTACK_PRODUCT_REQ_) + if (!isFeatureSupportedInCurrentMode(FEATURE_IPV6_DELEGATION)) + #endif + { UNSET_INTO_UTOPIA(uniqueName, table1Name, table1Index, "", 0, "IANAPrefixes") + } #endif UNSET_INTO_UTOPIA(uniqueName, table1Name, table1Index, "", 0, "IAPDPrefixes") UNSET_INTO_UTOPIA(uniqueName, table1Name, table1Index, "", 0, "RapidEnable") @@ -1326,7 +1373,7 @@ void unsetpool_from_utopia( PUCHAR uniqueName, PUCHAR table1Name, ULONG table1In void getpool_from_utopia( PUCHAR uniqueName, PUCHAR table1Name, ULONG table1Index, PCOSA_DML_DHCPSV6_POOL_FULL pEntry ) { UtopiaContext utctx = {0}; - #if defined(CISCO_CONFIG_DHCPV6_PREFIX_DELEGATION) && defined(_BCI_FEATURE_REQ) + #if (defined(CISCO_CONFIG_DHCPV6_PREFIX_DELEGATION) && defined(_BCI_FEATURE_REQ)) char *INVALID_IANAInterfacePrefixes = "Device.IP.Interface.4.IPv6Prefix.1."; char *FIXED_IANAInterfacePrefixes = "Device.IP.Interface.1.IPv6Prefix.1."; #endif @@ -1337,10 +1384,21 @@ void getpool_from_utopia( PUCHAR uniqueName, PUCHAR table1Name, ULONG table1Inde GETI_FROM_UTOPIA(uniqueName, table1Name, table1Index, "", 0, "instancenumber", pEntry->Cfg.InstanceNumber) GETS_FROM_UTOPIA(uniqueName, table1Name, table1Index, "", 0, "alias", pEntry->Cfg.Alias) GETI_FROM_UTOPIA(uniqueName, table1Name, table1Index, "", 0, "Order", pEntry->Cfg.Order) -#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 + { GETS_FROM_UTOPIA(uniqueName, table1Name, table1Index, "", 0, "IAInterface", pEntry->Cfg.Interface) -#else + } +#endif +#if !defined(CISCO_CONFIG_DHCPV6_PREFIX_DELEGATION) || defined(_ONESTACK_PRODUCT_REQ_) + #if defined(_ONESTACK_PRODUCT_REQ_) + if (!isFeatureSupportedInCurrentMode(FEATURE_IPV6_DELEGATION)) + #endif + { GETS_FROM_UTOPIA(uniqueName, table1Name, table1Index, "", 0, "Interface", pEntry->Cfg.Interface) + } #endif GETS_FROM_UTOPIA(uniqueName, table1Name, table1Index, "", 0, "VendorClassID", pEntry->Cfg.VendorClassID) GETS_FROM_UTOPIA(uniqueName, table1Name, table1Index, "", 0, "UserClassID", pEntry->Cfg.UserClassID) @@ -1361,7 +1419,11 @@ void getpool_from_utopia( PUCHAR uniqueName, PUCHAR table1Name, ULONG table1Inde GETI_FROM_UTOPIA(uniqueName, table1Name, table1Index, "", 0, "DUIDExclude", pEntry->Cfg.DUIDExclude) GETI_FROM_UTOPIA(uniqueName, table1Name, table1Index, "", 0, "bEnabled", pEntry->Cfg.bEnabled) GETI_FROM_UTOPIA(uniqueName, table1Name, table1Index, "", 0, "Status", pEntry->Info.Status) -#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 + { GETS_FROM_UTOPIA(uniqueName, table1Name, table1Index, "", 0, "IANAInterfacePrefixes", pEntry->Info.IANAPrefixes) #if defined(_BCI_FEATURE_REQ) DHCPMGR_LOG_INFO("%s table1Name: %s, table1Index: %lu, get IANAInterfacePrefixes: %s\n", @@ -1376,8 +1438,15 @@ void getpool_from_utopia( PUCHAR uniqueName, PUCHAR table1Name, ULONG table1Inde DHCPMGR_LOG_INFO("%s Try again to get IANAInterfacePrefixes: %s\n", __func__, pEntry->Info.IANAPrefixes); } #endif -#else + } +#endif +#if !defined(CISCO_CONFIG_DHCPV6_PREFIX_DELEGATION) || defined(_ONESTACK_PRODUCT_REQ_) + #if defined(_ONESTACK_PRODUCT_REQ_) + if (!isFeatureSupportedInCurrentMode(FEATURE_IPV6_DELEGATION)) + #endif + { GETS_FROM_UTOPIA(uniqueName, table1Name, table1Index, "", 0, "IANAPrefixes", pEntry->Info.IANAPrefixes) + } #endif GETS_FROM_UTOPIA(uniqueName, table1Name, table1Index, "", 0, "IAPDPrefixes", pEntry->Info.IAPDPrefixes) GETI_FROM_UTOPIA(uniqueName, table1Name, table1Index, "", 0, "RapidEnable", pEntry->Cfg.RapidEnable) @@ -1479,7 +1548,7 @@ extern int CosaDmlDHCPv6sTriggerRestart(BOOL OnlyTrigger); #define DHCPS6V_SERVER_RESTART_FIFO "/tmp/ccsp-dhcpv6-server-restart-fifo.txt" -#if defined(CISCO_CONFIG_DHCPV6_PREFIX_DELEGATION) && ! defined(_CBR_PRODUCT_REQ_) && ! defined(_BCI_FEATURE_REQ) +#if defined(CISCO_CONFIG_DHCPV6_PREFIX_DELEGATION) && ! defined(_CBR_PRODUCT_REQ_) && ! defined(_BCI_FEATURE_REQ) && !defined(_ONESTACK_PRODUCT_REQ_) #else ANSC_STATUS @@ -1489,6 +1558,13 @@ CosaDmlDhcpv6SMsgHandler ) { UNREFERENCED_PARAMETER(hContext); +#ifdef _ONESTACK_PRODUCT_REQ_ + if (isFeatureSupportedInCurrentMode(FEATURE_IPV6_DELEGATION)) + { + /* Prefix Delegation mode — this function should behave as "not present" */ + return ANSC_STATUS_SUCCESS; + } +#endif char ret[16] = {0}; /*We may restart by DM manager when pam crashed. We need to get current two status values */ @@ -1728,10 +1804,17 @@ CosaDmlDhcpv6Init SETI_INTO_UTOPIA(DHCPV6S_NAME, "", 0, "", 0, "serverenable", g_dhcpv6_server) Utopia_Free(&utctx,1); -#if defined(CISCO_CONFIG_DHCPV6_PREFIX_DELEGATION) && ! defined(_CBR_PRODUCT_REQ_) && ! defined(_BCI_FEATURE_REQ) +#if defined(CISCO_CONFIG_DHCPV6_PREFIX_DELEGATION) && ! defined(_CBR_PRODUCT_REQ_) && ! defined(_BCI_FEATURE_REQ) && !defined(_ONESTACK_PRODUCT_REQ_) #else - +#ifdef _ONESTACK_PRODUCT_REQ_ + if (isFeatureSupportedInCurrentMode(FEATURE_IPV6_DELEGATION)) + { + /* PD mode — skip callback registration */ + } + else +#endif + { /*register callback function to handle message from wan dchcp6 client */ /* CosaDmlDhcpv6SMsgHandler will be directly called from CosaDhcpv6Initialize pEntry = (PDSLHDMAGNT_CALLBACK)AnscAllocateMemory(sizeof(*pEntry)); @@ -1741,6 +1824,7 @@ CosaDmlDhcpv6Init /*register callback function to restart dibbler-server at right time*/ DHCPMGR_LOG_WARNING("%s -- %d register lan-status to event dispatcher \n", __FUNCTION__, __LINE__); EvtDispterRgstCallbackForEvent("lan-status", CosaDmlDhcpv6sRestartOnLanStarted, NULL); + } #endif return ANSC_STATUS_SUCCESS; @@ -2121,8 +2205,13 @@ static int _dibbler_client_operation(char * arg) DHCPMGR_LOG_INFO("%s stop\n", __func__); /*TCXB6 is also calling service_dhcpv6_client.sh but the actuall script is installed from meta-rdk-oem layer as the intel specific code had to be removed */ -#if defined (FEATURE_RDKB_DHCP_MANAGER) || defined(CISCO_CONFIG_DHCPV6_PREFIX_DELEGATION) && ! defined(DHCPV6_PREFIX_FIX) +#if defined (FEATURE_RDKB_DHCP_MANAGER) || defined(CISCO_CONFIG_DHCPV6_PREFIX_DELEGATION) && ! defined(DHCPV6_PREFIX_FIX) || defined (_ONESTACK_PRODUCT_REQ_) + #if defined(_ONESTACK_PRODUCT_REQ_) + if (isFeatureSupportedInCurrentMode(FEATURE_IPV6_DELEGATION)) + #endif + { commonSyseventSet("dhcpv6_client-stop", ""); + } #endif #if defined (_COSA_BCM_ARM_) && !defined (FEATURE_RDKB_DHCP_MANAGER) @@ -2156,8 +2245,16 @@ static int _dibbler_client_operation(char * arg) /*This is for ArrisXB6 */ /*TCXB6 is also calling service_dhcpv6_client.sh but the actuall script is installed from meta-rdk-oem layer as the intel specific code had to be removed */ -#if defined (FEATURE_RDKB_DHCP_MANAGER) || defined(CISCO_CONFIG_DHCPV6_PREFIX_DELEGATION) && ! defined(DHCPV6_PREFIX_FIX) +#if defined(FEATURE_RDKB_DHCP_MANAGER) || (defined(CISCO_CONFIG_DHCPV6_PREFIX_DELEGATION) && !defined(DHCPV6_PREFIX_FIX)) || \ + defined(_ONESTACK_PRODUCT_REQ_) + +#ifdef _ONESTACK_PRODUCT_REQ_ + if (isFeatureSupportedInCurrentMode(FEATURE_IPV6_DELEGATION)) +#endif + { commonSyseventSet("dhcpv6_client-start", ""); + } + #endif #if defined (_COSA_BCM_ARM_) && !defined (FEATURE_RDKB_DHCP_MANAGER) @@ -3015,10 +3112,17 @@ int remove_single_quote (char *buf) return 0; } -#if defined(CISCO_CONFIG_DHCPV6_PREFIX_DELEGATION) && defined(_COSA_BCM_MIPS_) +#if (defined(CISCO_CONFIG_DHCPV6_PREFIX_DELEGATION) && defined(_COSA_BCM_MIPS_)) + // adding new logics to handle pd-class static int get_ipv6_tpmode (int *tpmod) { +#ifdef _ONESTACK_PRODUCT_REQ_ + if (!isFeatureSupportedInCurrentMode(FEATURE_IPV6_DELEGATION)) + { + return 0; /* behave as non-PD build */ + } +#endif char buf[16] = { 0 }; char fixed_buf[16] = { 0 }; int mode; @@ -3176,17 +3280,27 @@ CosaDmlDhcpv6sEnable DHCPMGR_LOG_INFO("Disable DHCPv6. Stopping Dibbler-Server and Zebra Process\n "); #endif /* we need disable server. */ + int pd_enabled = 0; - #if defined(CISCO_CONFIG_DHCPV6_PREFIX_DELEGATION) && ! defined(DHCPV6_PREFIX_FIX) - commonSyseventSet("dhcpv6_server-stop", ""); - #else + #if defined(CISCO_CONFIG_DHCPV6_PREFIX_DELEGATION) && !defined(DHCPV6_PREFIX_FIX) + pd_enabled = 1; + #endif - #ifdef DHCPV6_SERVER_SUPPORT - _dibbler_server_operation("stop"); - //sysevent_set(sysevent_fd_server, sysevent_token_server, "dibbler_server_operation", "stop", 0); + #ifdef _ONESTACK_PRODUCT_REQ_ + pd_enabled = isFeatureSupportedInCurrentMode(FEATURE_IPV6_DELEGATION); #endif + if (pd_enabled) + { + commonSyseventSet("dhcpv6_server-stop", ""); + } + else + { + #ifdef DHCPV6_SERVER_SUPPORT + _dibbler_server_operation("stop"); + //sysevent_set(sysevent_fd_server, sysevent_token_server, "dibbler_server_operation", "stop", 0); #endif + } } return ANSC_STATUS_SUCCESS; @@ -3625,7 +3739,7 @@ CosaDmlDhcpv6sGetIAPDPrefixes return ret; } -#ifdef CISCO_CONFIG_DHCPV6_PREFIX_DELEGATION +#if defined(CISCO_CONFIG_DHCPV6_PREFIX_DELEGATION) || defined(_ONESTACK_PRODUCT_REQ_) /*this function gets IAPD prefixes from sysevent, the value is PD prefix range*/ int CosaDmlDhcpv6sGetIAPDPrefixes2 @@ -3635,6 +3749,12 @@ CosaDmlDhcpv6sGetIAPDPrefixes2 ULONG* pSize ) { +#ifdef _ONESTACK_PRODUCT_REQ_ + if (!isFeatureSupportedInCurrentMode(FEATURE_IPV6_DELEGATION)) + { + return 0; /* behave as non-PD build */ + } +#endif ULONG size = 0; int ret = 0; char pd_pool[128] = {0}; diff --git a/source/TR-181/include/cosa_dhcpv6_apis.h b/source/TR-181/include/cosa_dhcpv6_apis.h index c9af5aaa..14cbe0e6 100644 --- a/source/TR-181/include/cosa_dhcpv6_apis.h +++ b/source/TR-181/include/cosa_dhcpv6_apis.h @@ -111,7 +111,7 @@ extern int g_recv_option_num; #define COSA_DML_DHCPV6C_ADDR_PRETM_SYSEVENT_NAME "tr_"COSA_DML_DHCPV6_CLIENT_IFNAME"_dhcpv6_client_addr_pretm" #define COSA_DML_DHCPV6C_ADDR_VLDTM_SYSEVENT_NAME "tr_"COSA_DML_DHCPV6_CLIENT_IFNAME"_dhcpv6_client_addr_vldtm" -#if defined (CISCO_CONFIG_DHCPV6_PREFIX_DELEGATION) || defined (INTEL_PUMA7) +#if defined (CISCO_CONFIG_DHCPV6_PREFIX_DELEGATION) || defined (INTEL_PUMA7) || defined(_ONESTACK_PRODUCT_REQ_) #define COSA_DML_DHCPV6S_ADDR_SYSEVENT_NAME "ipv6_"COSA_DML_DHCPV6_SERVER_IFNAME"-addr" #else #define COSA_DML_DHCPV6S_ADDR_SYSEVENT_NAME "tr_"COSA_DML_DHCPV6_SERVER_IFNAME"_dhcpv6_server_v6addr" @@ -717,7 +717,7 @@ CosaDmlDhcpv6sGetIAPDPrefixes ULONG* pSize ); -#ifdef CISCO_CONFIG_DHCPV6_PREFIX_DELEGATION +#if defined(CISCO_CONFIG_DHCPV6_PREFIX_DELEGATION) || defined(_ONESTACK_PRODUCT_REQ_) int CosaDmlDhcpv6sGetIAPDPrefixes2 ( diff --git a/source/TR-181/middle_layer_src/Makefile.am b/source/TR-181/middle_layer_src/Makefile.am index 5133e01c..201c3499 100644 --- a/source/TR-181/middle_layer_src/Makefile.am +++ b/source/TR-181/middle_layer_src/Makefile.am @@ -38,3 +38,6 @@ libCcspDhcpMgr_middle_layer_src_la_CPPFLAGS = -I$(top_srcdir)/source/TR-181/incl libCcspDhcpMgr_middle_layer_src_la_SOURCES = cosa_dhcpv4_internal.c cosa_dhcpv6_internal.c plugin_main.c cosa_apis_util.c cosa_dhcpv4_dml.c cosa_dhcpv6_dml.c cosa_webconfig_api.c cosa_x_cisco_com_devicecontrol_internal.c dhcpmgr_rbus_apis.c libCcspDhcpMgr_middle_layer_src_la_LDFLAGS = -lccsp_common -lsyscfg -lsysevent -lsecure_wrapper +if ONESTACK_PRODUCT_REQ +libCcspDhcpMgr_middle_layer_src_la_LDFLAGS += -ldevicemode -lonestack_syscfg -lonestack_log -lrdkb_feature_mode_gate +endif diff --git a/source/TR-181/middle_layer_src/cosa_dhcpv6_dml.c b/source/TR-181/middle_layer_src/cosa_dhcpv6_dml.c index 4b8f172b..bfc75a3d 100755 --- a/source/TR-181/middle_layer_src/cosa_dhcpv6_dml.c +++ b/source/TR-181/middle_layer_src/cosa_dhcpv6_dml.c @@ -85,7 +85,9 @@ #define WEEKS 604800 #define MINSECS 120 #define MAXSECS 999 - +#ifdef _ONESTACK_PRODUCT_REQ_ +#include +#endif extern void* g_pDslhDmlAgent; extern ANSC_HANDLE g_Dhcpv6Object; @@ -4616,6 +4618,7 @@ Pool1_GetParamStringValue PCOSA_DML_DHCPSV6_POOL_FULL pPool = (PCOSA_DML_DHCPSV6_POOL_FULL)pCxtLink->hContext; PUCHAR pString = NULL; errno_t rc = -1; + int prefixdelegation_enabled = 0; /* check the parameter name and return the corresponding value */ if (strcmp(ParamName, "Alias") == 0) @@ -4627,46 +4630,60 @@ Pool1_GetParamStringValue if (strcmp(ParamName, "Interface") == 0) { /* collect value */ - #ifdef CISCO_CONFIG_DHCPV6_PREFIX_DELEGATION - pString = CosaUtilGetFullPathNameByKeyword - ( - (PUCHAR)"Device.IP.Interface.", - (PUCHAR)"Name", - (PUCHAR)pPool->Cfg.Interface // When brlan0 works ,change to "brlan0" - ); - #elif defined (MULTILAN_FEATURE) - pString = (PUCHAR)pPool->Cfg.Interface; - #else - pString = CosaUtilGetFullPathNameByKeyword - ( - (PUCHAR)"Device.IP.Interface.", - (PUCHAR)"Name", - (PUCHAR)"brlan0" // When brlan0 works ,change to "brlan0" - ); - #endif + +#if defined(CISCO_CONFIG_DHCPV6_PREFIX_DELEGATION) + prefixdelegation_enabled = 1; +#endif + +#ifdef _ONESTACK_PRODUCT_REQ_ + prefixdelegation_enabled = isFeatureSupportedInCurrentMode(FEATURE_IPV6_DELEGATION); +#endif + if (prefixdelegation_enabled) + { + pString = CosaUtilGetFullPathNameByKeyword( + (PUCHAR)"Device.IP.Interface.", + (PUCHAR)"Name", + (PUCHAR)pPool->Cfg.Interface); // When brlan0 works ,change to "brlan0" + } +#if defined(MULTILAN_FEATURE) + else + { + pString = (PUCHAR)pPool->Cfg.Interface; + } +#else + else + { + pString = CosaUtilGetFullPathNameByKeyword( + (PUCHAR)"Device.IP.Interface.", + (PUCHAR)"Name", + (PUCHAR)"brlan0"); // When brlan0 works ,change to "brlan0" + } +#endif if ( pString ) { if ( AnscSizeOfString((const char*)pString) < *pUlSize) { rc = strcpy_s(pValue, *pUlSize, (char*) pString); - ERR_CHK(rc); + ERR_CHK(rc); #if defined (MULTILAN_FEATURE) -#ifdef CISCO_CONFIG_DHCPV6_PREFIX_DELEGATION - AnscFreeMemory(pString); -#endif + if (prefixdelegation_enabled) + { + AnscFreeMemory(pString); + } #else - AnscFreeMemory(pString); + AnscFreeMemory(pString); #endif - return 0; + return 0; } else { *pUlSize = AnscSizeOfString((const char*)pString)+1; #if defined (MULTILAN_FEATURE) -#ifdef CISCO_CONFIG_DHCPV6_PREFIX_DELEGATION - AnscFreeMemory(pString); -#endif + if (prefixdelegation_enabled) + { + AnscFreeMemory(pString); + } #else AnscFreeMemory(pString); #endif @@ -4730,11 +4747,12 @@ Pool1_GetParamStringValue if (strcmp(ParamName, "IAPDPrefixes") == 0) { /* collect value */ -#ifdef CISCO_CONFIG_DHCPV6_PREFIX_DELEGATION - return CosaDmlDhcpv6sGetIAPDPrefixes2(&pPool->Cfg, pValue, pUlSize); -#else - + if (prefixdelegation_enabled) + { +#if defined(CISCO_CONFIG_DHCPV6_PREFIX_DELEGATION) || defined(_ONESTACK_PRODUCT_REQ_) + return CosaDmlDhcpv6sGetIAPDPrefixes2(&pPool->Cfg, pValue, pUlSize); #endif + } return update_pValue(pValue,pUlSize, (char*)pPool->Info.IAPDPrefixes); }