From 331c8cd000be6534fc79736998032336bbb6b651 Mon Sep 17 00:00:00 2001 From: Kulvendra singh <54099945+kul2241@users.noreply.github.com> Date: Wed, 7 Aug 2024 17:31:31 +0100 Subject: [PATCH] RDKB-56227:DNS Connectivity Check RFC Support (#42) Reason for change: Control DNS connectivity check feature by RFC. RFC DML should be persistent on reboot and factory reset. Test Procedure: 1.)Test the RFC DML Device.X_RDK_WanManager.DnsConnectivityCheck.Enable Risks: Medium Priority: P2 Signed-off-by: kulvendra singh Co-authored-by: Augusto S. Mainardi <115101745+guto86@users.noreply.github.com> --- config/RdkWanManager.xml | 21 ++++- config/RdkWanManager_v2.xml | 18 +++- .../include/dmsb_tr181_psm_definitions.h | 3 +- source/TR-181/include/wanmgr_dml.h | 3 +- .../TR-181/middle_layer_src/wanmgr_dml_apis.c | 89 +++++++++++++++++++ .../TR-181/middle_layer_src/wanmgr_dml_apis.h | 2 + .../middle_layer_src/wanmgr_dml_iface_apis.c | 20 ++++- .../wanmgr_dml_iface_v2_apis.c | 20 ++++- .../middle_layer_src/wanmgr_plugin_main.c | 3 + .../middle_layer_src/wanmgr_rdkbus_apis.c | 52 +++++------ .../middle_layer_src/wanmgr_rdkbus_apis.h | 1 + .../middle_layer_src/wanmgr_rdkbus_utils.c | 87 ++++++++++++++++++ .../middle_layer_src/wanmgr_rdkbus_utils.h | 3 + source/WanManager/wanmgr_data.c | 9 +- 14 files changed, 283 insertions(+), 48 deletions(-) diff --git a/config/RdkWanManager.xml b/config/RdkWanManager.xml index 96548bae..2a068709 100644 --- a/config/RdkWanManager.xml +++ b/config/RdkWanManager.xml @@ -90,8 +90,24 @@ string true - - + + + + DnsConnectivityCheck + object + + WanMgr_DnsConnectivityCheck_GetParamBoolValue + WanMgr_DnsConnectivityCheck_SetParamBoolValue + + + + Enable + boolean + bool + true + + + CPEInterface dynamicTable @@ -177,7 +193,6 @@ - Wan object diff --git a/config/RdkWanManager_v2.xml b/config/RdkWanManager_v2.xml index 1b308bf6..6702fa1b 100644 --- a/config/RdkWanManager_v2.xml +++ b/config/RdkWanManager_v2.xml @@ -79,8 +79,24 @@ string true - + + + DnsConnectivityCheck + object + + WanMgr_DnsConnectivityCheck_GetParamBoolValue + WanMgr_DnsConnectivityCheck_SetParamBoolValue + + + + Enable + boolean + bool + true + + + Group dynamicTable diff --git a/source/TR-181/include/dmsb_tr181_psm_definitions.h b/source/TR-181/include/dmsb_tr181_psm_definitions.h index 86659fc2..0b04c287 100644 --- a/source/TR-181/include/dmsb_tr181_psm_definitions.h +++ b/source/TR-181/include/dmsb_tr181_psm_definitions.h @@ -53,6 +53,7 @@ #define PSM_WANMANAGER_IF_VIRIF_IP_V6SOURCE "dmsb.wanmanager.if.%d.VirtualInterface.%d.IP.IPv6Source" #define PSM_WANMANAGER_IF_VIRIF_IP_PREFERREDMODE "dmsb.wanmanager.if.%d.VirtualInterface.%d.IP.PreferredMode" #define PSM_WANMANAGER_IF_VIRIF_IP_MODE_FORCE_ENABLE "dmsb.wanmanager.if.%d.VirtualInterface.%d.IP.ModeForceEnable" +#define PSM_WANMANAGER_CONNECTIVITY_CHECK_TYPE "dmsb.wanmanager.if.%d.VirtualInterface.%d.IP.ConnectivityCheckType" #if defined(WAN_MANAGER_UNIFICATION_ENABLED) #define PSM_WANMANAGER_IF_SELECTION_ENABLE "dmsb.wanmanager.if.%d.Selection.Enable" @@ -64,7 +65,6 @@ #define PSM_WANMANAGER_IF_VIRIF_ENABLE_MAPT "dmsb.wanmanager.if.%d.VirtualInterface.%d.EnableMAPT" #define PSM_WANMANAGER_IF_VIRIF_ENABLE_DSLITE "dmsb.wanmanager.if.%d.VirtualInterface.%d.EnableDSLite" -#define PSM_WANMANAGER_IF_VIRIF_ENABLE_IPOE "dmsb.wanmanager.if.%d.VirtualInterface.%d.EnableIPoE" #define PSM_WANMANAGER_GROUP_POLICY "dmsb.wanmanager.group.%d.policy" #define PSM_WANMANAGER_WANIFCOUNT "dmsb.wanmanager.wan.interfacecount" @@ -83,7 +83,6 @@ #define PSM_WANMANAGER_IF_VIRIF_ENABLE_MAPT "dmsb.wanmanager.if.%d.EnableMAPT" #define PSM_WANMANAGER_IF_VIRIF_ENABLE_DSLITE "dmsb.wanmanager.if.%d.EnableDSLite" -#define PSM_WANMANAGER_IF_VIRIF_ENABLE_IPOE "dmsb.wanmanager.if.%d.EnableIPoE" #define PSM_WANMANAGER_IF_VIRIF_PPP_ENABLE "dmsb.wanmanager.if.%d.PPPEnable" #define PSM_WANMANAGER_IF_WAN_PPP_LINKTYPE "dmsb.wanmanager.if.%d.PPPLinkType" #define PSM_WANMANAGER_IF_WAN_PPP_IPCP_ENABLE "dmsb.wanmanager.if.%d.PPPIPCPEnable" diff --git a/source/TR-181/include/wanmgr_dml.h b/source/TR-181/include/wanmgr_dml.h index 14144271..af3d3fae 100644 --- a/source/TR-181/include/wanmgr_dml.h +++ b/source/TR-181/include/wanmgr_dml.h @@ -267,7 +267,7 @@ typedef enum { } CONNECTIVITY_STATUS; typedef enum { - WAN_CONNECTIVITY_TYPE_NO_CHECK = 1, + WAN_CONNECTIVITY_TYPE_NO_CHECK, WAN_CONNECTIVITY_TYPE_IHC, WAN_CONNECTIVITY_TYPE_TAD, } CONNECTIVITY_CHECK_TYPE; @@ -514,7 +514,6 @@ typedef struct _DML_VIRTUAL_IFACE BOOL Enable; BOOL EnableMAPT; BOOL EnableDSLite; - BOOL EnableIPoE; DML_WAN_IFACE_STATUS Status; DML_WAN_IFACE_STATUS RemoteStatus; DML_VIRTUALIF_VLAN VLAN; diff --git a/source/TR-181/middle_layer_src/wanmgr_dml_apis.c b/source/TR-181/middle_layer_src/wanmgr_dml_apis.c index b63cb9c8..c32723fb 100644 --- a/source/TR-181/middle_layer_src/wanmgr_dml_apis.c +++ b/source/TR-181/middle_layer_src/wanmgr_dml_apis.c @@ -470,3 +470,92 @@ ULONG WanManagerGroup_Commit(ANSC_HANDLE hInsContext) return ret; } #endif /* WAN_MANAGER_UNIFICATION_ENABLED */ + + +/*********************************************************************** + + APIs for Object: + + X_RDK_WanManager.DnsConnectivityCheck. + + * WanMgr_DnsConnectivityCheck_GetParamBoolValue + * WanMgr_DnsConnectivityCheck_SetParamBoolValue + +***********************************************************************/ + +/********************************************************************** + + caller: owner of this object + + prototype: + + BOOL WanMgr_DnsConnectivityCheck_GetParamBoolValue(ANSC_HANDLE hInsContext, char* ParamName, BOOL* pBool); + + description: + + This function is called to retrieve Boolean parameter value; + + argument: ANSC_HANDLE hInsContext, + The instance handle; + + char* ParamName, + The parameter name; + + BOOL* pBool + The buffer of returned boolean value; + + return: TRUE if succeeded. + +**********************************************************************/ +BOOL +WanMgr_DnsConnectivityCheck_GetParamBoolValue(ANSC_HANDLE hInsContext, char* ParamName, BOOL* pBool) +{ + BOOL ret = FALSE; + + if (strcmp(ParamName, "Enable") == 0) + { + *pBool= WanMgr_GetDnsConnectivityCheck(); + ret = TRUE; + } + return ret; +} + +/********************************************************************** + + caller: owner of this object + + prototype: + + BOOL WanMgr_DnsConnectivityCheck_GetParamBoolValue(ANSC_HANDLE hInsContext, char* ParamName, BOOL bValue); + + description: + + This function is called to set BOOL parameter value; + + argument: ANSC_HANDLE hInsContext, + The instance handle; + + char* ParamName, + The parameter name; + + BOOL bValue + The updated BOOL value; + + return: TRUE if succeeded. + +**********************************************************************/ + +BOOL WanMgr_DnsConnectivityCheck_SetParamBoolValue(ANSC_HANDLE hInsContext, char* ParamName, BOOL bValue) +{ + BOOL ret = FALSE; + + if (strcmp(ParamName, "Enable") == 0) + { + if ( WanMgr_SetDnsConnectivityCheck(bValue) == ANSC_STATUS_SUCCESS) + { + ret = TRUE; + } + } + return ret; +} + diff --git a/source/TR-181/middle_layer_src/wanmgr_dml_apis.h b/source/TR-181/middle_layer_src/wanmgr_dml_apis.h index 5b7bbd79..7f65b5f7 100644 --- a/source/TR-181/middle_layer_src/wanmgr_dml_apis.h +++ b/source/TR-181/middle_layer_src/wanmgr_dml_apis.h @@ -58,6 +58,8 @@ BOOL WanManager_SetParamStringValue(ANSC_HANDLE hInsContext, char* ParamName, ch LONG WanManager_GetParamStringValue(ANSC_HANDLE hInsContext, char* ParamName, char* pValue, ULONG* pUlSize); BOOL WanManager_GetParamBoolValue(ANSC_HANDLE hInsContext, char* ParamName, BOOL* pBool); BOOL WanManager_SetParamBoolValue(ANSC_HANDLE hInsContext, char* ParamName, BOOL bValue); +BOOL WanMgr_DnsConnectivityCheck_GetParamBoolValue(ANSC_HANDLE hInsContext, char* ParamName, BOOL* pBool); +BOOL WanMgr_DnsConnectivityCheck_SetParamBoolValue(ANSC_HANDLE hInsContext, char* ParamName, BOOL bValue); #if defined(WAN_MANAGER_UNIFICATION_ENABLED) BOOL WanManagerGroup_IsUpdated(ANSC_HANDLE hInsContext); ULONG WanManagerGroup_Synchronize(ANSC_HANDLE hInsContext); diff --git a/source/TR-181/middle_layer_src/wanmgr_dml_iface_apis.c b/source/TR-181/middle_layer_src/wanmgr_dml_iface_apis.c index 40432b98..cc83c52b 100644 --- a/source/TR-181/middle_layer_src/wanmgr_dml_iface_apis.c +++ b/source/TR-181/middle_layer_src/wanmgr_dml_iface_apis.c @@ -964,7 +964,11 @@ BOOL WanIfCfg_GetParamBoolValue(ANSC_HANDLE hInsContext, char* ParamName, BOOL* } if (strcmp(ParamName, "EnableIPoEHealthCheck") == 0) { - *pBool = pWanDmlIface->VirtIfList->EnableIPoE; + *pBool = FALSE; + if (pWanDmlIface->VirtIfList->IP.ConnectivityCheckType == WAN_CONNECTIVITY_TYPE_IHC) + { + *pBool = TRUE; + } ret = TRUE; } if (strcmp(ParamName, "EnableMAPT") == 0) @@ -1046,8 +1050,18 @@ BOOL WanIfCfg_SetParamBoolValue(ANSC_HANDLE hInsContext, char* ParamName, BOOL b } if (strcmp(ParamName, "EnableIPoEHealthCheck") == 0) { - pWanDmlIface->VirtIfList->EnableIPoE = bValue; - ret = TRUE; + CONNECTIVITY_CHECK_TYPE type = bValue? WAN_CONNECTIVITY_TYPE_IHC:WAN_CONNECTIVITY_TYPE_NO_CHECK; + /*the below condition is, to avoid multiple time same value set and + * unsetting value of IPOE and DNS RFC DML from eachother */ + if((type != pWanDmlIface->VirtIfList->IP.ConnectivityCheckType) && + ((type != WAN_CONNECTIVITY_TYPE_NO_CHECK) || + (pWanDmlIface->VirtIfList->IP.ConnectivityCheckType == WAN_CONNECTIVITY_TYPE_IHC))) + { + WanMgr_SetConnectivityCheckTypeToPSM(pWanDmlIface->VirtIfList, type); + pWanDmlIface->VirtIfList->IP.WCC_TypeChanged = TRUE; + pWanDmlIface->VirtIfList->IP.ConnectivityCheckType = type; + ret = TRUE; + } } if (strcmp(ParamName, "EnableMAPT") == 0) { diff --git a/source/TR-181/middle_layer_src/wanmgr_dml_iface_v2_apis.c b/source/TR-181/middle_layer_src/wanmgr_dml_iface_v2_apis.c index 58976c3c..a9172795 100644 --- a/source/TR-181/middle_layer_src/wanmgr_dml_iface_v2_apis.c +++ b/source/TR-181/middle_layer_src/wanmgr_dml_iface_v2_apis.c @@ -1510,7 +1510,11 @@ BOOL WanVirtualIf_GetParamBoolValue(ANSC_HANDLE hInsContext, char* ParamName, BO } if (strcmp(ParamName, "EnableIPoEHealthCheck") == 0) { - *pBool = p_VirtIf->EnableIPoE; + *pBool = FALSE; + if (p_VirtIf->IP.ConnectivityCheckType == WAN_CONNECTIVITY_TYPE_IHC) + { + *pBool = TRUE; + } ret = TRUE; } if (strcmp(ParamName, "EnableMAPT") == 0) @@ -1586,8 +1590,18 @@ BOOL WanVirtualIf_SetParamBoolValue(ANSC_HANDLE hInsContext, char* ParamName, BO } if (strcmp(ParamName, "EnableIPoEHealthCheck") == 0) { - p_VirtIf->EnableIPoE = bValue; - ret = TRUE; + CONNECTIVITY_CHECK_TYPE type = bValue? WAN_CONNECTIVITY_TYPE_IHC:WAN_CONNECTIVITY_TYPE_NO_CHECK; + /*the below condition is, to avoid multiple time same value set and + * unsetting value of IPOE and DNS RFC DML from eachother */ + if((type != p_VirtIf->IP.ConnectivityCheckType) && + ((type != WAN_CONNECTIVITY_TYPE_NO_CHECK) || + (p_VirtIf->IP.ConnectivityCheckType == WAN_CONNECTIVITY_TYPE_IHC))) + { + WanMgr_SetConnectivityCheckTypeToPSM(p_VirtIf, type); + p_VirtIf->IP.WCC_TypeChanged = TRUE; + p_VirtIf->IP.ConnectivityCheckType = type; + ret = TRUE; + } } if (strcmp(ParamName, "EnableMAPT") == 0) { diff --git a/source/TR-181/middle_layer_src/wanmgr_plugin_main.c b/source/TR-181/middle_layer_src/wanmgr_plugin_main.c index d20cf0d2..9a0f1dcb 100644 --- a/source/TR-181/middle_layer_src/wanmgr_plugin_main.c +++ b/source/TR-181/middle_layer_src/wanmgr_plugin_main.c @@ -360,6 +360,9 @@ int ANSC_EXPORT_API WanManagerDmlInit(ULONG uMaxVersionSupported, void* hCosaPlu pPlugInfo->RegisterFunction(pPlugInfo->hContext, "WanManager_Validate", WanManager_Validate); pPlugInfo->RegisterFunction(pPlugInfo->hContext, "WanManager_Commit", WanManager_Commit); + pPlugInfo->RegisterFunction(pPlugInfo->hContext, "WanMgr_DnsConnectivityCheck_GetParamBoolValue", WanMgr_DnsConnectivityCheck_GetParamBoolValue); + pPlugInfo->RegisterFunction(pPlugInfo->hContext, "WanMgr_DnsConnectivityCheck_SetParamBoolValue", WanMgr_DnsConnectivityCheck_SetParamBoolValue); + #if defined(WAN_MANAGER_UNIFICATION_ENABLED) pPlugInfo->RegisterFunction(pPlugInfo->hContext, "WanManagerGroup_IsUpdated", WanManagerGroup_IsUpdated); pPlugInfo->RegisterFunction(pPlugInfo->hContext, "WanManagerGroup_Synchronize", WanManagerGroup_Synchronize); diff --git a/source/TR-181/middle_layer_src/wanmgr_rdkbus_apis.c b/source/TR-181/middle_layer_src/wanmgr_rdkbus_apis.c index e86d3782..1d32a8d5 100644 --- a/source/TR-181/middle_layer_src/wanmgr_rdkbus_apis.c +++ b/source/TR-181/middle_layer_src/wanmgr_rdkbus_apis.c @@ -221,8 +221,6 @@ int get_Virtual_Interface_FromPSM(ULONG instancenum, ULONG virtInsNum ,DML_VIRTU char param_name[512]; CcspTraceInfo(("%s %d Update Wan Virtual iface Conf from PSM \n", __FUNCTION__, __LINE__)); - pVirtIf->VirIfIdx = virtInsNum; - _ansc_memset(param_name, 0, sizeof(param_name)); _ansc_memset(param_value, 0, sizeof(param_value)); _ansc_sprintf(param_name, PSM_WANMANAGER_IF_VIRIF_ENABLE_MAPT, instancenum, (virtInsNum + 1)); @@ -252,19 +250,6 @@ int get_Virtual_Interface_FromPSM(ULONG instancenum, ULONG virtInsNum ,DML_VIRTU pVirtIf->EnableDSLite = TRUE; } - _ansc_memset(param_name, 0, sizeof(param_name)); - _ansc_memset(param_value, 0, sizeof(param_value)); - _ansc_sprintf(param_name, PSM_WANMANAGER_IF_VIRIF_ENABLE_IPOE, instancenum, (virtInsNum + 1)); - retPsmGet = WanMgr_RdkBus_GetParamValuesFromDB(param_name,param_value,sizeof(param_value)); - - if(strcmp(param_value, PSM_ENABLE_STRING_TRUE) == 0) - { - pVirtIf->EnableIPoE = TRUE; - CcspTraceInfo(("%s %d IP.ConnectivityCheckType set to WAN_CONNECTIVITY_TYPE_IHC \n", __FUNCTION__, __LINE__)); - /* Set ConnectivityCheckType to IPOE Health Check if it is enabled. */ - pVirtIf->IP.ConnectivityCheckType = WAN_CONNECTIVITY_TYPE_IHC; - } - _ansc_memset(param_name, 0, sizeof(param_name)); _ansc_memset(param_value, 0, sizeof(param_value)); _ansc_sprintf(param_name, PSM_WANMANAGER_IF_VIRIF_ENABLE, instancenum, (virtInsNum + 1)); @@ -380,6 +365,30 @@ int get_Virtual_Interface_FromPSM(ULONG instancenum, ULONG virtInsNum ,DML_VIRTU { pVirtIf->IP.ModeForceEnable = TRUE; } + + _ansc_memset(param_name, 0, sizeof(param_name)); + _ansc_memset(param_value, 0, sizeof(param_value)); + _ansc_sprintf(param_name, PSM_WANMANAGER_CONNECTIVITY_CHECK_TYPE, instancenum, (virtInsNum + 1)); + retPsmGet = WanMgr_RdkBus_GetParamValuesFromDB(param_name,param_value,sizeof(param_value)); + if(retPsmGet == CCSP_SUCCESS) + { + _ansc_sscanf(param_value, "%d", &(pVirtIf->IP.ConnectivityCheckType)); + } +} + +int get_Remote_Virtual_Interface_FromPSM(ULONG instancenum, ULONG virtInsNum ,DML_VIRTUAL_IFACE * pVirtIf) +{ + int retPsmGet = CCSP_SUCCESS; + char param_value[256] = {0}; + char param_name[512] = {0}; + CcspTraceInfo(("%s %d Update Remote Wan Virtual iface Conf from PSM \n", __FUNCTION__, __LINE__)); + + _ansc_sprintf(param_name, PSM_WANMANAGER_CONNECTIVITY_CHECK_TYPE, instancenum, (virtInsNum + 1)); + retPsmGet = WanMgr_RdkBus_GetParamValuesFromDB(param_name,param_value,sizeof(param_value)); + if(retPsmGet == CCSP_SUCCESS) + { + _ansc_sscanf(param_value, "%d", &(pVirtIf->IP.ConnectivityCheckType)); + } } void WanMgr_getRemoteWanIfName(char *IfaceName,int Size) @@ -480,19 +489,6 @@ int write_Virtual_Interface_ToPSM(ULONG instancenum, ULONG virtInsNum ,DML_VIRTU CcspTraceInfo(("%s %d Entered\n", __FUNCTION__, __LINE__)); - memset(param_value, 0, sizeof(param_value)); - memset(param_name, 0, sizeof(param_name)); - if(pVirtIf->EnableIPoE == TRUE) - { - _ansc_sprintf(param_value, "TRUE"); - } - else - { - _ansc_sprintf(param_value, "FALSE"); - } - _ansc_sprintf(param_name, PSM_WANMANAGER_IF_VIRIF_ENABLE_IPOE, instancenum, (virtInsNum + 1)); - WanMgr_RdkBus_SetParamValuesToDB(param_name,param_value); - memset(param_value, 0, sizeof(param_value)); memset(param_name, 0, sizeof(param_name)); if(pVirtIf->EnableDSLite == TRUE) diff --git a/source/TR-181/middle_layer_src/wanmgr_rdkbus_apis.h b/source/TR-181/middle_layer_src/wanmgr_rdkbus_apis.h index d3ae881d..9924f82a 100644 --- a/source/TR-181/middle_layer_src/wanmgr_rdkbus_apis.h +++ b/source/TR-181/middle_layer_src/wanmgr_rdkbus_apis.h @@ -88,4 +88,5 @@ ANSC_STATUS WanMgr_RdkBus_setWanPolicy(DML_WAN_POLICY wan_policy, UINT groupId); ANSC_STATUS WanMgr_Read_GroupConf_FromPSM(WANMGR_IFACE_GROUP *pGroup, UINT groupId); ANSC_STATUS DmlSetVLANInUseToPSMDB(DML_VIRTUAL_IFACE * pVirtIf); ANSC_STATUS DmlGetTotalNoOfWanInterfaces(int *wan_if_count); +int get_Remote_Virtual_Interface_FromPSM(ULONG instancenum, ULONG virtInsNum ,DML_VIRTUAL_IFACE * pVirtIf); #endif /* _WANMGR_RDKBUS_APIS_H_ */ diff --git a/source/TR-181/middle_layer_src/wanmgr_rdkbus_utils.c b/source/TR-181/middle_layer_src/wanmgr_rdkbus_utils.c index 35a6b4cc..6f714802 100644 --- a/source/TR-181/middle_layer_src/wanmgr_rdkbus_utils.c +++ b/source/TR-181/middle_layer_src/wanmgr_rdkbus_utils.c @@ -66,6 +66,93 @@ extern char g_Subsystem[32]; extern ANSC_HANDLE bus_handle; +ANSC_STATUS WanMgr_SetConnectivityCheckTypeToPSM(DML_VIRTUAL_IFACE* pVirtIf, CONNECTIVITY_CHECK_TYPE type) +{ + int result = ANSC_STATUS_SUCCESS; + int retPsmSet = CCSP_SUCCESS; + char param_name[BUFLEN_256] = {0}; + char param_value[BUFLEN_256] = {0}; + + snprintf(param_value, sizeof(param_value), "%d", type); + _ansc_sprintf(param_name, PSM_WANMANAGER_CONNECTIVITY_CHECK_TYPE, pVirtIf->baseIfIdx +1, pVirtIf->VirIfIdx+1); + + retPsmSet = WanMgr_RdkBus_SetParamValuesToDB(param_name, param_value); + if (retPsmSet != CCSP_SUCCESS) { + AnscTraceError(("%s Error %d writing %s %s\n", __FUNCTION__, retPsmSet, param_name, param_value)); + result = ANSC_STATUS_FAILURE; + } + return result; +} + +BOOL WanMgr_GetDnsConnectivityCheck(void) +{ + BOOL ctl = false; + int uiLoopCount; + + int TotalIfaces = WanMgr_IfaceData_GetTotalWanIface(); + for (uiLoopCount = 0; uiLoopCount < TotalIfaces; uiLoopCount++) + { + WanMgr_Iface_Data_t* pWanDmlIfaceData = WanMgr_GetIfaceData_locked(uiLoopCount); + if(pWanDmlIfaceData != NULL) + { + DML_WAN_IFACE* pWanIfaceData = &(pWanDmlIfaceData->data); + if (pWanIfaceData->NoOfVirtIfs > 0) + { + int virIf_id = 0; /* default first virtual interface index */ + DML_VIRTUAL_IFACE* p_VirtIf = WanMgr_getVirtualIfaceById(pWanIfaceData->VirtIfList, virIf_id); + if(p_VirtIf != NULL) + { + ctl = (p_VirtIf->IP.ConnectivityCheckType == WAN_CONNECTIVITY_TYPE_TAD)? true:false; + WanMgrDml_GetIfaceData_release(pWanDmlIfaceData); + return ctl; + } + } + WanMgrDml_GetIfaceData_release(pWanDmlIfaceData); + } + } + return ctl; +} + +ANSC_STATUS WanMgr_SetDnsConnectivityCheck(BOOL Enable) +{ + ANSC_STATUS retStatus = ANSC_STATUS_FAILURE; + int uiLoopCount; + + int TotalIfaces = WanMgr_IfaceData_GetTotalWanIface(); + + CONNECTIVITY_CHECK_TYPE type = Enable? WAN_CONNECTIVITY_TYPE_TAD:WAN_CONNECTIVITY_TYPE_NO_CHECK; + + for (uiLoopCount = 0; uiLoopCount < TotalIfaces; uiLoopCount++) + { + WanMgr_Iface_Data_t* pWanDmlIfaceData = WanMgr_GetIfaceData_locked(uiLoopCount); + if(pWanDmlIfaceData != NULL) + { + DML_WAN_IFACE* pWanIfaceData = &(pWanDmlIfaceData->data); + for(int virIf_id=0; virIf_id< pWanIfaceData->NoOfVirtIfs; virIf_id++) + { + DML_VIRTUAL_IFACE* p_VirtIf = WanMgr_getVirtualIfaceById(pWanIfaceData->VirtIfList, virIf_id); + /*the below condition is, to avoid multiple time same value set and + * unsetting value of IPOE and DNS RFC DML from eachother */ + if((type != p_VirtIf->IP.ConnectivityCheckType) && + ((type != WAN_CONNECTIVITY_TYPE_NO_CHECK) || + (p_VirtIf->IP.ConnectivityCheckType == WAN_CONNECTIVITY_TYPE_TAD))) + { + if (WanMgr_SetConnectivityCheckTypeToPSM(p_VirtIf, type) == ANSC_STATUS_SUCCESS) + { + p_VirtIf->IP.ConnectivityCheckType = type; + p_VirtIf->IP.WCC_TypeChanged = TRUE; + retStatus = ANSC_STATUS_SUCCESS; + CcspTraceInfo(("%s-%d: RFC- DNS Connectivity Check %s, Type=%s", __FUNCTION__, __LINE__, + (Enable? "Enabled":"Disabled"), (Enable? "TAD":"None"))); + } + } + } + WanMgrDml_GetIfaceData_release(pWanDmlIfaceData); + } + } + return retStatus; +} + /*TODO: *Should be Reviewed while Implementing MAPT Unification. */ diff --git a/source/TR-181/middle_layer_src/wanmgr_rdkbus_utils.h b/source/TR-181/middle_layer_src/wanmgr_rdkbus_utils.h index 297549f3..81c503c2 100644 --- a/source/TR-181/middle_layer_src/wanmgr_rdkbus_utils.h +++ b/source/TR-181/middle_layer_src/wanmgr_rdkbus_utils.h @@ -208,4 +208,7 @@ int WanMgr_SetMAPTEnableToPSM(DML_VIRTUAL_IFACE* pVirtIf, BOOL Enable); **************************************************************************************/ ANSC_STATUS WanMgr_GetSelectedIPMode(DML_VIRTUAL_IFACE * pVirtIf); +ANSC_STATUS WanMgr_SetDnsConnectivityCheck(BOOL Enable); +BOOL WanMgr_GetDnsConnectivityCheck(void); +ANSC_STATUS WanMgr_SetConnectivityCheckTypeToPSM(DML_VIRTUAL_IFACE* pVirtIf, CONNECTIVITY_CHECK_TYPE type); #endif /* _WANMGR_RDKBUS_UTILS_H_ */ diff --git a/source/WanManager/wanmgr_data.c b/source/WanManager/wanmgr_data.c index 99cb30fd..3b0a2b01 100644 --- a/source/WanManager/wanmgr_data.c +++ b/source/WanManager/wanmgr_data.c @@ -759,7 +759,6 @@ void WanMgr_VirtIface_Init(DML_VIRTUAL_IFACE * pVirtIf, UINT iface_index) pVirtIf->OperationalStatus = WAN_OPERSTATUS_UNKNOWN; pVirtIf->EnableMAPT = FALSE; pVirtIf->EnableDSLite = FALSE; - pVirtIf->EnableIPoE = FALSE; pVirtIf->IP.RefreshDHCP = FALSE; // RefreshDHCP is set when there is a change in IP source pVirtIf->IP.RestartV6Client = FALSE; pVirtIf->Status = WAN_IFACE_STATUS_DISABLED; @@ -777,12 +776,7 @@ void WanMgr_VirtIface_Init(DML_VIRTUAL_IFACE * pVirtIf, UINT iface_index) pVirtIf->IP.Ipv6Status = WAN_IFACE_IPV6_STATE_DOWN; pVirtIf->IP.IPv4Source= DML_WAN_IP_SOURCE_DHCP; pVirtIf->IP.IPv6Source = DML_WAN_IP_SOURCE_DHCP; -#ifdef FEATURE_TAD_HEALTH_CHECK //FEATURE_IPOE_HEALTH_CHECK feature is enabled - CcspTraceInfo(("%s %d IP.ConnectivityCheckType set to WAN_CONNECTIVITY_TYPE_TAD \n", __FUNCTION__, __LINE__)); - pVirtIf->IP.ConnectivityCheckType = WAN_CONNECTIVITY_TYPE_TAD; -#else /* FEATURE_TAD_HEALTH_CHECK */ pVirtIf->IP.ConnectivityCheckType = WAN_CONNECTIVITY_TYPE_NO_CHECK; -#endif /* FEATURE_TAD_HEALTH_CHECK */ pVirtIf->IP.Ipv4ConnectivityStatus = WAN_CONNECTIVITY_DOWN; pVirtIf->IP.Ipv6ConnectivityStatus = WAN_CONNECTIVITY_DOWN; pVirtIf->IP.Mode = DML_WAN_IP_MODE_DUAL_STACK; @@ -911,6 +905,9 @@ ANSC_STATUS WanMgr_Remote_IfaceData_configure(char *remoteCPEMac, int *iface_in p_VirtIf->Enable = TRUE; p_VirtIf->IP.IPv6Source = DML_WAN_IP_SOURCE_STATIC; strncpy(p_VirtIf->Name, REMOTE_INTERFACE_NAME, sizeof(p_VirtIf->Name)); + //setting DNS Connectivity Check for Remote Interface from PSM Wan Interface 1. + get_Remote_Virtual_Interface_FromPSM(1, i, p_VirtIf); + CcspTraceInfo(("%s %d - Adding Remote Interface Index = [%d]\n", __FUNCTION__, __LINE__,p_VirtIf->baseIfIdx)); WanMgr_AddVirtualToList(&(pIfaceData->data.VirtIfList), p_VirtIf); }