Skip to content
Open
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
1 change: 1 addition & 0 deletions rfcMgr/rfc_mgr_key.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
#define RFC_MTLS_KEY_STR "Device.DeviceInfo.X_RDKCENTRAL-COM_RFC.Feature.MTLS.mTlsXConfDownload.Enable"

#define TELEMETRY_CONFIG_URL "Device.DeviceInfo.X_RDKCENTRAL-COM_RFC.Feature.Telemetry.ConfigURL"
#define RFC_DEVICE_TYPE_KEY "Device.DeviceInfo.X_RDKCENTRAL-COM_RFC.Identity.DeviceType"
#define XCONF_SELECTOR_NAME "XconfSelector"
Comment on lines 41 to 43
#define XCONF_URL_TR181_NAME "XconfUrl"

Expand Down
47 changes: 46 additions & 1 deletion rfcMgr/rfc_xconf_handler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2563,7 +2563,52 @@ void RuntimeFeatureControlProcessor::processXconfResponseConfigDataPart(JSON *fe
RDK_LOG(RDK_LOG_INFO, LOG_RFCMGR, "[%s:%d] Invalid Telemetry Config URL.\n", __FUNCTION__, __LINE__);
}
}
std::string account_key_str = RFC_ACCOUNT_ID_KEY_STR;
if (_ebuild_type == ePROD) {
if(newKey == RFC_DEVICE_TYPE_KEY)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check if this validation & restart can be moved somewhere else in CPC.

{
RDK_LOG(RDK_LOG_INFO, LOG_RFCMGR, "[%s:%d] DeviceType changed to '%s', checking dropbear -f state\n", __FUNCTION__, __LINE__, newValue.c_str());

Comment on lines +2566 to +2570
/* Check if dropbear is currently running with -f */
bool dropbearHasF = false;
FILE *checkFp = v_secure_popen("r", "ps w 2>/dev/null | grep '[d]ropbear'");
if (checkFp)
{
char checkBuf[512] = {0};
while (fgets(checkBuf, sizeof(checkBuf) - 1, checkFp))
{
if (strstr(checkBuf, " -f"))
{
dropbearHasF = true;
}
}
v_secure_pclose(checkFp);
}

if (newValue == "TEST" && !dropbearHasF)
{
RDK_LOG(RDK_LOG_INFO, LOG_RFCMGR, "[%s:%d] DeviceType=TEST, restarting dropbear with -f\n", __FUNCTION__, __LINE__);
int svcRet = v_secure_system("systemctl restart dropbear.service");
if (svcRet != 0)
{
RDK_LOG(RDK_LOG_ERROR, LOG_RFCMGR, "[%s:%d] Failed to restart dropbear.service, rc=%d\n", __FUNCTION__, __LINE__, svcRet);
}
}
else if (newValue == "PROD" && dropbearHasF)
{
RDK_LOG(RDK_LOG_INFO, LOG_RFCMGR, "[%s:%d] DeviceType=PROD, restarting dropbear without -f\n", __FUNCTION__, __LINE__);
int svcRet = v_secure_system("systemctl restart dropbear.service");
if (svcRet != 0)
{
RDK_LOG(RDK_LOG_ERROR, LOG_RFCMGR, "[%s:%d] Failed to restart dropbear.service, rc=%d\n", __FUNCTION__, __LINE__, svcRet);
}
}
else
{
RDK_LOG(RDK_LOG_INFO, LOG_RFCMGR, "[%s:%d] dropbear already in correct state for DeviceType=%s\n", __FUNCTION__, __LINE__, newValue.c_str());
}
}
}
std::string account_key_str = RFC_ACCOUNT_ID_KEY_STR;
bool isAccountKey = (newKey.find(account_key_str) != std::string::npos) ? true : false;
if(isAccountKey == true)
{
Expand Down
Loading