Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
7804834
RDKB-60325 : notify_tunnel_status failure in hotspot
supriya-shree1 Aug 12, 2025
158bc44
RDKB-60325 : notify_tunnel_status failure in hotspot
supriya-shree1 Aug 21, 2025
a04d5b3
RDKB-60325 : notify_tunnel_status failure in hotspot
supriya-shree1 Aug 22, 2025
4d97df7
RDKB-60325 : notify_tunnel_status failure in hotspot
supriya-shree1 Aug 22, 2025
d570fe3
RDKB-60325 : notify_tunnel_status failure in hotspot
supriya-shree1 Aug 25, 2025
abd3116
RDKB-60325 : notify_tunnel_status failure in hotspot
supriya-shree1 Aug 26, 2025
cf467f9
RDKB-60325 : notify_tunnel_status failure in hotspot
supriya-shree1 Aug 26, 2025
181ebd8
RDKB-60325 : notify_tunnel_status failure in hotspot
supriya-shree1 Aug 27, 2025
61731d5
RDKB-60325 : notify_tunnel_status failure in hotspot
supriya-shree1 Aug 27, 2025
2e2692a
RDKB-60325 : notify_tunnel_status failure in hotspot
supriya-shree1 Aug 27, 2025
7815fd8
RDKB-60325 : notify_tunnel_status failure in hotspot
supriya-shree1 Aug 28, 2025
365fada
RDKB-60325 : notify_tunnel_status failure in hotspot
supriya-shree1 Aug 29, 2025
9e0eac4
RDKB-60325 : notify_tunnel_status failure in hotspot
supriya-shree1 Aug 29, 2025
56e852c
RDKB-60325 : notify_tunnel_status failure in hotspot
supriya-shree1 Sep 2, 2025
de9ec24
RDKB-60325 : notify_tunnel_status failure in hotspot
supriya-shree1 Sep 2, 2025
26bfbe0
RDKB-60325 : notify_tunnel_status failure in hotspot
supriya-shree1 Sep 2, 2025
15da7bf
RDKB-60325 : notify_tunnel_status failure in hotspot
sowmiyachelliah Nov 28, 2025
aabc40f
RDKB-60325 : notify_tunnel_status failure in hotspot
supriya-shree1 Nov 13, 2025
2c504b6
RDKB-60325 : notify_tunnel_status failure in hotspot
supriya-shree1 Nov 18, 2025
d70236f
RDKB-60325 : notify_tunnel_status failure in hotspot
supriya-shree1 Nov 21, 2025
df2800f
RDKB-60325 : notify_tunnel_status failure in hotspot
supriya-shree1 Dec 15, 2025
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
156 changes: 88 additions & 68 deletions source/hotspotfd/hotspotfd.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* If not stated otherwise in this file or this component's Licenses.txt file the

Check failure on line 2 in source/hotspotfd/hotspotfd.c

View workflow job for this annotation

GitHub Actions / call-fossid-workflow / Fossid Annotate PR

FossID License Issue Detected

