Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
30 changes: 30 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -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)]),
Expand Down Expand Up @@ -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)]),
[
Expand Down
16 changes: 16 additions & 0 deletions rfcMgr/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -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
44 changes: 35 additions & 9 deletions rfcMgr/mtlsUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@

#include "mtlsUtils.h"
#include "rfc_common.h"
#ifdef LIBRDKCONFIG_BUILD
#include "rdkconfig.h"
#endif

#ifdef __cplusplus
extern "C" {
Expand Down Expand Up @@ -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
22 changes: 21 additions & 1 deletion rfcMgr/mtlsUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,32 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <string>

#ifdef __cplusplus
extern "C" {
#endif
#include <system_utils.h>
#include <urlHelper.h>
#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"

Expand All @@ -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
}
Expand Down
24 changes: 12 additions & 12 deletions rfcMgr/rfc_common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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__);
}
}

Expand All @@ -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;
}

Expand All @@ -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) {
Expand All @@ -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);
Expand All @@ -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);
Expand Down Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions rfcMgr/rfc_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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();

Expand Down
Loading