Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 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
4684824
RDKB-60325 : notify_tunnel_status failure in hotspot
rajkamal-cv Jan 12, 2026
4828add
RDKB-60325 : notify_tunnel_status failure in hotspot
rajkamal-cv Jan 12, 2026
87dcfcd
Revert "RDKB-60325 : notify_tunnel_status failure in hotspot"
rajkamal-cv Jan 14, 2026
7176717
RDKB-60325 : notify_tunnel_status failure in hotspot
rajkamal-cv Jan 14, 2026
d1e6084
Merge branch 'develop' into bug/RDKB-60325
apattu200 Jan 20, 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
5 changes: 2 additions & 3 deletions source/hotspotfd/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,13 @@ AM_CFLAGS += -I$(top_srcdir)/source/include
AM_CFLAGS += -I$(top_srcdir)/source/util
AM_CFLAGS += -I$(top_srcdir)/source/hotspotfd/include
AM_CFLAGS += -I$(top_srcdir)/source/HotspotApi
AM_CFLAGS += -I${PKG_CONFIG_SYSROOT_DIR}$(includedir)/rbus

AM_LDFLAGS = -lpthread -lz -lsysevent -lsyscfg -lulog -llmapi -lnetfilter_queue -lnfnetlink -lccsp_common -ltelemetry_msgsender -lsecure_wrapper -lprivilege
AM_LDFLAGS = -lpthread -lz -lsysevent -lsyscfg -lulog -llmapi -lnetfilter_queue -lnfnetlink -lccsp_common -ltelemetry_msgsender -lsecure_wrapper -lprivilege -lrbus

CcspHotspot_SOURCES = hotspotfd.c dhcpsnooper.c ssp_messagebus_interface.c ssp_main.c ssp_action.c cosa_hotspot_dml.c plugin_main.c dm_pack_datamodel.c

if FEATURE_WAN_FAIL_OVER
AM_CFLAGS += -I${PKG_CONFIG_SYSROOT_DIR}$(includedir)/rbus
AM_CFLAGS += -DWAN_FAILOVER_SUPPORTED
AM_LDFLAGS += -lrbus
endif
CcspHotspot_LDADD = ${top_builddir}/source/HotspotApi/libHotspotApi.la
175 changes: 102 additions & 73 deletions source/hotspotfd/hotspotfd.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,7 @@
#include "ansc_platform.h"
#include "libHotspot.h"
#include "libHotspotApi.h"
#ifdef WAN_FAILOVER_SUPPORTED
#include <rbus.h>
#endif

#ifdef __HAVE_SYSEVENT_STARTUP_PARAMS__
#include <sysevent/sysevent.h>
Expand Down Expand Up @@ -190,11 +188,13 @@ STATIC char old_wan_ipv6[kMax_IPAddressLength];
extern int hotspot_wan_failover(bool isRemoteWANEnabled);
extern int PsmGet(const char *param, char *value, int size);
STATIC pthread_t rbus_tid;
rbusHandle_t handle;
#endif
rbusHandle_t handle;

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 +308,106 @@ HotspotfdType Get_HotspotfdType(char * name)
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;
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 = (parameterValStruct_t*)malloc(sizeof(parameterValStruct_t));
if (NULL == param_val)
rbusValue_Release(value);
rbusObject_Release(data);

if(strcmp("Down",status) == 0)
{
CcspTraceError(("Memory allocation failed in hotspot \n"));
return FALSE;
gVapIsUp = false;
}
else if(strcmp("Up",status) == 0)
{
gVapIsUp = true;
}
}

param_val->parameterName = (char*)tunparam;
param_val->parameterValue=AnscCloneString(status);
CcspTraceInfo(("Setting tunnel status to %s\n", status));
param_val->type = ccsp_string;
rbusError_t TunnelStatus_EventSubHandler(rbusHandle_t handle, rbusEventSubAction_t action, const char* eventName,
rbusFilter_t filter, int32_t interval, bool* autoPublish)
{
(void)handle;
(void)filter;
(void)interval;

ret = CcspBaseIf_setParameterValues(
bus_handle,
component,
dstPath,
0,
0,
param_val,
1,
TRUE,
&faultParam
);
CcspTraceInfo(("%d: %s %s\n", __LINE__, eventName,
action == RBUS_EVENT_ACTION_SUBSCRIBE ? "subscribed" : "unsubscribed"));

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;
}
if(param_val)
{
free(param_val);
param_val = NULL;
}
return TRUE;
*autoPublish = false;
return RBUS_ERROR_SUCCESS;
}

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 @@ -1961,9 +1983,7 @@ STATIC void HotspotTunnelEventHandler(
}
}
}
#endif

#ifdef WAN_FAILOVER_SUPPORTED
void *handle_rbusSubscribe() {
int ret = 0;
bool retry_again = true;
Expand Down Expand Up @@ -2045,18 +2065,27 @@ void hotspot_start()
v_secure_system("touch /tmp/hotspotfd_up");
hotspotfd_log();

#ifdef WAN_FAILOVER_SUPPORTED

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, TunnelStatus_EventSubHandler, NULL}}
};
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"));
}
#ifdef WAN_FAILOVER_SUPPORTED
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
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