Source code with 'ISC' license found in local file 'source/hotspotfd/hotspotfd.c' (Match: rdkb/components/opensource/ccsp/hotspot/rdkb/components/opensource/ccsp/hotspot/1, 2412 lines, url: https://code.rdkcentral.com/r/plugins/gitiles/rdkb/components/opensource/ccsp/hotspot/+archive/RDKB-TEST-RELEASE-1.tar.gz, file: source/hotspotfd/hotspotfd.c)

Check failure on line 2 in source/hotspotfd/hotspotfd.c

View workflow job for this annotation

GitHub Actions / call-fossid-workflow / Fossid Annotate PR

FossID License Issue Detected

Source code with 'ISC' license found in local file 'source/hotspotfd/hotspotfd.c' (Match: rdkb/components/opensource/ccsp/hotspot/rdkb/components/opensource/ccsp/hotspot/1, 2412 lines, url: https://code.rdkcentral.com/r/plugins/gitiles/rdkb/components/opensource/ccsp/hotspot/+archive/RDKB-RELEASE-TEST-DUNFELL-1.tar.gz, file: source/hotspotfd/hotspotfd.c)

Check failure on line 2 in source/hotspotfd/hotspotfd.c

View workflow job for this annotation

GitHub Actions / call-fossid-workflow / Fossid Annotate PR

FossID License Issue Detected

Source code with 'ISC' license found in local file 'source/hotspotfd/hotspotfd.c' (Match: rdkb/components/opensource/ccsp/hotspot/rdkb/components/opensource/ccsp/hotspot/2102, 2412 lines, url: https://code.rdkcentral.com/r/plugins/gitiles/rdkb/components/opensource/ccsp/hotspot/+archive/rdk-dev-2102.tar.gz, file: source/hotspotfd/hotspotfd.c)
* following copyright and licenses apply:
*
* Copyright 2015 RDK Management
Expand Down Expand Up @@ -195,6 +195,8 @@

STATIC pthread_t dhcp_snooper_tid;

char TunnelStatus[8] = {0};

int gSnoopNumberOfClients = 0; //shared variable across hotspotfd and dhcp_snooperd

bool gSnoopEnable = true;
Expand Down Expand Up @@ -308,84 +310,92 @@
return HOTSPOTFD_ERROR;
}

STATIC bool set_tunnelstatus(char* status) {

CCSP_MESSAGE_BUS_INFO *bus_info = (CCSP_MESSAGE_BUS_INFO *)bus_handle;
parameterValStruct_t *param_val = NULL;
char component[256] = "eRT.com.cisco.spvtg.ccsp.pam";
char dstPath[64]="/com/cisco/spvtg/ccsp/pam";
const char tunparam[]="Device.X_COMCAST-COM_GRE.Tunnel.1.TunnelStatus";
char* faultParam = NULL;
int ret = 0;

param_val = (parameterValStruct_t*)malloc(sizeof(parameterValStruct_t));
if (NULL == param_val)
{
CcspTraceError(("Memory allocation failed in hotspot \n"));
return FALSE;
STATIC void notify_tunnel_status(char *status)
{
rbusEvent_t event;
rbusObject_t data;
rbusValue_t value;
rbusError_t ret;

strncpy(TunnelStatus, status, sizeof(TunnelStatus) - 1);
TunnelStatus[sizeof(TunnelStatus) - 1] = '\0';
CcspTraceInfo(("%s:%d : TunnelStatus set to %s\n", __FUNCTION__, __LINE__, TunnelStatus));

rbusValue_Init(&value);
rbusValue_SetString(value, status);
rbusObject_Init(&data, NULL);
rbusObject_SetValue(data, "TunnelStatus", value);

event.name = "Device.X_COMCAST-COM_GRE.Tunnel.1.TunnelStatus";
event.type = RBUS_EVENT_GENERAL;
event.data = data;

ret = rbusEvent_Publish(handle, &event);

if(ret != RBUS_ERROR_SUCCESS) {
CcspTraceError(("%s:%d : rbusEvent_Publish failed: %d\n", __FUNCTION__, __LINE__, ret));
}
else {
CcspTraceInfo(("%s:%d : rbusEvent_Publish success\n", __FUNCTION__, __LINE__));
}

param_val->parameterName = (char*)tunparam;
param_val->parameterValue=AnscCloneString(status);
CcspTraceInfo(("Setting tunnel status to %s\n", status));
param_val->type = ccsp_string;

ret = CcspBaseIf_setParameterValues(
bus_handle,
component,
dstPath,
0,
0,
param_val,
1,
TRUE,
&faultParam
);

if( ( ret != CCSP_SUCCESS ) && ( faultParam!=NULL )) {
CcspTraceError(("TunnelStatus set bus failed\n"));
bus_info->freefunc( faultParam );
if(param_val)
{
free(param_val);
param_val = NULL;
}
return FALSE;
rbusValue_Release(value);
rbusObject_Release(data);

if(strcmp("Down",status) == 0)
{
gVapIsUp = false;
}
if(param_val)
else if(strcmp("Up",status) == 0)
{
free(param_val);
param_val = NULL;
gVapIsUp = true;
}
return TRUE;
}

STATIC void notify_tunnel_status(char *status)
rbusError_t TunnelStatus_GetStringHandler(rbusHandle_t handle, rbusProperty_t property, rbusGetHandlerOptions_t* opts)
{
(void)handle;
(void)opts;

//set value
rbusValue_t val;
rbusValue_Init(&val);
rbusValue_SetString(val, TunnelStatus);
rbusProperty_SetValue(property, val);
rbusValue_Release(val);

return RBUS_ERROR_SUCCESS;
}

rbusError_t TunnelStatus_SetStringHandler(rbusHandle_t handle, rbusProperty_t property, rbusSetHandlerOptions_t* opts)
{
int ret;
if(set_tunnelstatus(status))
(void)handle;
(void)opts;

int ret = RBUS_ERROR_SUCCESS;

rbusValue_t value = rbusProperty_GetValue(property);
const char* newStatus = rbusValue_GetString(value, NULL);

if(newStatus && (strcmp(newStatus, "Up") == 0 || strcmp(newStatus, "Down") == 0))
{
CcspTraceInfo(("TunnelStatus set to %s in TR181\n", status));
if(strcmp(TunnelStatus, newStatus) != 0){

CcspTraceInfo(("%s:%d : Calling notify_tunnel_status with %s\n", __FUNCTION__, __LINE__, newStatus));

notify_tunnel_status((char *)newStatus);
}
else{
CcspTraceInfo(("%s:%d : TunnelStatus is already %s, no change\n", __FUNCTION__, __LINE__, TunnelStatus));
}
}
else
{
CcspTraceError(("Error setting TunnelStatus in TR181 Data Model\n"));
}
ret = CcspBaseIf_SendSignal_WithData(bus_handle,
"Device.X_COMCAST-COM_GRE.Tunnel.1.TunnelStatus", status);
if ( ret != CCSP_SUCCESS )
{
CcspTraceError(("%s : TunnelStatus send rbus data failed, ret value is %d\n",
__FUNCTION__ ,ret));
}
if(strcmp("Down",status) == 0)
{
gVapIsUp = false;
}
else if(strcmp("Up",status) == 0)
{
gVapIsUp = true;
CcspTraceError(("%s:%d : Invalid TunnelStatus value: %s\n", __FUNCTION__, __LINE__, newStatus ? newStatus : "NULL"));
ret = RBUS_ERROR_INVALID_INPUT;
}

return ret;
}

STATIC bool set_validatessid() {
Expand Down Expand Up @@ -2046,17 +2056,27 @@
hotspotfd_log();

#ifdef WAN_FAILOVER_SUPPORTED
Copy link
Contributor

@apattu200 apattu200 Dec 30, 2025

Choose a reason for hiding this comment

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

Device.X_COMCAST-COM_GRE.Tunnel.1.TunnelStatus , since it is under WAN_FAILOVER_SUPPORTED, hotspot behavior during down/up will break in CBR which doesn't have this CFLAG

Copy link
Contributor

Choose a reason for hiding this comment

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

This code change is expected to address the issue - 7176717

With code change ensured the Gerrit verification build passed for all devices - https://gerrit.teamccp.com/#/c/943504/


rbusDataElement_t dataElements[1] = {
{"Device.X_COMCAST-COM_GRE.Tunnel.1.TunnelStatus", RBUS_ELEMENT_TYPE_EVENT | RBUS_ELEMENT_TYPE_PROPERTY, {TunnelStatus_GetStringHandler, TunnelStatus_SetStringHandler, NULL, NULL, NULL, NULL}}
Copy link
Contributor

@apattu200 apattu200 Dec 30, 2025

Choose a reason for hiding this comment

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

Can you please confirm, rbus is not polling for ValueChange when someone subscribes for this parameter. since we have explicit publish this may not be needed.
In rbus code, i could see when element type is not property it won't go for autopublish, but want to double confirm

Otherwise we may need to have explicit subscribe handler with autoPublish setting to false

Copy link
Contributor

Choose a reason for hiding this comment

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

This code change is expected to address the issue - 4684824

A separate subscribe handler with autoPublish setting to false is implemented here

};
ret = rbus_open(&handle, "HotspotTunnelEvent");
if(ret != RBUS_ERROR_SUCCESS)
{
CcspTraceError(("HotspotTunnelEvent : rbus_open failed: %d\n", ret));
return;
}
ret = rbus_regDataElements(handle, 1, dataElements);
if(ret != RBUS_ERROR_SUCCESS)
{
CcspTraceError(("Device.X_COMCAST-COM_GRE.Tunnel.1.TunnelStatus rbus_regDataElements failed: %d\n", ret));
return;
}
else{
CcspTraceInfo(("Device.X_COMCAST-COM_GRE.Tunnel.1.TunnelStatus is registered in rbus"));
}
pthread_create(&rbus_tid, NULL, handle_rbusSubscribe, NULL);

#endif

if (sysevent_set(sysevent_fd_gs, sysevent_token_gs, kHotspotfd_tunnelEP, kDefault_DummyEP, 0))
{
CcspTraceError(("sysevent set %s failed for %s\n", kHotspotfd_tunnelEP, kDefault_DummyEP));
Expand Down Expand Up @@ -2406,4 +2426,4 @@
}

goto keep_it_alive;
}
}
3 changes: 2 additions & 1 deletion source/hotspotfd/include/hotspotfd.h
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,8 @@ bool deleteSharedMem(int key, bool snooper);
void hotspot_start();

#ifdef UNIT_TEST_DOCKER_SUPPORT
bool set_tunnelstatus(char* status);
rbusError_t TunnelStatus_GetStringHandler(rbusHandle_t handle, rbusProperty_t property, rbusGetHandlerOptions_t* opts);
rbusError_t TunnelStatus_SetStringHandler(rbusHandle_t handle, rbusProperty_t property, rbusSetHandlerOptions_t* opts);
void notify_tunnel_status(char *status);
bool set_validatessid();
bool get_validate_ssid();
Expand Down
Loading
Loading