diff --git a/CHANGELOG.md b/CHANGELOG.md index db51480c..e48c43da 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,15 +4,34 @@ All notable changes to this project will be documented in this file. Dates are d Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog). +#### [1.1.4](https://github.com/rdkcentral/rfc/compare/1.1.3...1.1.4) + +- RDKB-61478: Integrate CertSelector API into RFCMGR [`#88`](https://github.com/rdkcentral/rfc/pull/88) +- RDKB-61478: Use nvram for debug.ini configuration [`#86`](https://github.com/rdkcentral/rfc/pull/86) +- RDKB-61267: RFC reboot is not configured [`#85`](https://github.com/rdkcentral/rfc/pull/85) +- RDKB-61479: Successive RFC fetches are returning 200 response instead of 304 [`#84`](https://github.com/rdkcentral/rfc/pull/84) +- RDKB-61481 : CPE is contacting xconf twice during each RFC fetch [`#81`](https://github.com/rdkcentral/rfc/pull/81) +- RDKB-60919: Port Optimized RFCMGR source code to RDKB [`#80`](https://github.com/rdkcentral/rfc/pull/80) +- RDKB-61345: [AUTO-SKY][Sprint]Unable to override the RFC url for EU , Device send RFC request to comcast URL [`#77`](https://github.com/rdkcentral/rfc/pull/77) +- RDKB-61266 : AccountID is set to unknown after RFC fetch [`#75`](https://github.com/rdkcentral/rfc/pull/75) +- RDKB-61267: RFC reboot is not configured [`#74`](https://github.com/rdkcentral/rfc/pull/74) +- RDKB-61266 : AccountID is set to unknown after RFC fetch [`#70`](https://github.com/rdkcentral/rfc/pull/70) +- RDKB-60919: Port Optimized RFCMGR source code to RDKB [`#65`](https://github.com/rdkcentral/rfc/pull/65) +- Update xconf_handler.cpp [`1871fd2`](https://github.com/rdkcentral/rfc/commit/1871fd2d6cdc0d7a6ea3d105caddbcce388bea03) +- Update mtlsUtils.h [`7df92f3`](https://github.com/rdkcentral/rfc/commit/7df92f3845169a61e6c2f14a22e6c70462a41e9e) +- Update mtlsUtils.h [`ad078e0`](https://github.com/rdkcentral/rfc/commit/ad078e095e3922df3a7b58a7fedbf59f00ed2e5c) + #### [1.1.3](https://github.com/rdkcentral/rfc/compare/1.1.2...1.1.3) +> 20 August 2025 + - RDK-57302 : Add support for URL Encoding [`#66`](https://github.com/rdkcentral/rfc/pull/66) - RDKB-60919: Port Optimized RFCMGR source code to RDKB [`#64`](https://github.com/rdkcentral/rfc/pull/64) - RDKB-60919: Port Optimized RFCMGR source code to RDKB [`#62`](https://github.com/rdkcentral/rfc/pull/62) - RDK-57736 [ RFC ] : Increase L1 Test Coverage For RFC above 80% [`#45`](https://github.com/rdkcentral/rfc/pull/45) - RDKB-60919: Review and cleanup RFC scripts [`13a9c0d`](https://github.com/rdkcentral/rfc/commit/13a9c0d7e4030501e64d2f8d6c8347e1dac6b3aa) - Update rfc_xconf_handler.cpp [`43c3ccb`](https://github.com/rdkcentral/rfc/commit/43c3ccb8b058838bded67663de543d8c71191023) -- Update rfc_xconf_handler.cpp [`d6ca6b3`](https://github.com/rdkcentral/rfc/commit/d6ca6b328bb3aa38defa5db26dec0c07343bc634) +- 1.1.3 release changelog updates [`f25872e`](https://github.com/rdkcentral/rfc/commit/f25872e12d26126aba9b2061e9ebaf5da8565299) #### [1.1.2](https://github.com/rdkcentral/rfc/compare/1.1.1...1.1.2) diff --git a/configure.ac b/configure.ac index 2b84ff1a..89ac78b9 100644 --- a/configure.ac +++ b/configure.ac @@ -33,6 +33,8 @@ AC_PROG_CXX AC_PROG_CC GTEST_ENABLE_FLAG = "" +IS_LIBRDKCERTSEL_ENABLED="" +IS_LIBRDKCONFIG_ENABLED="" AC_ARG_ENABLE([gtestapp], AS_HELP_STRING([--enable-gtestapp],[enable Gtest support (default is no)]), @@ -72,6 +74,34 @@ AC_ARG_ENABLE([rfctool], [echo "rfctool app is disabled"]) AM_CONDITIONAL([ENABLE_RFCTOOL_APP], [test x$ENABLE_RFCTOOL_APP = xtrue]) +AC_ARG_ENABLE([rdkcertselector], + AS_HELP_STRING([--enable-rdkcertselector],[enables rdkcertselector replacement (default is no)]), + [ + case "${enableval}" in + yes) IS_LIBRDKCERTSEL_ENABLED=true + LIBRDKCERTSEL_FLAG=" -DLIBRDKCERTSELECTOR ";; + no) IS_LIBRDKCERTSEL_ENABLED=false ;; + *) AC_MSG_ERROR([bad value ${enableval} for --enable-rdkcertselector]) ;; + esac + ], + [echo "rdkcertselector is disabled"]) +AM_CONDITIONAL([IS_LIBRDKCERTSEL_ENABLED], [test x$IS_LIBRDKCERTSEL_ENABLED = xtrue]) +AC_SUBST(LIBRDKCERTSEL_FLAG) + +AC_ARG_ENABLE([mountutils], + AS_HELP_STRING([--enable-mountutils],[enables mountutils replacement (default is no)]), + [ + case "${enableval}" in + yes) IS_LIBRDKCONFIG_ENABLED=true + LIBRDKCONFIG_FLAG=" -DLIBRDKCONFIG_BUILD ";; + no) IS_LIBRDKCONFIG_ENABLED=false ;; + *) AC_MSG_ERROR([bad value ${enableval} for --enable-mountutils]) ;; + esac + ], + [echo "mountutils is disabled"]) +AM_CONDITIONAL([IS_LIBRDKCONFIG_ENABLED], [test x$IS_LIBRDKCONFIG_ENABLED = xtrue]) +AC_SUBST(LIBRDKCONFIG_FLAG) + AC_ARG_ENABLE([tr181set], AS_HELP_STRING([--enable-tr181set],[enable tr181 client app (default is no)]), [ diff --git a/rfcMgr/Makefile.am b/rfcMgr/Makefile.am index 5613c3db..ff6d3d14 100644 --- a/rfcMgr/Makefile.am +++ b/rfcMgr/Makefile.am @@ -34,3 +34,19 @@ if ENABLE_RDKB rfcMgr_CPPFLAGS += $(RDKB_FLAG) $(rbus_CFLAGS) AM_LDFLAGS += -lrbus endif + +if IS_LIBRDKCERTSEL_ENABLED +rfcMgr_CPPFLAGS += $(LIBRDKCERTSEL_FLAG) +rfcMgr_CFLAGS = $(LIBRDKCERTSEL_FLAG) +if IS_LIBRDKCONFIG_ENABLED +rfcMgr_CPPFLAGS += $(LIBRDKCONFIG_FLAG) +AM_LDFLAGS += -lRdkCertSelector -L$(PKG_CONFIG_SYSROOT_DIR)/usr/lib -L$(PKG_CONFIG_SYSROOT_DIR)/usr/lib64 -lrdkconfig +else +AM_LDFLAGS += -lRdkCertSelector +endif +else +if IS_LIBRDKCONFIG_ENABLED +rfcMgr_CPPFLAGS += $(LIBRDKCONFIG_FLAG) +AM_LDFLAGS += -L$(PKG_CONFIG_SYSROOT_DIR)/usr/lib -L$(PKG_CONFIG_SYSROOT_DIR)/usr/lib64 -lrdkconfig +endif +endif diff --git a/rfcMgr/mtlsUtils.cpp b/rfcMgr/mtlsUtils.cpp index 2dc5323b..9d30fc81 100644 --- a/rfcMgr/mtlsUtils.cpp +++ b/rfcMgr/mtlsUtils.cpp @@ -20,6 +20,9 @@ #include "mtlsUtils.h" #include "rfc_common.h" +#ifdef LIBRDKCONFIG_BUILD +#include "rdkconfig.h" +#endif #ifdef __cplusplus extern "C" { @@ -54,26 +57,49 @@ int isInStateRed(void) { } ret = filePresentCheck(STATEREDFLAG); if(ret == RDK_API_SUCCESS) { - RDK_LOG(RDK_LOG_DEBUG, LOG_RFCMGR, "isInStateRed(): Yes Flag prsent:%s. Device is in statered\n", STATEREDFLAG); + RDK_LOG(RDK_LOG_INFO, LOG_RFCMGR, "isInStateRed(): Yes Flag prsent:%s. Device is in statered\n", STATEREDFLAG); stateRed = 1; } else { - RDK_LOG(RDK_LOG_DEBUG, LOG_RFCMGR, "isInStateRed(): No Flag Not prsent:%s. Device is not in statered\n", STATEREDFLAG); + RDK_LOG(RDK_LOG_INFO, LOG_RFCMGR, "isInStateRed(): No Flag Not prsent:%s. Device is not in statered\n", STATEREDFLAG); } return stateRed; } -/* Description: Placeholder functions for implementing MTLS certs retrieval logic from compile time overrides +#ifdef LIBRDKCERTSELECTOR +/* Description: Use for get all mtls related certificate and key. + * @param sec: This is a pointer hold the certificate, key and type of certificate. + * @return : MTLS_CERT_FETCH_SUCCESS on success, MTLS_CERT_FETCH_FAILURE on mtls cert failure , STATE_RED_CERT_FETCH_FAILURE on state red cert failure + * */ +MtlsAuthStatus getMtlscert(MtlsAuth_t *sec, rdkcertselector_h* pthisCertSel) { + /* + strncpy(sec->cert_name, STATE_RED_CERT, sizeof(sec->cert_name) - 1); + sec->cert_name[sizeof(sec->cert_name) - 1] = '\0'; + strncpy(sec->cert_type, "P12", sizeof(sec->cert_type) - 1); + sec->cert_type[sizeof(sec->cert_type) - 1] = '\0'; + strncpy(sec->key_pas, mtlsbuff, sizeof(sec->key_pas) - 1); + sec->key_pas[sizeof(sec->key_pas) - 1] = '\0'; + * */ + return MTLS_CERT_FETCH_SUCCESS; +} +#else +/* Description: Use for get all mtls related certificate and key. * @param sec: This is a pointer hold the certificate, key and type of certificate. * @return : int Success 1 and failure -1 * */ -int getMtlscert(MtlsAuth_t *sec) -{ - if (NULL == sec) { - RDK_LOG(RDK_LOG_DEBUG, LOG_RFCMGR,"getMtlscert(): the sec buffer is empty or null."); - return MTLS_FAILURE; - } +int getMtlscert(MtlsAuth_t *sec) { + /* + strncpy(sec->cert_name, STATE_RED_CERT, sizeof(sec->cert_name) - 1); + sec->cert_name[sizeof(sec->cert_name) - 1] = '\0'; + strncpy(sec->cert_type, "P12", sizeof(sec->cert_type) - 1); + sec->cert_type[sizeof(sec->cert_type) - 1] = '\0'; + strncpy(sec->key_pas, mtlsbuff, sizeof(sec->key_pas) - 1); + sec->key_pas[sizeof(sec->key_pas) - 1] = '\0'; + */ + /* TODO: RDKE-419: temporary change until RDKE-419 gets proper solution. */ return MTLS_FAILURE; } +#endif + #ifdef __cplusplus } #endif diff --git a/rfcMgr/mtlsUtils.h b/rfcMgr/mtlsUtils.h index dedf323a..6409de45 100644 --- a/rfcMgr/mtlsUtils.h +++ b/rfcMgr/mtlsUtils.h @@ -24,16 +24,32 @@ #include #include #include +#include #ifdef __cplusplus extern "C" { #endif #include #include +#ifdef LIBRDKCERTSELECTOR +#include "rdkcertselector.h" +// Below macro is invoked if the getMtlscert API fails to retrieve all MTLS certificates. +#define CURL_MTLS_LOCAL_CERTPROBLEM 58 +typedef enum { + STATE_RED_CERT_FETCH_FAILURE = -2, // Indicates failure in state red recovery + MTLS_CERT_FETCH_FAILURE = -1, // Indicates general MTLS failure + MTLS_CERT_FETCH_SUCCESS = 0 // Indicates success +} MtlsAuthStatus; + +MtlsAuthStatus getMtlscert(MtlsAuth_t *sec, rdkcertselector_h* pthisCertSel); +#else #define MTLS_SUCCESS 1 #define MTLS_FAILURE -1 +int getMtlscert(MtlsAuth_t *sec); +#endif + #define CERT_DYNAMIC "/opt/certs/devicecert_1.pk12" #define CERT_STATIC "/etc/ssl/certs/staticXpkiCrt.pk12" @@ -55,7 +71,11 @@ extern "C" { int isStateRedSupported(void); int isInStateRed(void); #endif -int getMtlscert(MtlsAuth_t *sec); + +#if defined(RDKB_SUPPORT) +std::string getErouterMac(); +std::string geteCMMac(); +#endif #ifdef __cplusplus } diff --git a/rfcMgr/rfc_common.cpp b/rfcMgr/rfc_common.cpp index 4031618f..ae171058 100644 --- a/rfcMgr/rfc_common.cpp +++ b/rfcMgr/rfc_common.cpp @@ -70,23 +70,23 @@ void waitForRfcCompletion() int retry = 1; while (loop) { - RDK_LOG(RDK_LOG_DEBUG, LOG_RFCMGR, "[%s][%d] Waiting rfc_blob_processing \n", __FUNCTION__,__LINE__); + RDK_LOG(RDK_LOG_INFO, LOG_RFCMGR, "[%s][%d] Waiting rfc_blob_processing \n", __FUNCTION__,__LINE__); std::string rfcStatus = getSyseventValue("rfc_blob_processing"); if (rfcStatus == "Completed") { - RDK_LOG(RDK_LOG_DEBUG, LOG_RFCMGR, "[%s][%d] Webconfig rfc processing completed, breaking the loop \n", __FUNCTION__,__LINE__); + RDK_LOG(RDK_LOG_INFO, LOG_RFCMGR, "[%s][%d] Webconfig rfc processing completed, breaking the loop \n", __FUNCTION__,__LINE__); break; } else if (retry > 6) { - RDK_LOG(RDK_LOG_DEBUG, LOG_RFCMGR, "[%s][%d] webconfig rfc processing not completed after 10 min , breaking the loop \n", __FUNCTION__,__LINE__); + RDK_LOG(RDK_LOG_INFO, LOG_RFCMGR, "[%s][%d] webconfig rfc processing not completed after 10 min , breaking the loop \n", __FUNCTION__,__LINE__); break; } else { - RDK_LOG(RDK_LOG_DEBUG, LOG_RFCMGR, "[%s][%d] Webconfig rfc processing not completed.. Retry: %s \n", __FUNCTION__, __LINE__, std::to_string(retry).c_str()); + RDK_LOG(RDK_LOG_INFO, LOG_RFCMGR, "[%s][%d] Webconfig rfc processing not completed.. Retry: %s \n", __FUNCTION__, __LINE__, std::to_string(retry).c_str()); retry++; sleep(100); } } } else { - RDK_LOG(RDK_LOG_DEBUG, LOG_RFCMGR, "[%s][%d] rfc-agent process not running or rfc_blob_processing is empty. Not waiting rfc_blob_processing \n", __FUNCTION__,__LINE__); + RDK_LOG(RDK_LOG_INFO, LOG_RFCMGR, "[%s][%d] rfc-agent process not running or rfc_blob_processing is empty. Not waiting rfc_blob_processing \n", __FUNCTION__,__LINE__); } } @@ -102,7 +102,7 @@ int read_RFCProperty(const char* type, const char* key, char *out_value, int dat if(key == nullptr || out_value == nullptr || datasize == 0) { - RDK_LOG(RDK_LOG_DEBUG, LOG_RFCMGR, "[%s][%d] read_RFCProperty() one or more input values are invalid\n", __FUNCTION__, __LINE__); + RDK_LOG(RDK_LOG_DEBUG, LOG_RFCMGR, "[%s][%d] Received one or more input values are invalid\n", __FUNCTION__, __LINE__); return ret; } @@ -114,7 +114,7 @@ int read_RFCProperty(const char* type, const char* key, char *out_value, int dat const char* paramName = key; (void)type; - RDK_LOG(RDK_LOG_DEBUG, LOG_RFCMGR, "[%s][%d] Looking up parameter: %s\n", __FUNCTION__, __LINE__, paramName); + RDK_LOG(RDK_LOG_INFO, LOG_RFCMGR, "[%s][%d] Looking up parameter: %s\n", __FUNCTION__, __LINE__, paramName); rc = rbus_open(&handle, "RFC_Manager"); if (rc != RBUS_ERROR_SUCCESS) { @@ -140,7 +140,7 @@ int read_RFCProperty(const char* type, const char* key, char *out_value, int dat out_value[copyLen] = '\0'; } - RDK_LOG(RDK_LOG_DEBUG, LOG_RFCMGR, "[%s][%d] read_RFCProperty() param=%s, value=%s\n", __FUNCTION__, __LINE__, paramName, out_value); + RDK_LOG(RDK_LOG_INFO, LOG_RFCMGR, "[%s][%d] RFC param=%s, value=%s\n", __FUNCTION__, __LINE__, paramName, out_value); ret = READ_RFC_SUCCESS; } else { RDK_LOG(RDK_LOG_ERROR, LOG_RFCMGR, "[%s][%d] Null string value for param=%s\n", __FUNCTION__, __LINE__, paramName); @@ -150,13 +150,13 @@ int read_RFCProperty(const char* type, const char* key, char *out_value, int dat bool boolValue = rbusValue_GetBoolean(value); snprintf(out_value, datasize, "%s", boolValue ? "true" : "false"); - RDK_LOG(RDK_LOG_DEBUG, LOG_RFCMGR, "[%s][%d] read_RFCProperty() param=%s, value=%s (boolean)\n", __FUNCTION__, __LINE__, paramName, out_value); + RDK_LOG(RDK_LOG_INFO, LOG_RFCMGR, "[%s][%d] RFC param=%s, value=%s (boolean)\n", __FUNCTION__, __LINE__, paramName, out_value); ret = READ_RFC_SUCCESS; } else if (rbusValue_GetType(value) == RBUS_INT32) { int32_t intValue = rbusValue_GetInt32(value); snprintf(out_value, datasize, "%d", intValue); - RDK_LOG(RDK_LOG_DEBUG, LOG_RFCMGR, "[%s][%d] read_RFCProperty() param=%s, value=%s (int)\n", __FUNCTION__, __LINE__, paramName, out_value); + RDK_LOG(RDK_LOG_INFO, LOG_RFCMGR, "[%s][%d] RFC param=%s, value=%s (int)\n", __FUNCTION__, __LINE__, paramName, out_value); ret = READ_RFC_SUCCESS; } else { RDK_LOG(RDK_LOG_ERROR, LOG_RFCMGR, "[%s][%d] Unsupported value type for param=%s\n", __FUNCTION__, __LINE__, paramName); @@ -188,12 +188,12 @@ int read_RFCProperty(const char* type, const char* key, char *out_value, int dat { snprintf(out_value, datasize, "%s", param.value); } - RDK_LOG(RDK_LOG_DEBUG, LOG_RFCMGR, "[%s][%d] read_RFCProperty() name=%s,type=%d,value=%s,status=%d\n", __FUNCTION__, __LINE__, param.name, param.type, param.value, status); + RDK_LOG(RDK_LOG_INFO, LOG_RFCMGR, "[%s][%d] RFC name=%s,type=%d,value=%s,status=%d\n", __FUNCTION__, __LINE__, param.name, param.type, param.value, status); ret = READ_RFC_SUCCESS; } else { - RDK_LOG(RDK_LOG_DEBUG, LOG_RFCMGR, "[%s][%d] error:read_RFCProperty(): status= %d\n", __FUNCTION__, __LINE__, status); + RDK_LOG(RDK_LOG_ERROR, LOG_RFCMGR, "[%s][%d] RFC Read status= %d\n", __FUNCTION__, __LINE__, status); *out_value = 0; } #endif diff --git a/rfcMgr/rfc_main.cpp b/rfcMgr/rfc_main.cpp index d105cea9..57ce377d 100644 --- a/rfcMgr/rfc_main.cpp +++ b/rfcMgr/rfc_main.cpp @@ -111,9 +111,9 @@ int main() delete rfcMgr; return 1; } - RDK_LOG(RDK_LOG_DEBUG, LOG_RFCMGR, "[%s][%d] Waiting for IP Acquistion\n", __FUNCTION__, __LINE__); + RDK_LOG(RDK_LOG_INFO, LOG_RFCMGR, "[%s][%d] Waiting for IP Acquistion\n", __FUNCTION__, __LINE__); rfc::DeviceStatus isDeviceOnline = rfcMgr->CheckDeviceIsOnline(); - RDK_LOG(RDK_LOG_DEBUG, LOG_RFCMGR, "[%s][%d] Starting execution of RFCManager\n", __FUNCTION__, __LINE__); + RDK_LOG(RDK_LOG_INFO, LOG_RFCMGR, "[%s][%d] Starting execution of RFCManager\n", __FUNCTION__, __LINE__); if (isDeviceOnline == rfc::RFCMGR_DEVICE_ONLINE) { int status = FAILURE; @@ -124,7 +124,7 @@ int main() RDK_LOG(RDK_LOG_INFO, LOG_RFCMGR, "[%s][%d] RFC:Xconf Request Processed successfully\n", __FUNCTION__, __LINE__); } #if defined(RDKB_SUPPORT) - RDK_LOG(RDK_LOG_DEBUG, LOG_RFCMGR, "[%s][%d]START CONFIGURING RFC CRON \n", __FUNCTION__, __LINE__); + RDK_LOG(RDK_LOG_INFO, LOG_RFCMGR, "[%s][%d]START CONFIGURING RFC CRON \n", __FUNCTION__, __LINE__); std::string cronConfig = getCronFromDCMSettings(); diff --git a/rfcMgr/rfc_manager.cpp b/rfcMgr/rfc_manager.cpp index 0a23f19c..0430f639 100644 --- a/rfcMgr/rfc_manager.cpp +++ b/rfcMgr/rfc_manager.cpp @@ -40,7 +40,7 @@ namespace rfc { #endif RFCManager ::RFCManager() { /* Initialize RDK Logger */ - rdk_logger_init(0 == access("/opt/debug.ini", R_OK) ? "/opt/debug.ini" : "/etc/debug.ini"); + rdk_logger_init(0 == access(OVERIDE_DEBUG_INI_FILE, R_OK) ? OVERIDE_DEBUG_INI_FILE : DEBUG_INI_FILE); /* Initialize IARM Bus */ InitializeIARM(); @@ -203,7 +203,7 @@ namespace rfc { RDK_LOG(RDK_LOG_ERROR, LOG_RFCMGR, "[%s][%d] Incorrect File Name", __FUNCTION__,__LINE__); return ip_status; } - RDK_LOG(RDK_LOG_DEBUG, LOG_RFCMGR, "[%s][%d] CheckIPRoute Waiting for Route Config %s file\n", __FUNCTION__,__LINE__, IP_ROUTE_FLAG); + RDK_LOG(RDK_LOG_DEBUG, LOG_RFCMGR, "[%s][%d] Waiting for Route Config %s file\n", __FUNCTION__,__LINE__, IP_ROUTE_FLAG); while (IpRouteCnt--) { if (RDK_API_SUCCESS == (filePresentCheck(IP_ROUTE_FLAG))) { @@ -212,10 +212,10 @@ namespace rfc { sleep(15); } if (IpRouteCnt == 0 && (RDK_API_SUCCESS == (filePresentCheck(IP_ROUTE_FLAG)))) { - RDK_LOG(RDK_LOG_DEBUG, LOG_RFCMGR, "[%s][%d] route flag=%s not present\n", __FUNCTION__,__LINE__, IP_ROUTE_FLAG); + RDK_LOG(RDK_LOG_ERROR, LOG_RFCMGR, "[%s][%d] route flag=%s not present\n", __FUNCTION__,__LINE__, IP_ROUTE_FLAG); return ip_status; } - RDK_LOG(RDK_LOG_DEBUG, LOG_RFCMGR, "[%s][%d] CheckIPRoute Received Route Config file\n", __FUNCTION__,__LINE__); + RDK_LOG(RDK_LOG_INFO, LOG_RFCMGR, "[%s][%d] Received Route Config file\n", __FUNCTION__,__LINE__); fp = fopen(file_name, "r"); if (fp != NULL) { @@ -228,7 +228,7 @@ namespace rfc { } if (string_check == true) { tmp = strstr(tbuff, "IPV"); - RDK_LOG(RDK_LOG_DEBUG, LOG_RFCMGR, "[%s][%d] ip address=%s\n", __FUNCTION__,__LINE__, tbuff); + RDK_LOG(RDK_LOG_INFO, LOG_RFCMGR, "[%s][%d] ip address=%s\n", __FUNCTION__,__LINE__, tbuff); if (tmp != NULL && (NULL != strstr(tmp, "IPV4"))) { RDK_LOG(RDK_LOG_DEBUG, LOG_RFCMGR, "[%s][%d] default router Link Local IPV4 address present=%s\n", __FUNCTION__,__LINE__, tmp); @@ -279,7 +279,7 @@ namespace rfc { char tbuff[80] = {0}; char *tmp; if (dns_file_name == NULL) { - RDK_LOG(RDK_LOG_DEBUG, LOG_RFCMGR,"[%s][%d] isDnsResolve(): parameter is NULL\n", __FUNCTION__,__LINE__); + RDK_LOG(RDK_LOG_ERROR, LOG_RFCMGR,"[%s][%d] Input parameter is NULL\n", __FUNCTION__,__LINE__); return dns_status; } fp = fopen(dns_file_name , "r"); @@ -309,23 +309,23 @@ namespace rfc { } else { - RDK_LOG(RDK_LOG_DEBUG, LOG_RFCMGR,"[%s][%d] dns resolve file:%s not present\n", __FUNCTION__,__LINE__, dns_file_name); + RDK_LOG(RDK_LOG_ERROR, LOG_RFCMGR,"[%s][%d] dns resolve file:%s not present\n", __FUNCTION__,__LINE__, dns_file_name); } return dns_status; } DeviceStatus RFCManager ::CheckDeviceIsOnline() { - RDK_LOG(RDK_LOG_DEBUG, LOG_RFCMGR,"[%s][%d] Checking IP and Route configuration\n", __FUNCTION__,__LINE__); + RDK_LOG(RDK_LOG_INFO, LOG_RFCMGR,"[%s][%d] Checking IP and Route configuration\n", __FUNCTION__,__LINE__); rfc::DeviceStatus result = RFCMGR_DEVICE_OFFLINE; #if !defined(RDKB_SUPPORT) if (true == CheckIProuteConnectivity(GATEWAYIP_FILE)) { - RDK_LOG(RDK_LOG_DEBUG, LOG_RFCMGR,"[%s][%d] Checking IP and Route configuration found\n", __FUNCTION__,__LINE__); - RDK_LOG(RDK_LOG_DEBUG, LOG_RFCMGR,"[%s][%d] Checking DNS Nameserver configuration\n", __FUNCTION__,__LINE__); + RDK_LOG(RDK_LOG_INFO, LOG_RFCMGR,"[%s][%d] Checking IP and Route configuration found\n", __FUNCTION__,__LINE__); + RDK_LOG(RDK_LOG_INFO, LOG_RFCMGR,"[%s][%d] Checking DNS Nameserver configuration\n", __FUNCTION__,__LINE__); if (true == (isDnsResolve(DNS_RESOLV_FILE))) { - RDK_LOG(RDK_LOG_DEBUG, LOG_RFCMGR, "[%s][%d] DNS Nameservers are available\n",__FUNCTION__,__LINE__); + RDK_LOG(RDK_LOG_INFO, LOG_RFCMGR, "[%s][%d] DNS Nameservers are available\n",__FUNCTION__,__LINE__); result = RFCMGR_DEVICE_ONLINE; } else @@ -340,7 +340,7 @@ namespace rfc { } #else if (true == CheckIPConnectivity()){ - RDK_LOG(RDK_LOG_DEBUG, LOG_RFCMGR,"[%s][%d] IP configuration found...\n", __FUNCTION__,__LINE__); + RDK_LOG(RDK_LOG_INFO, LOG_RFCMGR,"[%s][%d] IP configuration found...\n", __FUNCTION__,__LINE__); result = RFCMGR_DEVICE_ONLINE; } else { @@ -405,7 +405,7 @@ namespace rfc { int result = rfcObj->InitializeRuntimeFeatureControlProcessor(); if(result == FAILURE) { - RDK_LOG(RDK_LOG_ERROR, LOG_RFCMGR,"[%s][%d] Xconf Initialization ...!!\n", __FUNCTION__,__LINE__); + RDK_LOG(RDK_LOG_ERROR, LOG_RFCMGR,"[%s][%d] Xconf Initialization Failed...!!\n", __FUNCTION__,__LINE__); delete rfcObj; return reqStatus; } @@ -429,7 +429,7 @@ namespace rfc { } else { - RDK_LOG(RDK_LOG_ERROR, LOG_RFCMGR,"[%s][%d] RFC: Posting RFC Error Event to MaintenanceMGR\n", __FUNCTION__,__LINE__); + RDK_LOG(RDK_LOG_INFO, LOG_RFCMGR,"[%s][%d] RFC: Posting RFC Error Event to MaintenanceMGR\n", __FUNCTION__,__LINE__); rfcObj->NotifyTelemetry2Count("SYST_INFO_RFC_Error"); SendEventToMaintenanceManager("MaintenanceMGR", MAINT_RFC_ERROR); } @@ -437,7 +437,7 @@ namespace rfc { int post_process_result = RFCManagerPostProcess(); if(post_process_result == SUCCESS) { - RDK_LOG(RDK_LOG_INFO, LOG_RFCMGR,"[%s][%d] RFC:Post Processing Successfully Completed\n", __FUNCTION__,__LINE__); + RDK_LOG(RDK_LOG_INFO, LOG_RFCMGR,"[%s][%d] RFC:Post Processing Successfully Completed\n", __FUNCTION__,__LINE__); rfcObj->NotifyTelemetry2Count("SYST_INFO_RFC_PostProcess_Success"); } else @@ -538,7 +538,7 @@ namespace rfc { tempFileCreated = true; emptyFile.close(); } else { - RDK_LOG(RDK_LOG_ERROR, LOG_RFCMGR, "[%s][%d] Failed to create temp file\n", __FUNCTION__, __LINE__); + RDK_LOG(RDK_LOG_ERROR, LOG_RFCMGR, "[%s][%d] Failed to create temp file\n", __FUNCTION__, __LINE__); return; } } @@ -559,7 +559,7 @@ namespace rfc { cronContent.close(); if (!hasContent) { - RDK_LOG(RDK_LOG_DEBUG, LOG_RFCMGR, "[%s][%d] No existing crontab content found\n", __FUNCTION__, __LINE__); + RDK_LOG(RDK_LOG_INFO, LOG_RFCMGR, "[%s][%d] No existing crontab content found\n", __FUNCTION__, __LINE__); } } else { RDK_LOG(RDK_LOG_DEBUG, LOG_RFCMGR, "[%s][%d] Existing crontab content found empty\n", __FUNCTION__, __LINE__); diff --git a/rfcMgr/rfc_manager.h b/rfcMgr/rfc_manager.h index c019ce3f..4a1ccd95 100644 --- a/rfcMgr/rfc_manager.h +++ b/rfcMgr/rfc_manager.h @@ -35,6 +35,11 @@ /* Macros */ /*----------------------------------------------------------------------------*/ #define DEBUG_INI_FILE "/etc/debug.ini" +#if !defined(RDKB_SUPPORT) +#define OVERIDE_DEBUG_INI_FILE "/opt/debug.ini" +#else +#define OVERIDE_DEBUG_INI_FILE "/nvram/debug.ini" +#endif #define DNS_RESOLV_FILE "/etc/resolv.dnsmasq" #define IP_ROUTE_FLAG "/tmp/route_available" #define GATEWAYIP_FILE "/tmp/.GatewayIP_dfltroute" diff --git a/rfcMgr/rfc_xconf_handler.cpp b/rfcMgr/rfc_xconf_handler.cpp index 53db964d..eb62e8b6 100644 --- a/rfcMgr/rfc_xconf_handler.cpp +++ b/rfcMgr/rfc_xconf_handler.cpp @@ -62,7 +62,7 @@ int RuntimeFeatureControlProcessor:: InitializeRuntimeFeatureControlProcessor(vo { rfc_file = RFC_PROPERTIES_PERSISTENCE_FILE; rfc_state = Local; - RDK_LOG(RDK_LOG_DEBUG, LOG_RFCMGR, "[%s][%d] Found Persistent file %s, Updating State %d \n", __FUNCTION__, __LINE__, rfc_file.c_str(), rfc_state); + RDK_LOG(RDK_LOG_INFO, LOG_RFCMGR, "[%s][%d] Found Persistent file %s, Updating State %d \n", __FUNCTION__, __LINE__, rfc_file.c_str(), rfc_state); } else { @@ -93,8 +93,19 @@ int RuntimeFeatureControlProcessor:: InitializeRuntimeFeatureControlProcessor(vo GetAccountID(); GetOsClass(); -#if !defined(RDKB_SUPPORT) +#if !defined(RDKB_SUPPORT) _is_first_request = IsNewFirmwareFirstRequest(); +#else + if (access("/tmp/RFC/.timeValue", F_OK) != 0) + { + RDK_LOG(RDK_LOG_INFO, LOG_RFCMGR, "Consider as First RFC Request since /tmp/RFC/.timeValue file not found \n"); + _is_first_request = true; + } + else + { + RDK_LOG(RDK_LOG_INFO, LOG_RFCMGR, "Setting _is_first_request=false as /tmp/RFC/.timeValue file found \n"); + _is_first_request = false; + } #endif return SUCCESS; @@ -124,9 +135,9 @@ bool RuntimeFeatureControlProcessor::isDebugServicesEnabled(void) *rfc_data = 0; ret = read_RFCProperty("DEBUGSRV", RFC_DEBUGSRV, rfc_data, sizeof(rfc_data)); if (ret == -1) { - SWLOG_ERROR("%s: rfc Debug services =%s failed Status %d\n", __FUNCTION__, RFC_DEBUGSRV, ret); + RDK_LOG(RDK_LOG_ERROR, LOG_RFCMGR, "[%s][%d] rfc Debug services =%s failed Status %d\n", __FUNCTION__, __LINE__, RFC_DEBUGSRV, ret); } else { - SWLOG_INFO("%s: rfc Debug services = %s\n", __FUNCTION__, rfc_data); + RDK_LOG(RDK_LOG_INFO, LOG_RFCMGR, "[%s][%d] rfc Debug services = %s\n", __FUNCTION__, __LINE__, rfc_data); if (strncmp(rfc_data, "true", sizeof(rfc_data)+1 ) == 0) { result = true; } @@ -162,7 +173,7 @@ int RuntimeFeatureControlProcessor::GetLastProcessedFirmware(const char *lastVes RDK_LOG(RDK_LOG_ERROR, LOG_RFCMGR, "Last Firmware not found in the file.\n" ); return FAILURE; } - RDK_LOG(RDK_LOG_DEBUG, LOG_RFCMGR, "[%s][%d] GetLastProcessedFirmware: [%s]\n", __FUNCTION__, __LINE__, _last_firmware.c_str()); + RDK_LOG(RDK_LOG_INFO, LOG_RFCMGR, "[%s][%d] GetLastProcessedFirmware: [%s]\n", __FUNCTION__, __LINE__, _last_firmware.c_str()); inputFile.close(); @@ -193,7 +204,7 @@ bool RuntimeFeatureControlProcessor::ExecuteCommand(const std::string& command, bool RuntimeFeatureControlProcessor::ParseConfigValue(const std::string& configKey, const std::string& configValue, int rebootValue, bool& rfcRebootCronNeeded) { - RDK_LOG(RDK_LOG_DEBUG, LOG_RFCMGR, "[%s][%d] Key:%s , Value:%s ImmediateReboot:%d \n", __FUNCTION__, __LINE__, configKey.c_str(), configValue.c_str(), rebootValue); + RDK_LOG(RDK_LOG_INFO, LOG_RFCMGR, "[%s][%d] Key:%s , Value:%s ImmediateReboot:%d \n", __FUNCTION__, __LINE__, configKey.c_str(), configValue.c_str(), rebootValue); // Initialize rbus connection rbusHandle_t rbusHandle; @@ -229,7 +240,7 @@ bool RuntimeFeatureControlProcessor::ParseConfigValue(const std::string& configK if (wanFailOverSupportEnable == "true") { if (paramName == "Device.DeviceInfo.X_RDKCENTRAL-COM_RFC.Feature.UPnP.Refactor.Enable" || paramName == "Device.DeviceInfo.X_RDKCENTRAL-COM_RFC.Feature.Xupnp") { - RDK_LOG(RDK_LOG_DEBUG, LOG_RFCMGR, "Parameter %s is not applied in WFO builds\n", paramName.c_str()); + RDK_LOG(RDK_LOG_INFO, LOG_RFCMGR, "Parameter %s is not applied in WFO builds\n", paramName.c_str()); rbus_close(rbusHandle); return true; } @@ -288,10 +299,10 @@ bool RuntimeFeatureControlProcessor::ParseConfigValue(const std::string& configK std::string output; ExecuteCommand(psmcliCmd, output); - RDK_LOG(RDK_LOG_DEBUG, LOG_RFCMGR, "WanUnification Enabled Setting WanManager DML instead of Device.X_RDKCENTRAL-COM_EthernetWAN.SelectedOperationalMode to %s\n", configValue.c_str()); - RDK_LOG(RDK_LOG_DEBUG, LOG_RFCMGR, "Setting Device.X_RDK_WanManager.Interface.[DOCSIS].Selection.Enable to %s\n", enableDocsis.c_str()); - RDK_LOG(RDK_LOG_DEBUG, LOG_RFCMGR, "Setting Device.X_RDK_WanManager.Interface.[WANOE].Selection.Enable %s\n", enableEth.c_str()); - RDK_LOG(RDK_LOG_DEBUG, LOG_RFCMGR, "Setting dmsb.wanmanager.group.1.PersistSelectedInterface %s\n", persistSelectedInterface.c_str()); + RDK_LOG(RDK_LOG_INFO, LOG_RFCMGR, "WanUnification Enabled Setting WanManager DML instead of Device.X_RDKCENTRAL-COM_EthernetWAN.SelectedOperationalMode to %s\n", configValue.c_str()); + RDK_LOG(RDK_LOG_INFO, LOG_RFCMGR, "Setting Device.X_RDK_WanManager.Interface.[DOCSIS].Selection.Enable to %s\n", enableDocsis.c_str()); + RDK_LOG(RDK_LOG_INFO, LOG_RFCMGR, "Setting Device.X_RDK_WanManager.Interface.[WANOE].Selection.Enable %s\n", enableEth.c_str()); + RDK_LOG(RDK_LOG_INFO, LOG_RFCMGR, "Setting dmsb.wanmanager.group.1.PersistSelectedInterface %s\n", persistSelectedInterface.c_str()); rbus_close(rbusHandle); return true; @@ -358,8 +369,8 @@ bool RuntimeFeatureControlProcessor::ParseConfigValue(const std::string& configK RDK_LOG(RDK_LOG_ERROR, LOG_RFCMGR, "Failed to write to /tmp/.paramRFC\n"); } - RDK_LOG(RDK_LOG_DEBUG, LOG_RFCMGR, "paramType is %s\n", paramTypeStr.c_str()); - RDK_LOG(RDK_LOG_DEBUG, LOG_RFCMGR, "RFC: old parameter value %s\n", paramValue.c_str()); + RDK_LOG(RDK_LOG_INFO, LOG_RFCMGR, "paramType is %s\n", paramTypeStr.c_str()); + RDK_LOG(RDK_LOG_INFO, LOG_RFCMGR, "RFC: old parameter value %s\n", paramValue.c_str()); bool isRfcNameSpace = (paramName.find(".X_RDKCENTRAL-COM_RFC.") != std::string::npos); @@ -403,7 +414,7 @@ bool RuntimeFeatureControlProcessor::ParseConfigValue(const std::string& configK rbusValue_Release(newValue); if (rc == RBUS_ERROR_SUCCESS) { - RDK_LOG(RDK_LOG_DEBUG, LOG_RFCMGR, "RFC: updated for %s from value old=%s, to new=%s\n", paramName.c_str(), paramValue.c_str(), configValue.c_str()); + RDK_LOG(RDK_LOG_INFO, LOG_RFCMGR, "RFC: updated for %s from value old=%s, to new=%s\n", paramName.c_str(), paramValue.c_str(), configValue.c_str()); // Special handling for account ID if (paramName == RFC_ACCOUNT_ID_KEY_STR) { @@ -421,7 +432,7 @@ bool RuntimeFeatureControlProcessor::ParseConfigValue(const std::string& configK if (rebootValue == 1) { if (!rfcRebootCronNeeded) { rfcRebootCronNeeded = true; - RDK_LOG(RDK_LOG_DEBUG, LOG_RFCMGR, "RFC: Enabling RfcRebootCronNeeded since %s old value=%s, new value=%s, RebootValue=%d\n", paramName.c_str(), paramValue.c_str(), configValue.c_str(), rebootValue); + RDK_LOG(RDK_LOG_INFO, LOG_RFCMGR, "RFC: Enabling RfcRebootCronNeeded since %s old value=%s, new value=%s, RebootValue=%d\n", paramName.c_str(), paramValue.c_str(), configValue.c_str(), rebootValue); } } } else { @@ -472,7 +483,7 @@ bool RuntimeFeatureControlProcessor::ParseConfigValue(const std::string& configK rbusValue_Release(newValue); if (rc == RBUS_ERROR_SUCCESS) { - RDK_LOG(RDK_LOG_DEBUG, LOG_RFCMGR, "RFC: rbus SET called for RFC namespace param: %s value=%s\n", paramName.c_str(), configValue.c_str()); + RDK_LOG(RDK_LOG_INFO, LOG_RFCMGR, "RFC: rbus SET called for RFC namespace param: %s value=%s\n", paramName.c_str(), configValue.c_str()); } else { RDK_LOG(RDK_LOG_ERROR, LOG_RFCMGR, "RFC: rbus SET failed for %s with value %s: %s\n", paramName.c_str(), configValue.c_str(), rbusError_ToString(rc)); } @@ -482,7 +493,7 @@ bool RuntimeFeatureControlProcessor::ParseConfigValue(const std::string& configK } // Note: No reboot logic for RFC namespace parameters when values are same } else { - RDK_LOG(RDK_LOG_DEBUG, LOG_RFCMGR, "RFC: For param %s new and old values are same value %s\n", paramName.c_str(), configValue.c_str()); + RDK_LOG(RDK_LOG_INFO, LOG_RFCMGR, "RFC: For param %s new and old values are same value %s\n", paramName.c_str(), configValue.c_str()); } rbus_close(rbusHandle); @@ -492,7 +503,7 @@ bool RuntimeFeatureControlProcessor::ParseConfigValue(const std::string& configK int RuntimeFeatureControlProcessor::ProcessJsonResponseB(char* featureXConfMsg) { std::string rfcList; - RDK_LOG(RDK_LOG_DEBUG, LOG_RFCMGR, "[%s][%d] Xconf Response: %s\n", __FUNCTION__, __LINE__, featureXConfMsg); + RDK_LOG(RDK_LOG_INFO, LOG_RFCMGR, "[%s][%d] Xconf Response: %s\n", __FUNCTION__, __LINE__, featureXConfMsg); // Initialize rbus connection rbusHandle_t rbusHandle; @@ -578,7 +589,7 @@ int RuntimeFeatureControlProcessor::ProcessJsonResponseB(char* featureXConfMsg) continue; } - RDK_LOG(RDK_LOG_DEBUG, LOG_RFCMGR, "[%s][%d] Processing feature: %s, enabled: %s, effectiveImmediate: %s\n", + RDK_LOG(RDK_LOG_INFO, LOG_RFCMGR, "[%s][%d] Processing feature: %s, enabled: %s, effectiveImmediate: %s\n", __FUNCTION__, __LINE__, rfcObj->name.c_str(), rfcObj->enable ? "true" : "false", rfcObj->effectiveImmediate ? "true" : "false"); @@ -610,7 +621,7 @@ int RuntimeFeatureControlProcessor::ProcessJsonResponseB(char* featureXConfMsg) const char* configKey = child->string; const char* configValue = child->valuestring; - RDK_LOG(RDK_LOG_DEBUG, LOG_RFCMGR, "[%s][%d] Processing config entry %d: %s = %s (effectiveImmediate=%d)\n", + RDK_LOG(RDK_LOG_INFO, LOG_RFCMGR, "[%s][%d] Processing config entry %d: %s = %s (effectiveImmediate=%d)\n", __FUNCTION__, __LINE__, configEntryCount, configKey, configValue, effectiveImmediate); // Extract feature name from key (6th field when split by '.') - matching shell script logic @@ -633,10 +644,10 @@ int RuntimeFeatureControlProcessor::ProcessJsonResponseB(char* featureXConfMsg) // Special telemetry handling for individual configData entries (matching shell script) if (featureName == "PeriodicFWCheck" && strcmp(configValue, "true") == 0) { - RDK_LOG(RDK_LOG_DEBUG, LOG_RFCMGR, "[%s][%d] Notify Telemetry for SYS_INFO_RFC_PeriodicFWCheck\n", __FUNCTION__, __LINE__); + RDK_LOG(RDK_LOG_INFO, LOG_RFCMGR, "[%s][%d] Notify Telemetry for SYS_INFO_RFC_PeriodicFWCheck\n", __FUNCTION__, __LINE__); NotifyTelemetry2Count("SYS_INFO_RFC_PeriodicFWCheck"); } else if (featureName == "IPv6onLnF" && strcmp(configValue, "true") == 0) { - RDK_LOG(RDK_LOG_DEBUG, LOG_RFCMGR, "[%s][%d] Notify Telemetry for INFO_IPv6_LNF_Support\n", __FUNCTION__, __LINE__); + RDK_LOG(RDK_LOG_INFO, LOG_RFCMGR, "[%s][%d] Notify Telemetry for INFO_IPv6_LNF_Support\n", __FUNCTION__, __LINE__); NotifyTelemetry2Count("INFO_IPv6_LNF_Support"); } @@ -686,7 +697,7 @@ int RuntimeFeatureControlProcessor::ProcessJsonResponseB(char* featureXConfMsg) rbusValue_Release(trueVal); rbus_close(rbusHandle); - RDK_LOG(RDK_LOG_DEBUG, LOG_RFCMGR, "[%s][%d] ProcessJsonResponseB completed successfully. Reboot needed: %s\n", + RDK_LOG(RDK_LOG_INFO, LOG_RFCMGR, "[%s][%d] ProcessJsonResponseB completed successfully. Reboot needed: %s\n", __FUNCTION__, __LINE__, rfcRebootCronNeeded ? "true" : "false"); return SUCCESS; @@ -743,7 +754,7 @@ std::string RuntimeFeatureControlProcessor::readAccountIdFromFile() } } fclose(paramFile); - RDK_LOG(RDK_LOG_DEBUG, LOG_RFCMGR, "readAccountIdFromFile: Extracted AccountId=%s from file\n", accountId.c_str()); + RDK_LOG(RDK_LOG_INFO, LOG_RFCMGR, "readAccountIdFromFile: Extracted AccountId=%s from file\n", accountId.c_str()); } else { @@ -781,10 +792,10 @@ void RuntimeFeatureControlProcessor::rfcCheckAccountId() // Compare with backup account ID if (paramValue != bkAccountId) { - RDK_LOG(RDK_LOG_DEBUG, LOG_RFCMGR, "rfcCheckAccountId: Account Id mismatch: old=%s, new=%s\n", bkAccountId.c_str(), paramValue.c_str()); + RDK_LOG(RDK_LOG_INFO, LOG_RFCMGR, "rfcCheckAccountId: Account Id mismatch: old=%s, new=%s\n", bkAccountId.c_str(), paramValue.c_str()); } - RDK_LOG(RDK_LOG_DEBUG, LOG_RFCMGR, "rfcCheckAccountId: bkAccountId=%s, paramValue=%s\n", bkAccountId.c_str(), paramValue.c_str()); + RDK_LOG(RDK_LOG_INFO, LOG_RFCMGR, "rfcCheckAccountId: bkAccountId=%s, paramValue=%s\n", bkAccountId.c_str(), paramValue.c_str()); } #endif @@ -800,19 +811,19 @@ void RuntimeFeatureControlProcessor::GetAccountID() if (i == READ_RFC_FAILURE) { i = snprintf(tempbuf, szBufSize, "Unknown"); - RDK_LOG(RDK_LOG_DEBUG, LOG_RFCMGR, "GetAccountID: read_RFCProperty() failed Status %d\n", i); + RDK_LOG(RDK_LOG_ERROR, LOG_RFCMGR, "GetAccountID: read_RFCProperty() failed Status %d\n", i); } else { i = strnlen(tempbuf, szBufSize); - RDK_LOG(RDK_LOG_DEBUG, LOG_RFCMGR, "GetAccountID: AccountID = %s\n", tempbuf); + RDK_LOG(RDK_LOG_INFO, LOG_RFCMGR, "GetAccountID: AccountID = %s\n", tempbuf); _accountId = tempbuf; #ifdef RDKB_SUPPORT if (access("/tmp/RFC/.timeValue", F_OK) != 0) { // Time file doesn't exist, set AccountID to Unknown _accountId = "Unknown"; - RDK_LOG(RDK_LOG_DEBUG, LOG_RFCMGR, "GetAccountID: .timeValue file not found, setting AccountID to Unknown\n"); + RDK_LOG(RDK_LOG_INFO, LOG_RFCMGR, "GetAccountID: /tmp/RFC/.timeValue file not found, setting AccountID to Unknown\n"); } saveAccountIdToFile(_accountId, RFC_ACCOUNT_ID_KEY_STR, "string"); #endif @@ -834,7 +845,7 @@ void RuntimeFeatureControlProcessor::GetRFCPartnerID() if (checkWhoamiSupport()) { - RDK_LOG(RDK_LOG_DEBUG, LOG_RFCMGR, "GetPartnerID: WhoAmI support is Enabled\n"); + RDK_LOG(RDK_LOG_INFO, LOG_RFCMGR, "GetPartnerID: WhoAmI support is Enabled\n"); i = read_RFCProperty(str.c_str(), RFC_PARTNERNAME_KEY_STR, tempbuf, partBufSize); if (i == READ_RFC_FAILURE) { @@ -852,7 +863,7 @@ void RuntimeFeatureControlProcessor::GetRFCPartnerID() RDK_LOG(RDK_LOG_DEBUG, LOG_RFCMGR, "GetRFCPartnerID: get from _partner_id\n"); } - RDK_LOG(RDK_LOG_DEBUG, LOG_RFCMGR, "GetRFCPartnerID: PartnerID = %s\n", _partnerId.c_str()); + RDK_LOG(RDK_LOG_INFO, LOG_RFCMGR, "GetRFCPartnerID: PartnerID = %s\n", _partnerId.c_str()); return; } @@ -895,7 +906,7 @@ void RuntimeFeatureControlProcessor::GetOsClass( void ) if (checkWhoamiSupport()) { - RDK_LOG(RDK_LOG_DEBUG, LOG_RFCMGR, "GetOsClass: WhoAmI support if Enabled\n"); + RDK_LOG(RDK_LOG_INFO, LOG_RFCMGR, "GetOsClass: WhoAmI support if Enabled\n"); i = read_RFCProperty(str.c_str(), RFC_OSCLASS_KEY_STR, osclassbuf, osclassbufSize); if (i == READ_RFC_FAILURE) { @@ -1011,27 +1022,27 @@ int RuntimeFeatureControlProcessor::GetServURL(const char *rfcPropertiesFile) if (!tmp_URL.empty()) { _xconf_server_url = tmp_URL + "/featureControl/getSettings"; - RDK_LOG(RDK_LOG_DEBUG, LOG_RFCMGR, "[%s][%d] Using TR181 URL: [%s]\n", __FUNCTION__, __LINE__, _xconf_server_url.c_str()); + RDK_LOG(RDK_LOG_INFO, LOG_RFCMGR, "[%s][%d] Using TR181 URL: [%s]\n", __FUNCTION__, __LINE__, _xconf_server_url.c_str()); } else { if (_partnerId == "sky-uk" && !_xconf_server_url_eu.empty()) { _xconf_server_url = _xconf_server_url_eu; - RDK_LOG(RDK_LOG_DEBUG, LOG_RFCMGR, "[%s][%d] Using EU URL for sky-uk\n", __FUNCTION__, __LINE__); + RDK_LOG(RDK_LOG_INFO, LOG_RFCMGR, "[%s][%d] Using EU URL for sky-uk\n", __FUNCTION__, __LINE__); } RDK_LOG(RDK_LOG_WARN, LOG_RFCMGR, "[%s][%d] RFC: TR181 URL is empty\n", __FUNCTION__, __LINE__); } - RDK_LOG(RDK_LOG_DEBUG, LOG_RFCMGR, "[%s][%d] Initial URL: [%s]\n", __FUNCTION__, __LINE__, _xconf_server_url.c_str()); + RDK_LOG(RDK_LOG_INFO, LOG_RFCMGR, "[%s][%d] Initial URL: [%s]\n", __FUNCTION__, __LINE__, _xconf_server_url.c_str()); } else // rfc_state == Local { if (_partnerId == "sky-uk" && !_xconf_server_url_eu.empty()) { _xconf_server_url = _xconf_server_url_eu; - RDK_LOG(RDK_LOG_DEBUG, LOG_RFCMGR, "[%s][%d] Using EU URL for sky-uk in LOCAL mode\n", __FUNCTION__, __LINE__); + RDK_LOG(RDK_LOG_INFO, LOG_RFCMGR, "[%s][%d] Using EU URL for sky-uk in LOCAL mode\n", __FUNCTION__, __LINE__); } } #else @@ -1054,7 +1065,7 @@ int RuntimeFeatureControlProcessor::GetServURL(const char *rfcPropertiesFile) return FAILURE; } - RDK_LOG(RDK_LOG_DEBUG, LOG_RFCMGR, "[%s][%d] _xconf_server_url: [%s]\n", __FUNCTION__, __LINE__, _xconf_server_url.c_str()); + RDK_LOG(RDK_LOG_INFO, LOG_RFCMGR, "[%s][%d] _xconf_server_url: [%s]\n", __FUNCTION__, __LINE__, _xconf_server_url.c_str()); return SUCCESS; } @@ -1197,7 +1208,7 @@ bool RuntimeFeatureControlProcessor::isXconfSelectorSlotProd() else { i = strnlen(tempbuf, szBufSize); - RDK_LOG(RDK_LOG_DEBUG, LOG_RFCMGR, "[%s][%d] XconfSelector = %s\n", __FUNCTION__, __LINE__, tempbuf); + RDK_LOG(RDK_LOG_INFO, LOG_RFCMGR, "[%s][%d] XconfSelector = %s\n", __FUNCTION__, __LINE__, tempbuf); } if(0 == prod_str.compare(tempbuf)) @@ -1217,8 +1228,8 @@ void RuntimeFeatureControlProcessor::clearDB(void) // this is required as sometime key value pairs will simply // disappear from the config data, as mac is mostly removed // to disable a feature rather than having different value - RDK_LOG(RDK_LOG_DEBUG, LOG_RFCMGR, "[%s][%d] Clearing DB\n", __FUNCTION__,__LINE__); - RDK_LOG(RDK_LOG_DEBUG, LOG_RFCMGR, "[%s][%d] Resetting all rfc values in backing store\n", __FUNCTION__,__LINE__); + RDK_LOG(RDK_LOG_INFO, LOG_RFCMGR, "[%s][%d] Clearing DB\n", __FUNCTION__,__LINE__); + RDK_LOG(RDK_LOG_INFO, LOG_RFCMGR, "[%s][%d] Resetting all rfc values in backing store\n", __FUNCTION__,__LINE__); #ifndef RDKC std::string name = "rfc"; @@ -1237,12 +1248,12 @@ void RuntimeFeatureControlProcessor::clearDB(void) set_RFCProperty(name, BootstrapClearDB, clearValue); set_RFCProperty(name, ConfigChangeTimeKey, ConfigChangeTime); - RDK_LOG(RDK_LOG_DEBUG, LOG_RFCMGR, "[%s][%d] Clearing DB Value: %s\n", __FUNCTION__,__LINE__,ClearDB.c_str()); - RDK_LOG(RDK_LOG_DEBUG, LOG_RFCMGR, "[%s][%d] Bootstrap Clearing DB Value: %s\n", __FUNCTION__,__LINE__,BootstrapClearDB.c_str()); - RDK_LOG(RDK_LOG_DEBUG, LOG_RFCMGR, "[%s][%d] ConfigChangeTime: %s\n", __FUNCTION__,__LINE__,ConfigChangeTime.c_str()); + RDK_LOG(RDK_LOG_INFO, LOG_RFCMGR, "[%s][%d] Clearing DB Value: %s\n", __FUNCTION__,__LINE__,ClearDB.c_str()); + RDK_LOG(RDK_LOG_INFO, LOG_RFCMGR, "[%s][%d] Bootstrap Clearing DB Value: %s\n", __FUNCTION__,__LINE__,BootstrapClearDB.c_str()); + RDK_LOG(RDK_LOG_INFO, LOG_RFCMGR, "[%s][%d] ConfigChangeTime: %s\n", __FUNCTION__,__LINE__,ConfigChangeTime.c_str()); #else - RDK_LOG(RDK_LOG_DEBUG, LOG_RFCMGR, "[%s][%d] Clearing tr181 store\n", __FUNCTION__,__LINE__); + RDK_LOG(RDK_LOG_INFO, LOG_RFCMGR, "[%s][%d] Clearing tr181 store\n", __FUNCTION__,__LINE__); if (std::remove(TR181STOREFILE) == 0) { RDK_LOG(RDK_LOG_DEBUG, LOG_RFCMGR, "[%s][%d] File %s removed successfully\n",__FUNCTION__, __LINE__, TR181STOREFILE); @@ -1265,7 +1276,7 @@ void RuntimeFeatureControlProcessor::rfcStashStoreParams(void) // Store the current AccountID before clearing DB stashAccountId = _accountId; - RDK_LOG(RDK_LOG_DEBUG, LOG_RFCMGR, "[%s][%d] Stashed AccountID: %s\n", __FUNCTION__, __LINE__, stashAccountId.c_str()); + RDK_LOG(RDK_LOG_INFO, LOG_RFCMGR, "[%s][%d] Stashed AccountID: %s\n", __FUNCTION__, __LINE__, stashAccountId.c_str()); } void RuntimeFeatureControlProcessor::rfcStashRetrieveParams(void) @@ -1276,7 +1287,7 @@ void RuntimeFeatureControlProcessor::rfcStashRetrieveParams(void) if (!stashAccountId.empty() && stashAccountId != "Unknown") { - RDK_LOG(RDK_LOG_DEBUG, LOG_RFCMGR, "[%s][%d] Restoring AccountID: %s\n", __FUNCTION__, __LINE__, stashAccountId.c_str()); + RDK_LOG(RDK_LOG_INFO, LOG_RFCMGR, "[%s][%d] Restoring AccountID: %s\n", __FUNCTION__, __LINE__, stashAccountId.c_str()); std::string name = "rfc"; @@ -1296,12 +1307,12 @@ void RuntimeFeatureControlProcessor::rfcStashRetrieveParams(void) } else { - RDK_LOG(RDK_LOG_DEBUG, LOG_RFCMGR, "[%s][%d] No valid AccountID to restore\n", __FUNCTION__, __LINE__); + RDK_LOG(RDK_LOG_INFO, LOG_RFCMGR, "[%s][%d] No valid AccountID to restore\n", __FUNCTION__, __LINE__); } } void RuntimeFeatureControlProcessor::clearDBEnd(void){ - RDK_LOG(RDK_LOG_DEBUG, LOG_RFCMGR, "[%s][%d] Clearing DB End\n", __FUNCTION__,__LINE__); + RDK_LOG(RDK_LOG_INFO, LOG_RFCMGR, "[%s][%d] Clearing DB End\n", __FUNCTION__,__LINE__); std::string name = "rfc"; const std::string clearValue = "true"; @@ -1313,14 +1324,14 @@ void RuntimeFeatureControlProcessor::clearDBEnd(void){ set_RFCProperty(name, BootstrapClearDBEndKey, clearValue); set_RFCProperty(name, reloadCacheKey, clearValue); - RDK_LOG(RDK_LOG_DEBUG, LOG_RFCMGR, "[%s][%d] Clearing DBEnd Key Value: %s\n", __FUNCTION__,__LINE__,ClearDBEndKey.c_str()); - RDK_LOG(RDK_LOG_DEBUG, LOG_RFCMGR, "[%s][%d] Bootstrap Clearing DBEnd Key Value: %s\n", __FUNCTION__,__LINE__,BootstrapClearDBEndKey.c_str()); - RDK_LOG(RDK_LOG_DEBUG, LOG_RFCMGR, "[%s][%d] Reload Cache Key: %s\n", __FUNCTION__,__LINE__,reloadCacheKey.c_str()); + RDK_LOG(RDK_LOG_INFO, LOG_RFCMGR, "[%s][%d] Clearing DBEnd Key Value: %s\n", __FUNCTION__,__LINE__,ClearDBEndKey.c_str()); + RDK_LOG(RDK_LOG_INFO, LOG_RFCMGR, "[%s][%d] Bootstrap Clearing DBEnd Key Value: %s\n", __FUNCTION__,__LINE__,BootstrapClearDBEndKey.c_str()); + RDK_LOG(RDK_LOG_INFO, LOG_RFCMGR, "[%s][%d] Reload Cache Key: %s\n", __FUNCTION__,__LINE__,reloadCacheKey.c_str()); } void RuntimeFeatureControlProcessor::updateHashInDB(std::string configSetHash) { - RDK_LOG(RDK_LOG_DEBUG, LOG_RFCMGR, "[%s][%d] Config Set Hash = %s\n", __FUNCTION__, __LINE__, configSetHash.c_str()); + RDK_LOG(RDK_LOG_INFO, LOG_RFCMGR, "[%s][%d] Config Set Hash = %s\n", __FUNCTION__, __LINE__, configSetHash.c_str()); #if !defined(RDKB_SUPPORT) std::string ConfigSetHashName = "ConfigSetHash"; @@ -1336,7 +1347,7 @@ void RuntimeFeatureControlProcessor::updateHashInDB(std::string configSetHash) // Write the hash value to the file file << configSetHash; file.close(); - RDK_LOG(RDK_LOG_DEBUG, LOG_RFCMGR, "[%s][%d] Successfully wrote hash to %s\n", __FUNCTION__, __LINE__, filePath.c_str()); + RDK_LOG(RDK_LOG_INFO, LOG_RFCMGR, "[%s][%d] Successfully wrote hash to %s\n", __FUNCTION__, __LINE__, filePath.c_str()); } else { RDK_LOG(RDK_LOG_ERROR, LOG_RFCMGR, "[%s][%d] Error: Unable to open file %s for writing\n", __FUNCTION__, __LINE__, filePath.c_str()); } @@ -1362,7 +1373,7 @@ void RuntimeFeatureControlProcessor::updateTimeInDB(std::string timestampString) if (file.is_open()) { file << timestampString; file.close(); - RDK_LOG(RDK_LOG_DEBUG, LOG_RFCMGR, "[%s][%d] Successfully wrote timestamp to %s\n", __FUNCTION__, __LINE__, filePath.c_str()); + RDK_LOG(RDK_LOG_INFO, LOG_RFCMGR, "[%s][%d] Successfully wrote timestamp to %s\n", __FUNCTION__, __LINE__, filePath.c_str()); } else { RDK_LOG(RDK_LOG_ERROR, LOG_RFCMGR, "[%s][%d] Error: Unable to open file %s for writing\n", __FUNCTION__, __LINE__, filePath.c_str()); } @@ -1373,7 +1384,7 @@ void RuntimeFeatureControlProcessor::updateTimeInDB(std::string timestampString) void RuntimeFeatureControlProcessor::updateHashAndTimeInDB(char *curlHeaderResp) { - RDK_LOG(RDK_LOG_DEBUG, LOG_RFCMGR, "[%s][%d] Xconf Header Response: %s\n", __FUNCTION__, __LINE__, curlHeaderResp); + RDK_LOG(RDK_LOG_INFO, LOG_RFCMGR, "[%s][%d] Xconf Header Response: %s\n", __FUNCTION__, __LINE__, curlHeaderResp); std::string httpHeader = curlHeaderResp; std::string key1 = "configSetHash:"; @@ -1402,7 +1413,7 @@ void RuntimeFeatureControlProcessor::updateHashAndTimeInDB(char *curlHeaderResp) configSetHashValue.erase(configSetHashValue.find_last_not_of(" \t\r") + 1); // Output the value - RDK_LOG(RDK_LOG_DEBUG, LOG_RFCMGR, "configSetHash value: %s\n", configSetHashValue.c_str()); + RDK_LOG(RDK_LOG_INFO, LOG_RFCMGR, "configSetHash value: %s\n", configSetHashValue.c_str()); updateHashInDB(configSetHashValue); } else { @@ -1439,12 +1450,12 @@ bool RuntimeFeatureControlProcessor::IsDirectBlocked() if (modtime <= (long)direct_block_time) { std::string remtime_str = std::to_string(remtime); - RDK_LOG(RDK_LOG_DEBUG, LOG_RFCMGR,"[%s][%d] RFC: Last direct failed blocking is still valid for %s hrs, preventing direct\n", __FUNCTION__, __LINE__, remtime_str.c_str()); + RDK_LOG(RDK_LOG_INFO, LOG_RFCMGR,"[%s][%d] RFC: Last direct failed blocking is still valid for %s hrs, preventing direct\n", __FUNCTION__, __LINE__, remtime_str.c_str()); directret = true; } else { - RDK_LOG(RDK_LOG_DEBUG, LOG_RFCMGR,"[%s][%d] RFC: Last direct failed blocking has expired, removing %s, allowing direct \n", __FUNCTION__, __LINE__, DIRECT_BLOCK_FILENAME); + RDK_LOG(RDK_LOG_INFO, LOG_RFCMGR,"[%s][%d] RFC: Last direct failed blocking has expired, removing %s, allowing direct \n", __FUNCTION__, __LINE__, DIRECT_BLOCK_FILENAME); if (remove(DIRECT_BLOCK_FILENAME) != 0) { RDK_LOG(RDK_LOG_ERROR, LOG_RFCMGR,"[%s][%d]Failed to remove file %s\n", __FUNCTION__, __LINE__, DIRECT_BLOCK_FILENAME); @@ -1474,7 +1485,7 @@ int RuntimeFeatureControlProcessor::ProcessRuntimeFeatureControlReq() { if((filePresentCheck(RFC_PROPERTIES_PERSISTENCE_FILE) == RDK_API_SUCCESS) && (_ebuild_type != ePROD || dbgServices == true)) { - RDK_LOG(RDK_LOG_ERROR, LOG_RFCMGR, "[%s][%d] Setting URL from local override to %s\n", __FUNCTION__, __LINE__, _xconf_server_url.c_str()); + RDK_LOG(RDK_LOG_INFO, LOG_RFCMGR, "[%s][%d] Setting URL from local override to %s\n", __FUNCTION__, __LINE__, _xconf_server_url.c_str()); NotifyTelemetry2Value("SYST_INFO_RFC_XconflocalURL", _xconf_server_url.c_str()); } else @@ -1483,7 +1494,7 @@ int RuntimeFeatureControlProcessor::ProcessRuntimeFeatureControlReq() { _xconf_server_url.clear(); _xconf_server_url = _boot_strap_xconf_url + "/featureControl/getSettings"; - RDK_LOG(RDK_LOG_ERROR, LOG_RFCMGR, "[%s][%d] Setting URL from Bootstrap config XCONF_BS_URL:%s to %s \n", __FUNCTION__, __LINE__, _boot_strap_xconf_url.c_str(), _xconf_server_url.c_str()); + RDK_LOG(RDK_LOG_INFO, LOG_RFCMGR, "[%s][%d] Setting URL from Bootstrap config XCONF_BS_URL:%s to %s \n", __FUNCTION__, __LINE__, _boot_strap_xconf_url.c_str(), _xconf_server_url.c_str()); NotifyTelemetry2Value("SYST_INFO_RFC_XconfBSURL", _xconf_server_url.c_str()); } } @@ -1681,9 +1692,11 @@ void RuntimeFeatureControlProcessor::GetStoredHashAndTime( std ::string &valueHa { if(!_last_firmware.compare( _firmware_version )) { + RDK_LOG(RDK_LOG_INFO, LOG_RFCMGR, "[%s][%d] Last Image version %s and current image version %s are same \n", __FUNCTION__, __LINE__, _last_firmware.c_str(), _firmware_version.c_str()); /*Both the input strings are equal.*/ - if((rfc_state == Init) && (isXconfSelectorSlotProd() == true)) + if((rfc_state == Init) && (isXconfSelectorSlotProd() == false)) { + RDK_LOG(RDK_LOG_INFO, LOG_RFCMGR, "[%s][%d] Received XconfSelector as Non Prod for RFC state as INIT \n", __FUNCTION__, __LINE__); valueTime = "0"; valueHash = "OVERRIDE_HASH"; } @@ -1694,13 +1707,15 @@ void RuntimeFeatureControlProcessor::GetStoredHashAndTime( std ::string &valueHa } else { + RDK_LOG(RDK_LOG_INFO, LOG_RFCMGR, "[%s][%d] Last Image version %s and current image version %s are different \n", __FUNCTION__, __LINE__, _last_firmware.c_str(), _firmware_version.c_str()); valueTime = "0"; valueHash = "UPGRADE_HASH"; } - std::string InvalidStr = "Unkown"; + std::string InvalidStr = "Unknown"; if ((!_partner_id.compare(InvalidStr)) || (!_accountId.compare(InvalidStr))) { + RDK_LOG(RDK_LOG_INFO, LOG_RFCMGR, "[%s][%d] Invalid partner or account as Unknown, Passing OVERRIDE_HASH \n", __FUNCTION__, __LINE__); valueHash="OVERRIDE_HASH"; } @@ -1724,7 +1739,7 @@ void RuntimeFeatureControlProcessor::RetrieveHashAndTimeFromPreviousDataSet(std: if (hashFile.is_open()) { std::getline(hashFile, valueHash); hashFile.close(); - RDK_LOG(RDK_LOG_DEBUG, LOG_RFCMGR, "[%s][%d] ConfigSetHash: Hash = %s (from file)\n", __FUNCTION__, __LINE__, valueHash.c_str()); + RDK_LOG(RDK_LOG_INFO, LOG_RFCMGR, "[%s][%d] ConfigSetHash: Hash = %s (from file)\n", __FUNCTION__, __LINE__, valueHash.c_str()); } else { RDK_LOG(RDK_LOG_ERROR, LOG_RFCMGR, "[%s][%d] Failed to open hash file: %s\n", __FUNCTION__, __LINE__, hashFilePath.c_str()); } @@ -1739,7 +1754,7 @@ void RuntimeFeatureControlProcessor::RetrieveHashAndTimeFromPreviousDataSet(std: if (timeFile.is_open()) { std::getline(timeFile, valueTime); timeFile.close(); - RDK_LOG(RDK_LOG_DEBUG, LOG_RFCMGR, "[%s][%d] ConfigSetTime: Set Time = %s (from file)\n", __FUNCTION__, __LINE__, valueTime.c_str()); + RDK_LOG(RDK_LOG_INFO, LOG_RFCMGR, "[%s][%d] ConfigSetTime: Set Time = %s (from file)\n", __FUNCTION__, __LINE__, valueTime.c_str()); } else { RDK_LOG(RDK_LOG_ERROR, LOG_RFCMGR, "[%s][%d] Failed to open time file: %s\n", __FUNCTION__, __LINE__, timeFilePath.c_str()); } @@ -1764,7 +1779,7 @@ void RuntimeFeatureControlProcessor::RetrieveHashAndTimeFromPreviousDataSet(std: else { i = strnlen(tempbuf, szBufSize); - RDK_LOG(RDK_LOG_DEBUG, LOG_RFCMGR, "[%s][%d] ConfigSetHash: Hash = %s\n", __FUNCTION__, __LINE__, tempbuf); + RDK_LOG(RDK_LOG_INFO, LOG_RFCMGR, "[%s][%d] ConfigSetHash: Hash = %s\n", __FUNCTION__, __LINE__, tempbuf); } valueHash = tempbuf; @@ -1779,7 +1794,7 @@ void RuntimeFeatureControlProcessor::RetrieveHashAndTimeFromPreviousDataSet(std: else { i = strnlen(tempbuf, szBufSize); - RDK_LOG(RDK_LOG_DEBUG, LOG_RFCMGR, "[%s][%d] ConfigSetTime: Set Time = %s\n", __FUNCTION__, __LINE__, tempbuf); + RDK_LOG(RDK_LOG_INFO, LOG_RFCMGR, "[%s][%d] ConfigSetTime: Set Time = %s\n", __FUNCTION__, __LINE__, tempbuf); } valueTime = tempbuf; #endif @@ -1803,6 +1818,13 @@ int RuntimeFeatureControlProcessor::DownloadRuntimeFeatutres(DownloadData *pDwnL void *curl = nullptr; hashParam_t *hashParam = nullptr; MtlsAuth_t sec; +#ifdef LIBRDKCERTSELECTOR + int state_red = -1; + int cert_ret_code = -1; + MtlsAuthStatus ret = MTLS_CERT_FETCH_SUCCESS; +#else + int ret = MTLS_FAILURE; +#endif int httpCode = -1; hashParam = (hashParam_t *)malloc(sizeof(hashParam_t)); @@ -1812,16 +1834,45 @@ int RuntimeFeatureControlProcessor::DownloadRuntimeFeatutres(DownloadData *pDwnL return ret_value; } - memset(&sec, '\0', sizeof(MtlsAuth_t)); - int ret = getMtlscert(&sec); - if(ret == MTLS_FAILURE) +#ifdef LIBRDKCERTSELECTOR + static rdkcertselector_h thisCertSel = NULL; + RDK_LOG(RDK_LOG_INFO, LOG_RFCMGR, "[%s][%d] Initializing cert selector\n", __FUNCTION__, __LINE__); + if (thisCertSel == NULL) { - RDK_LOG(RDK_LOG_ERROR, LOG_RFCMGR, "[%s][%d] MTLS certification Failed\n",__FUNCTION__, __LINE__); + const char* certGroup = (state_red == 1) ? "RCVRY" : "MTLS"; + thisCertSel = rdkcertselector_new(DEFAULT_CONFIG, DEFAULT_HROT, certGroup); + if (thisCertSel == NULL) { + RDK_LOG(RDK_LOG_DEBUG, LOG_RFCMGR, "[%s][%d] Cert selector Initialisation failed\n", __FUNCTION__, __LINE__); + return cert_ret_code; + } else { + RDK_LOG(RDK_LOG_INFO, LOG_RFCMGR, "[%s][%d] Cert selector initialization successful\n", __FUNCTION__, __LINE__); + } + } else { + RDK_LOG(RDK_LOG_INFO, LOG_RFCMGR, "[%s][%d] Cert selector already initialized, reusing existing instance\n", __FUNCTION__, __LINE__); } + memset(&sec, '\0', sizeof(MtlsAuth_t)); + do { + RDK_LOG(RDK_LOG_INFO, LOG_RFCMGR, "[%s][%d] Fetching MTLS credential for SSR/XCONF\n", __FUNCTION__, __LINE__); + ret = getMtlscert(&sec, &thisCertSel); + RDK_LOG(RDK_LOG_INFO, LOG_RFCMGR, "[%s][%d] getMtlscert function ret value = %d\n", __FUNCTION__, __LINE__, ret); + + if (ret == MTLS_CERT_FETCH_FAILURE) { + RDK_LOG(RDK_LOG_ERROR, LOG_RFCMGR, "[%s][%d] MTLS cert failed, ret=%d\n", __FUNCTION__, __LINE__, ret); + return cert_ret_code; + } else if (ret == STATE_RED_CERT_FETCH_FAILURE) { + RDK_LOG(RDK_LOG_ERROR, LOG_RFCMGR, "[%s][%d] State red cert failed\n", __FUNCTION__, __LINE__); + return cert_ret_code; + } else { + RDK_LOG(RDK_LOG_INFO, LOG_RFCMGR, "[%s][%d] MTLS is enable\nMTLS creds for SSR fetched ret=%d\n", __FUNCTION__, __LINE__, ret); + NotifyTelemetry2Count("SYS_INFO_MTLS_enable"); + } + } while (rdkcertselector_setCurlStatus(thisCertSel, cert_ret_code, url_str.c_str()) == TRY_ANOTHER); +#endif + if((pDwnLoc->pvOut != NULL) && (pHeaderDwnLoc->pvOut != NULL)) { - RDK_LOG(RDK_LOG_DEBUG, LOG_RFCMGR, "[%s][%d] Curl Initialized\n", __FUNCTION__, __LINE__); + RDK_LOG(RDK_LOG_INFO, LOG_RFCMGR, "[%s][%d] Curl Initialized\n", __FUNCTION__, __LINE__); FileDwnl_t file_dwnl; memset(&file_dwnl, '\0', sizeof(FileDwnl_t)); @@ -1831,15 +1882,15 @@ int RuntimeFeatureControlProcessor::DownloadRuntimeFeatutres(DownloadData *pDwnL file_dwnl.pDlHeaderData = pHeaderDwnLoc; *(file_dwnl.pathname) = 0; - RDK_LOG(RDK_LOG_DEBUG, LOG_RFCMGR, "[%s][%d] Xconf Request : [%s]\n", __FUNCTION__, __LINE__, url_str.c_str()); + RDK_LOG(RDK_LOG_INFO, LOG_RFCMGR, "[%s][%d] Xconf Request : [%s]\n", __FUNCTION__, __LINE__, url_str.c_str()); strncpy(file_dwnl.url, url_str.c_str(), sizeof(file_dwnl.url)-1); std::string hashValue; std::string valueTime; GetStoredHashAndTime(hashValue, valueTime); - std::string configsethashParam = (std::string("configsethash:") + hashValue.c_str()); - std::string configsettimeParam = (std::string("configsettime:") + valueTime.c_str()); + std::string configsethashParam = (std::string("configsethash:") + hashValue.c_str()); + std::string configsettimeParam = (std::string("configsettime:") + valueTime.c_str()); hashParam->hashvalue = strdup((char *)configsethashParam.c_str()); hashParam->hashtime = strdup((char *)configsettimeParam.c_str()); @@ -1848,7 +1899,11 @@ int RuntimeFeatureControlProcessor::DownloadRuntimeFeatutres(DownloadData *pDwnL /* Handle MTLS failure case as well. */ int curl_ret_code = 0; - if (ret == MTLS_FAILURE) +#ifdef LIBRDKCERTSELECTOR + if (ret == MTLS_CERT_FETCH_FAILURE) +#else + if (ret == MTLS_FAILURE) +#endif { /* RDKE-419: No valid data in 'sec' buffer, pass NULL */ curl_ret_code = ExecuteRequest(&file_dwnl, NULL, &httpCode); @@ -1857,7 +1912,7 @@ int RuntimeFeatureControlProcessor::DownloadRuntimeFeatutres(DownloadData *pDwnL { curl_ret_code = ExecuteRequest(&file_dwnl, &sec, &httpCode); } - RDK_LOG(RDK_LOG_INFO, LOG_RFCMGR, "[%s][%d] RFC Xconf Connection Response cURL Return : %d HTTP Code : %d\n",__FUNCTION__, __LINE__, curl_ret_code, httpCode); + RDK_LOG(RDK_LOG_INFO, LOG_RFCMGR, "[%s][%d] RFC Xconf Connection Response cURL Return : %d HTTP Code : %d\n",__FUNCTION__, __LINE__, curl_ret_code, httpCode); CURLcode curl_code = (CURLcode)curl_ret_code; const char *error_msg = curl_easy_strerror(curl_code); RDK_LOG(RDK_LOG_DEBUG, LOG_RFCMGR, "[%s][%d] curl_easy_strerror =%s\n", __FUNCTION__, __LINE__, error_msg); @@ -1956,7 +2011,7 @@ void RuntimeFeatureControlProcessor::PreProcessJsonResponse(char *xconfResp) if((rfc_state == Init) || ( _is_first_request == true)) { /* Parse JSON */ - RDK_LOG(RDK_LOG_DEBUG, LOG_RFCMGR, "[%s][%d] Xconf Response: %s\n", __FUNCTION__, __LINE__, xconfResp); + RDK_LOG(RDK_LOG_INFO, LOG_RFCMGR, "[%s][%d] Xconf Response: %s\n", __FUNCTION__, __LINE__, xconfResp); JSON *pJson = ParseJsonStr(xconfResp); if(pJson) { @@ -1964,10 +2019,12 @@ void RuntimeFeatureControlProcessor::PreProcessJsonResponse(char *xconfResp) if(features) { CreateConfigDataValueMap(features); + RDK_LOG(RDK_LOG_INFO, LOG_RFCMGR, "[%s][%d] First Xconf Request after reboot=%d\n", __FUNCTION__, __LINE__,_is_first_request); if( _is_first_request == true) { - RDK_LOG(RDK_LOG_DEBUG, LOG_RFCMGR, "[%s][%d] GetValidAccountId\n", __FUNCTION__, __LINE__); + RDK_LOG(RDK_LOG_INFO, LOG_RFCMGR, "[%s][%d] GetValidAccountId\n", __FUNCTION__, __LINE__); GetValidAccountId(); + RDK_LOG(RDK_LOG_INFO, LOG_RFCMGR, "[%s][%d] GetValidPartnerId\n", __FUNCTION__, __LINE__); GetValidPartnerId(); _is_first_request = false; } @@ -2053,7 +2110,7 @@ void RuntimeFeatureControlProcessor::GetValidPartnerId() if(value.empty()) { - RDK_LOG(RDK_LOG_ERROR, LOG_RFCMGR,"[%s][%d] Not found Parner ID\n", __FUNCTION__, __LINE__); + RDK_LOG(RDK_LOG_ERROR, LOG_RFCMGR,"[%s][%d] Not found Partner ID\n", __FUNCTION__, __LINE__); _valid_partnerId = "Unknown"; } else @@ -2146,7 +2203,7 @@ int RuntimeFeatureControlProcessor::ProcessJsonResponse(char *featureXConfMsg) { std::string rfcList; - RDK_LOG(RDK_LOG_DEBUG, LOG_RFCMGR, "[%s][%d] Xconf Response: %s\n", __FUNCTION__, __LINE__, featureXConfMsg); + RDK_LOG(RDK_LOG_INFO, LOG_RFCMGR, "[%s][%d] Xconf Response: %s\n", __FUNCTION__, __LINE__, featureXConfMsg); JSON *pJson = ParseJsonStr(featureXConfMsg); if(!pJson) @@ -2264,7 +2321,7 @@ void RuntimeFeatureControlProcessor::processXconfResponseConfigDataPart(JSON *fe if( _RFCKeyAndValueMap.empty()) { - RDK_LOG(RDK_LOG_DEBUG, LOG_RFCMGR, "[%s][%d] Config Data Map is Empty\n", __FUNCTION__, __LINE__); + RDK_LOG(RDK_LOG_ERROR, LOG_RFCMGR, "[%s][%d] Config Data Map is Empty\n", __FUNCTION__, __LINE__); return; } #if !defined(RDKB_SUPPORT) @@ -2282,7 +2339,7 @@ void RuntimeFeatureControlProcessor::processXconfResponseConfigDataPart(JSON *fe newKey = pair.first; newValue = pair.second; - RDK_LOG(RDK_LOG_DEBUG, LOG_RFCMGR, "[%s][%d] Feature Name [%s] Value[%s]\n", __FUNCTION__, __LINE__, newKey.c_str(), newValue.c_str()); + RDK_LOG(RDK_LOG_INFO, LOG_RFCMGR, "[%s][%d] Feature Name [%s] Value[%s]\n", __FUNCTION__, __LINE__, newKey.c_str(), newValue.c_str()); configChanged = isConfigValueChange(name, newKey , newValue, currentValue); if(configChanged == false) @@ -2293,8 +2350,8 @@ void RuntimeFeatureControlProcessor::processXconfResponseConfigDataPart(JSON *fe { if(newKey == BOOTSTRAP_XCONF_URL_KEY_STR) { - RDK_LOG(RDK_LOG_ERROR, LOG_RFCMGR, "[%s][%d] Feature Name [%s] Current Value[%s] New Value[%s] \n", __FUNCTION__, __LINE__, newKey.c_str(), currentValue.c_str(), newValue.c_str()); - RDK_LOG(RDK_LOG_ERROR, LOG_RFCMGR, "[%s][%d] Processing Xconf URL %s\n", __FUNCTION__, __LINE__, newValue.c_str()); + RDK_LOG(RDK_LOG_INFO, LOG_RFCMGR, "[%s][%d] Feature Name [%s] Current Value[%s] New Value[%s] \n", __FUNCTION__, __LINE__, newKey.c_str(), currentValue.c_str(), newValue.c_str()); + RDK_LOG(RDK_LOG_INFO, LOG_RFCMGR, "[%s][%d] Processing Xconf URL %s\n", __FUNCTION__, __LINE__, newValue.c_str()); if (ProcessXconfUrl(newValue.c_str()) != SUCCESS) { continue; @@ -2359,7 +2416,7 @@ void RuntimeFeatureControlProcessor::CreateConfigDataValueMap(JSON *features) pConfigData = GetJsonItem(feature,configData); if(!pConfigData) { - RDK_LOG(RDK_LOG_DEBUG, LOG_RFCMGR, "[%s][%d] Config Data not found.\n", __FUNCTION__, __LINE__); + RDK_LOG(RDK_LOG_ERROR, LOG_RFCMGR, "[%s][%d] Config Data not found.\n", __FUNCTION__, __LINE__); break; } child = pConfigData->child; @@ -2409,14 +2466,14 @@ bool RuntimeFeatureControlProcessor::isConfigValueChange(std ::string name, std { if(true == StringCaseCompare(value, unknown_str)) { - RDK_LOG(RDK_LOG_DEBUG, LOG_RFCMGR, "[%s][%d] RFC: AccountId %s is replaced with Authservice %s", __FUNCTION__, __LINE__, value.c_str(), currentValue.c_str()); + RDK_LOG(RDK_LOG_INFO, LOG_RFCMGR, "[%s][%d] RFC: AccountId %s is replaced with Authservice %s", __FUNCTION__, __LINE__, value.c_str(), currentValue.c_str()); value = currentValue; } } } else { - RDK_LOG(RDK_LOG_DEBUG, LOG_RFCMGR, "[%s][%d] For param %s new and old values are same value %s", __FUNCTION__, __LINE__, key.c_str(), currentValue.c_str()); + RDK_LOG(RDK_LOG_INFO, LOG_RFCMGR, "[%s][%d] For param %s new and old values are same value %s", __FUNCTION__, __LINE__, key.c_str(), currentValue.c_str()); return false; } } @@ -2546,7 +2603,7 @@ void RuntimeFeatureControlProcessor::updateTR181File(const std::string& filename while (!paramList.empty()) { std::string data = paramList.front(); - RDK_LOG(RDK_LOG_DEBUG, LOG_RFCMGR, "[%s][%d] Writing %s in file\n", __FUNCTION__, __LINE__, data.c_str()); + RDK_LOG(RDK_LOG_INFO, LOG_RFCMGR, "[%s][%d] Writing %s in file\n", __FUNCTION__, __LINE__, data.c_str()); outFile << data << std::endl; // Write the front element to the file paramList.pop_front(); // Remove the front element } @@ -2594,7 +2651,7 @@ void RuntimeFeatureControlProcessor::WriteFile(const std::string& filename, cons { RDK_LOG(RDK_LOG_DEBUG, LOG_RFCMGR, "[%s][%d] File Open %s\n", __FUNCTION__, __LINE__, fullPath.c_str()); outFile << data << "\n"; - RDK_LOG(RDK_LOG_DEBUG, LOG_RFCMGR, "[%s][%d] Writing %s in file\n", __FUNCTION__, __LINE__,data.c_str()); + RDK_LOG(RDK_LOG_INFO, LOG_RFCMGR, "[%s][%d] Writing %s in file\n", __FUNCTION__, __LINE__,data.c_str()); outFile.close(); RDK_LOG(RDK_LOG_DEBUG, LOG_RFCMGR, "[%s][%d] File %s written successfully\n", __FUNCTION__, __LINE__,fullPath.c_str()); } @@ -2619,9 +2676,9 @@ void RuntimeFeatureControlProcessor::writeRemoteFeatureCntrlFile(const std::stri std::string effectData = "export RFC_" + feature->name + "_effectiveImmediate=" + effectStr; outFile << enbData << "\n"; - RDK_LOG(RDK_LOG_DEBUG, LOG_RFCMGR, "[%s][%d] Writing %s in file\n", __FUNCTION__, __LINE__, enbData.c_str()); + RDK_LOG(RDK_LOG_INFO, LOG_RFCMGR, "[%s][%d] Writing %s in file\n", __FUNCTION__, __LINE__, enbData.c_str()); outFile << effectData << "\n"; - RDK_LOG(RDK_LOG_DEBUG, LOG_RFCMGR, "[%s][%d] Writing %s in file\n", __FUNCTION__, __LINE__, effectData.c_str()); + RDK_LOG(RDK_LOG_INFO, LOG_RFCMGR, "[%s][%d] Writing %s in file\n", __FUNCTION__, __LINE__, effectData.c_str()); outFile.close(); RDK_LOG(RDK_LOG_DEBUG, LOG_RFCMGR, "[%s][%d] File %s written successfully\n", __FUNCTION__, __LINE__,fullPath.c_str()); diff --git a/rfcMgr/rfc_xconf_handler.h b/rfcMgr/rfc_xconf_handler.h index 4d108c03..8289fcc8 100644 --- a/rfcMgr/rfc_xconf_handler.h +++ b/rfcMgr/rfc_xconf_handler.h @@ -133,7 +133,7 @@ class RuntimeFeatureControlProcessor : public xconf::XconfHandler std::string _osclass; bool isRebootRequired; std::string bkup_hash; - bool _is_first_request; + bool _is_first_request = false; bool _url_validation_in_progress = false; std::string rfcSelectOpt; std:: string rfcSelectorSlot; diff --git a/rfcMgr/xconf_handler.cpp b/rfcMgr/xconf_handler.cpp index 6c345a97..7d990d20 100644 --- a/rfcMgr/xconf_handler.cpp +++ b/rfcMgr/xconf_handler.cpp @@ -27,6 +27,7 @@ extern "C" { #include #include #include +#include "mtlsUtils.h" namespace xconf { @@ -46,65 +47,6 @@ int XconfHandler::ExecuteRequest(FileDwnl_t *file_dwnl, MtlsAuth_t *security, in return curl_ret_code; } -std::string getErouterMac() -{ - std::string erouterMac; - - FILE* pipe = popen("dmcli eRT retv Device.DeviceInfo.X_COMCAST-COM_WAN_MAC", "r"); - if (pipe) { - char buffer[128] = {0}; - if (fgets(buffer, sizeof(buffer), pipe) != nullptr) { - erouterMac = buffer; - // Trim trailing newline - if (!erouterMac.empty() && erouterMac.back() == '\n') { - erouterMac.pop_back(); - } - } - pclose(pipe); - } - - return erouterMac; -} - -std::string geteCMMac() -{ - std::string macAddress; - - // Array of commands to try in order - const char* commands[] = { - "dmcli eRT retv Device.DPoE.Mac_address", - "dmcli eRT retv Device.X_CISCO_COM_CableModem.MACAddress", - "dmcli eRT retv Device.DeviceInfo.X_COMCAST-COM_CM_MAC", - "dmcli eRT retv Device.DeviceInfo.X_-COM_WAN_MAC", - "sysevent get eth_wan_mac" - }; - - // Try each command until we get a valid MAC address - for (const auto& command : commands) { - FILE* pipe = popen(command, "r"); - if (pipe) { - char buffer[128] = {0}; - if (fgets(buffer, sizeof(buffer), pipe) != nullptr) { - macAddress = buffer; - // Trim trailing newline - if (!macAddress.empty() && macAddress.back() == '\n') { - macAddress.pop_back(); - } - pclose(pipe); - - // If we got a non-empty result, return it - if (!macAddress.empty()) { - break; - } - } else { - pclose(pipe); - } - } - } - - return macAddress; -} - int XconfHandler:: initializeXconfHandler() { char tmpbuf[200] = {0}; @@ -188,3 +130,4 @@ int XconfHandler:: initializeXconfHandler() #endif + diff --git a/rfcapi/rfcapi.cpp b/rfcapi/rfcapi.cpp index 5dc55096..55c47a43 100644 --- a/rfcapi/rfcapi.cpp +++ b/rfcapi/rfcapi.cpp @@ -392,7 +392,7 @@ WDMP_STATUS getRFCParameter(const char *pcCallerID, const char* pcParameterName, #ifdef TEMP_LOGGING logofs << prefix() << __FUNCTION__ << ": http server is ready" << endl; #endif - RDK_LOG (RDK_LOG_DEBUG, LOG_RFCAPI, "%s: http server is ready\n", __FUNCTION__); + RDK_LOG (RDK_LOG_INFO, LOG_RFCAPI, "%s: http server is ready\n", __FUNCTION__); tr69hostif_http_server_ready = true; } } @@ -404,7 +404,7 @@ WDMP_STATUS getRFCParameter(const char *pcCallerID, const char* pcParameterName, #ifdef TEMP_LOGGING logofs << prefix() << "getRFCParam data = " << data << " dataLen = " << data.length() << endl; #endif - RDK_LOG(RDK_LOG_DEBUG, LOG_RFCAPI,"getRFCParam data = %s, datalen = %d\n", data.c_str(), data.length()); + RDK_LOG(RDK_LOG_INFO, LOG_RFCAPI,"getRFCParam data = %s, datalen = %zu\n", data.c_str(), data.length()); if (curl_handle) { char pcCallerIDHeader[128]; @@ -451,7 +451,7 @@ WDMP_STATUS getRFCParameter(const char *pcCallerID, const char* pcParameterName, #ifdef TEMP_LOGGING logofs << prefix() << "curl response = " << res << "http response code = " << http_code << endl; #endif - RDK_LOG(RDK_LOG_DEBUG, LOG_RFCAPI,"curl response : %d http response code: %ld\n", res, http_code); + RDK_LOG(RDK_LOG_INFO, LOG_RFCAPI,"curl response : %d http response code: %ld\n", res, http_code); curl_easy_cleanup(curl_handle); curl_slist_free_all(customHeadersList); @@ -469,7 +469,7 @@ WDMP_STATUS getRFCParameter(const char *pcCallerID, const char* pcParameterName, #ifdef TEMP_LOGGING logofs << prefix() << "curl response: " << response << endl; #endif - RDK_LOG(RDK_LOG_DEBUG, LOG_RFCAPI,"Curl response: %s\n", response.c_str()); + RDK_LOG(RDK_LOG_INFO, LOG_RFCAPI,"Curl response: %s\n", response.c_str()); response_json = cJSON_Parse(response.c_str()); if (response_json) @@ -569,7 +569,7 @@ WDMP_STATUS setRFCParameter(const char *pcCallerID, const char* pcParameterName, #ifdef TEMP_LOGGING logofs << prefix() << "setRFCParam data = " << data << " dataLen = " << data.length() << endl; #endif - RDK_LOG(RDK_LOG_DEBUG, LOG_RFCAPI,"setRFCParam data = %s, datalen = %d\n", data.c_str(), data.length()); + RDK_LOG(RDK_LOG_INFO, LOG_RFCAPI,"setRFCParam data = %s, datalen = %zu\n", data.c_str(), data.length()); if (curl_handle) { @@ -611,7 +611,7 @@ WDMP_STATUS setRFCParameter(const char *pcCallerID, const char* pcParameterName, #ifdef TEMP_LOGGING logofs << prefix() << "curl response = " << res << "http response code = " << http_code << endl; #endif - RDK_LOG(RDK_LOG_DEBUG, LOG_RFCAPI,"curl response : %d http response code: %ld\n", res, http_code); + RDK_LOG(RDK_LOG_INFO, LOG_RFCAPI,"curl response : %d http response code: %ld\n", res, http_code); curl_easy_cleanup(curl_handle); curl_slist_free_all(customHeadersList); @@ -629,7 +629,7 @@ WDMP_STATUS setRFCParameter(const char *pcCallerID, const char* pcParameterName, #ifdef TEMP_LOGGING logofs << prefix() << "curl response: " << response << endl; #endif - RDK_LOG(RDK_LOG_DEBUG, LOG_RFCAPI,"Curl response: %s\n", response.c_str()); + RDK_LOG(RDK_LOG_INFO, LOG_RFCAPI,"Curl response: %s\n", response.c_str()); response_json = cJSON_Parse(response.c_str()); if (response_json) { diff --git a/tr181api/tr181api.cpp b/tr181api/tr181api.cpp index 21bf52ac..448f2e50 100644 --- a/tr181api/tr181api.cpp +++ b/tr181api/tr181api.cpp @@ -195,7 +195,7 @@ tr181ErrorCode_t getValue(const char* fileName, const char* pcParameterName, TR1 { ifs_rfcVar.close(); string value = line.substr(splitterPos+1, line.length()); - RDK_LOG(RDK_LOG_DEBUG, LOG_TR181API, "Found Key = %s : Value = %s\n", key.c_str(), value.c_str()); + RDK_LOG(RDK_LOG_INFO, LOG_TR181API, "Found Key = %s : Value = %s\n", key.c_str(), value.c_str()); if(value.length() > 0) { pstParam->type = TR181_NONE; //The caller must know what type they are expecting @@ -254,7 +254,7 @@ tr181ErrorCode_t setValue(const char* pcParameterName, const char* pcParamValue) string key = line.substr(0, splitterPos); string value = line.substr(splitterPos+1, line.length()); m_dict[key] = value; - RDK_LOG(RDK_LOG_DEBUG, LOG_TR181API, "Key = %s : Value = %s\n", key.c_str(), value.c_str()); + RDK_LOG(RDK_LOG_INFO, LOG_TR181API, "Key = %s : Value = %s\n", key.c_str(), value.c_str()); } } ifs_tr181.close();