Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
717e84b
Update device_api.c
KTirumalaSrihari Mar 9, 2026
d753b4e
Update device_api.h
KTirumalaSrihari Mar 9, 2026
307da0f
Update rfcinterface.c
KTirumalaSrihari Mar 9, 2026
f8dd2b5
Update rfcinterface.h
KTirumalaSrihari Mar 9, 2026
a8625d1
Update device_api.c
KTirumalaSrihari Mar 9, 2026
b873efd
Update rfcinterface.c
KTirumalaSrihari Mar 9, 2026
d93cf44
Apply suggestion from @Copilot
KTirumalaSrihari Mar 9, 2026
6892b69
Update rfcinterface.h
KTirumalaSrihari Mar 10, 2026
e6630e9
Update rfcinterface.c
KTirumalaSrihari Mar 10, 2026
e5a0d8c
Update rfcinterface.c
KTirumalaSrihari Mar 10, 2026
28afa5c
Update device_api.c
KTirumalaSrihari Mar 10, 2026
fd792c2
Update rfcinterface.c
KTirumalaSrihari Mar 10, 2026
b55ea06
Update rfcinterface.h
KTirumalaSrihari Mar 10, 2026
693261c
Update device_api.c
KTirumalaSrihari Mar 10, 2026
74a7538
Merge branch 'develop' into topic/RDKEMW-13335
KTirumalaSrihari Mar 10, 2026
7d12e53
Update Makefile.am
KTirumalaSrihari Mar 11, 2026
dbab68f
Update Makefile.am
KTirumalaSrihari Mar 11, 2026
dc1aa2a
Update Makefile.am
KTirumalaSrihari Mar 11, 2026
e032905
Merge branch 'develop' into topic/RDKEMW-13335
KTirumalaSrihari Mar 11, 2026
5880fbd
Update Makefile.am
KTirumalaSrihari Mar 11, 2026
ba37203
Merge branch 'develop' into topic/RDKEMW-13335
KTirumalaSrihari Mar 12, 2026
35b7bad
Update rfcinterface.h
KTirumalaSrihari Mar 12, 2026
ac064ff
Update deviceutils_mock.cpp
KTirumalaSrihari Mar 12, 2026
371e13a
Update deviceutils_mock.h
KTirumalaSrihari Mar 12, 2026
a03d197
Update rfcinterface.h
KTirumalaSrihari Mar 16, 2026
3a8ea33
Update rfcinterface.h
KTirumalaSrihari Mar 16, 2026
8f9c8d9
Update rfcinterface.h
KTirumalaSrihari Mar 16, 2026
ae1143b
Update device_api.c
KTirumalaSrihari Mar 16, 2026
ed81ff4
Update device_api.h
KTirumalaSrihari Mar 16, 2026
e2dfbcc
Potential fix for pull request finding
KTirumalaSrihari Mar 16, 2026
032a20c
Update device_api.c
KTirumalaSrihari Mar 16, 2026
89eda99
Potential fix for pull request finding
KTirumalaSrihari Mar 16, 2026
806f9d9
Potential fix for pull request finding
KTirumalaSrihari Mar 16, 2026
5762dc1
Apply suggestions from code review
KTirumalaSrihari Mar 16, 2026
53eda89
Potential fix for pull request finding
KTirumalaSrihari Mar 16, 2026
84e22d2
Apply suggestions from code review
KTirumalaSrihari Mar 16, 2026
7fd8c67
Apply suggestions from code review
KTirumalaSrihari Mar 17, 2026
1ae5164
Apply suggestions from code review
KTirumalaSrihari Mar 17, 2026
cf280e9
Update device_api.h
KTirumalaSrihari Mar 17, 2026
e4700bd
Update device_api.c
KTirumalaSrihari Mar 17, 2026
eda7376
Update device_api.h
KTirumalaSrihari Mar 17, 2026
276ad3f
Apply suggestions from code review
KTirumalaSrihari Mar 17, 2026
3084235
Potential fix for pull request finding
KTirumalaSrihari Mar 17, 2026
512e78f
Update device_api_gtest.cpp
KTirumalaSrihari Mar 17, 2026
6b3ad15
Update fwdl_interface_gtest.cpp
KTirumalaSrihari Mar 17, 2026
ef9c844
Update device_api.c
KTirumalaSrihari Mar 17, 2026
0d99df7
Update dbus_handlers_gmock.cpp
KTirumalaSrihari Mar 17, 2026
23d210f
Apply suggestions from code review
KTirumalaSrihari Mar 17, 2026
32a7398
Update device_api.c
KTirumalaSrihari Mar 17, 2026
be1e282
Potential fix for pull request finding
KTirumalaSrihari Mar 17, 2026
d292263
Apply suggestions from code review
KTirumalaSrihari Mar 17, 2026
a0ef8bd
Apply suggestions from code review
KTirumalaSrihari Mar 17, 2026
8f45560
Apply suggestions from code review
KTirumalaSrihari Mar 17, 2026
668dab3
Update device_api_gtest.cpp
KTirumalaSrihari Mar 18, 2026
e831411
Update fwdl_interface_gtest.cpp
KTirumalaSrihari Mar 18, 2026
e31c313
Update device_api_gtest.cpp
KTirumalaSrihari Mar 18, 2026
38bbb2f
Update device_api_gtest.cpp
KTirumalaSrihari Mar 18, 2026
984b7e8
Update device_api.c
KTirumalaSrihari Mar 18, 2026
97ced86
Merge branch 'develop' into topic/RDKEMW-13335
KTirumalaSrihari Mar 23, 2026
db9fa93
Merge branch 'develop' into topic/RDKEMW-13335
satya200 Mar 27, 2026
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
64 changes: 61 additions & 3 deletions src/deviceutils/device_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,65 @@

#define MAC_ADDRESS_LEN 17

/* function isSecureDbgSrvUnlocked - determines whether secure debug services may be enabled for the given build type.
* Usage: bool isSecureDbgSrvUnlocked(BUILDTYPE eBuildType)
*
* For non-prod builds, debug services are always unlocked.
*
* For ePROD builds, debug services are unlocked only when all of the following are true:
* - debug services are enabled via isDebugServicesEnabled() (RFC-controlled),
* - the LABSIGNED_ENABLED device property indicates a labsigned image, and
* - the deviceType value from RFC allows test devices (for example "test").
*
* RETURN - true if secure debug services are allowed to run for the given build type; false otherwise.
*/
bool isSecureDbgSrvUnlocked(BUILDTYPE eBuildType)
{
char deviceType[16] = {0};
bool isDebugServicesUnlocked = false;
char labsigned[8] = {0};
int ret = -1;

if ((eBuildType != ePROD) && (eBuildType != eUNKNOWN)) {
isDebugServicesUnlocked = true;
}
Comment thread
KTirumalaSrihari marked this conversation as resolved.

else if (eBuildType == ePROD)
{
bool dbgServices = isDebugServicesEnabled();
Comment thread
KTirumalaSrihari marked this conversation as resolved.
getDeviceTypeRFC(deviceType, sizeof(deviceType));
ret = getDevicePropertyData("LABSIGNED_ENABLED", labsigned, sizeof(labsigned));
Comment thread
KTirumalaSrihari marked this conversation as resolved.
Comment thread
KTirumalaSrihari marked this conversation as resolved.
Comment thread
KTirumalaSrihari marked this conversation as resolved.
if (ret == UTILS_SUCCESS)
{
if (0 == strncmp(labsigned, "true", 4))
{
if ((strcmp(deviceType, "test") == 0) && dbgServices)
{
Comment thread
KTirumalaSrihari marked this conversation as resolved.
Comment thread
KTirumalaSrihari marked this conversation as resolved.
isDebugServicesUnlocked = true;
}
else
{
SWLOG_INFO("isSecureDbgSrvUnlocked: unable to enable debug services...\n");
}
}
else
{
SWLOG_INFO("LABSIGNED_ENABLED not enabled (value: %s); debug services remain locked\n", labsigned);
}
}
else
{
SWLOG_ERROR("%s: getDevicePropertyData() for LABSIGNED_ENABLED failed\n", __FUNCTION__);
Comment thread
KTirumalaSrihari marked this conversation as resolved.
}
SWLOG_INFO("isSecureDbgSrvUnlocked: dbgServices=%s, deviceType=%s, LABSIGNED_ENABLED=%s\n", dbgServices ? "true" : "false", deviceType, labsigned);
}
if(isDebugServicesUnlocked){
SWLOG_INFO("isSecureDbgSrvUnlocked: Enabling debug services...\n");
t2ValNotify("SYST_INFO_FW_DbgSrv", "true");
}
Comment thread
satya200 marked this conversation as resolved.
return isDebugServicesUnlocked;
Comment thread
KTirumalaSrihari marked this conversation as resolved.
}
Comment thread
KTirumalaSrihari marked this conversation as resolved.

/* function GetServerUrlFile - scans a file for a URL.
Usage: size_t GetServerUrlFile <char *pServUrl> <size_t szBufSize> <char *pFileName>

Expand Down Expand Up @@ -891,15 +950,14 @@ size_t GetServURL( char *pServURL, size_t szBufSize )
BUILDTYPE eBuildType;
char buf[URL_MAX_LEN];
bool skip = false;
bool dbgServices = isDebugServicesEnabled(); //check debug services enabled

if( pServURL != NULL )
{
*pServURL = 0;
GetBuildType( buf, sizeof(buf), &eBuildType );
if( isInStateRed() )
{
if(( eBuildType != ePROD ) || ( dbgServices == true ))
if(isSecureDbgSrvUnlocked(eBuildType))
{
Comment thread
KTirumalaSrihari marked this conversation as resolved.
len = GetServerUrlFile( pServURL, szBufSize, STATE_RED_CONF );
}
Expand All @@ -910,7 +968,7 @@ size_t GetServURL( char *pServURL, size_t szBufSize )
}
else
{
if(( eBuildType != ePROD ) || ( dbgServices == true ))
if(isSecureDbgSrvUnlocked(eBuildType))
{
Comment thread
KTirumalaSrihari marked this conversation as resolved.
Comment thread
KTirumalaSrihari marked this conversation as resolved.
if( (filePresentCheck( SWUPDATE_CONF ) == RDK_API_SUCCESS) ) // if the file exists
{
Expand Down
22 changes: 22 additions & 0 deletions src/deviceutils/device_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@
#define GETRDMMANIFESTVERSION_IN_SCRIPT
#endif

#ifdef GTEST_ENABLE
#include "rdkv_cdl_log_wrapper.h"
#endif

#ifndef GTEST_ENABLE
#include "rdk_fwdl_utils.h"
#include "common_device_api.h"
Expand Down Expand Up @@ -301,4 +305,22 @@ size_t GetTR181Url(TR181URL eURL, char *pUrlOut, size_t szBufSize);
*/
size_t GetServURL(char *pServURL, size_t szBufSize);

/* function isSecureDbgSrvUnlocked - determines whether the secure debug service may be unlocked.
*
* The decision is based on:
* - DbgServices RFC
* - DeviceType RFC
* - build type (Prod vs non-Prod; e.g. ePROD vs known non-ePROD types; eUNKNOWN is
* treated as locked/Prod-like)
* - LABSIGNED_ENABLED property value from /etc/device.properties
*
* Usage: bool isSecureDbgSrvUnlocked(BUILDTYPE eBuildType)
*
* RETURN - true if:
* - the build type is non-Prod (i.e. not ePROD and not eUNKNOWN); or
* - the build type is Prod, DbgServices RFC is enabled,
* DeviceType is "test", and LABSIGNED_ENABLED is set to true;
* false otherwise (including when the build type is eUNKNOWN).
*/
bool isSecureDbgSrvUnlocked(BUILDTYPE eBuildType);
#endif
Comment thread
KTirumalaSrihari marked this conversation as resolved.
2 changes: 2 additions & 0 deletions src/include/rfcinterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ typedef struct rfcdetails {
#define RFC_FW_REBOOT_NOTIFY "Device.DeviceInfo.X_RDKCENTRAL-COM_xOpsDeviceMgmt.RPC.RebootPendingNotification"
#define RFC_FW_AUTO_EXCLUDE "Device.DeviceInfo.X_RDKCENTRAL-COM_RFC.Feature.FWUpdate.AutoExcluded.Enable"
#define RFC_DEBUGSRV "Device.DeviceInfo.X_RDKCENTRAL-COM_RFC.Identity.DbgServices.Enable"
#define RFC_DEVICETYPE "Device.DeviceInfo.X_RDKCENTRAL-COM_RFC.Identity.DeviceType"

#define RFC_XCONF_CHECK_NOW "Device.X_COMCAST-COM_Xcalibur.Client.xconfCheckNow"

Expand All @@ -98,5 +99,6 @@ int isMtlsEnabled(const char *);
int isIncremetalCDLEnable(const char *file_name);
bool isMmgbleNotifyEnabled(void);
bool isDebugServicesEnabled(void);
void getDeviceTypeRFC(char *deviceType, size_t size);

#endif /* VIDEO_RFCINTERFACE_RFCINTERFACE_H_ */
34 changes: 34 additions & 0 deletions src/rfcInterface/rfcinterface.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#include "rdk_fwdl_utils.h"
#include "system_utils.h"
#endif
#include <strings.h>

/*
* Description: Get RFC data and store inside structure.
Expand Down Expand Up @@ -308,3 +309,36 @@ bool isDebugServicesEnabled(void)
}
return status;
}


/* Description: Reads the device type RFC value and copies it into the provided buffer.
* @param deviceType Output buffer that receives the device type string ("test", "prod", or "unknown").
* @param size Size of the deviceType buffer in bytes; must be greater than 0. The string is always NUL-terminated.
* @return void. On error or unrecognized RFC value, "unknown" is written to deviceType (if size > 0).
*/
void getDeviceTypeRFC(char *deviceType, size_t size ){

Comment thread
KTirumalaSrihari marked this conversation as resolved.
if (deviceType == NULL || size == 0){
SWLOG_ERROR("%s: Invalid Arguments Passed...\n", __FUNCTION__);
return;
}

const char* type = "unknown";
char rfc_data[RFC_VALUE_BUF_SIZE] = {0};
int ret = read_RFCProperty("DEVICETYPE", RFC_DEVICETYPE, rfc_data, sizeof(rfc_data));

if (ret == -1) {
SWLOG_ERROR("%s: Failed to read device type\n", __FUNCTION__);
}

SWLOG_INFO("%s: RFC device type = %s\n", __FUNCTION__, rfc_data);

if (strncasecmp(rfc_data, "prod", 4) == 0) {
type = "prod";
} else if (strncasecmp(rfc_data, "test", 4) == 0) {
type = "test";
Comment thread
KTirumalaSrihari marked this conversation as resolved.
Comment thread
KTirumalaSrihari marked this conversation as resolved.
Comment thread
KTirumalaSrihari marked this conversation as resolved.
Comment thread
KTirumalaSrihari marked this conversation as resolved.
Comment thread
KTirumalaSrihari marked this conversation as resolved.
}
Comment thread
KTirumalaSrihari marked this conversation as resolved.

strncpy(deviceType, type, size - 1);
deviceType[size - 1] = '\0';
}
Loading
Loading