Skip to content

Commit

Permalink
SHARMAN-2786:DHCP Lease Expire Time (ipv4) is not getting updated in …
Browse files Browse the repository at this point in the history
…GUI>Network page

Reason for change:DHCP Lease Expire Time (ipv4) is not getting updated in GUI>Network page
Test Procedure:
1.)Test DHCP v4 Remaining Lease on GUI.
Risks: Medium
Priority: P2
Signed-off-by: kulvendra singh <kulvendra.singh@sky.uk>
  • Loading branch information
kul2241 committed Oct 11, 2024
1 parent f3db8e7 commit c225d5b
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
1 change: 1 addition & 0 deletions source/TR-181/middle_layer_src/wanmgr_dml_dhcpv4.c
Original file line number Diff line number Diff line change
Expand Up @@ -633,6 +633,7 @@ Client_GetParamIntValue
PDHCPC_CONTEXT_LINK_OBJECT pCxtLink = (PDHCPC_CONTEXT_LINK_OBJECT)hInsContext;
PDML_DHCPC_FULL pDhcpc = (PDML_DHCPC_FULL)pCxtLink->hContext;

CcspTraceError(("%s-%d: ", __FUNCTION__, __LINE__));
/* check the parameter name and return the corresponding value */
if (strcmp(ParamName, "LeaseTimeRemaining") == 0)
{
Expand Down
15 changes: 15 additions & 0 deletions source/WanManager/wanmgr_dhcpv4_apis.c
Original file line number Diff line number Diff line change
Expand Up @@ -918,7 +918,12 @@ WanMgr_DmlDhcpcGetInfo
{
UNREFERENCED_PARAMETER(hContext);
ANSC_STATUS rc;
char name[BUFLEN_64] = {0};
char value[BUFLEN_64] = {0};
uint32_t up_time = 0;
uint32_t start_time = 0;

CcspTraceError(("%s-%d: ", __FUNCTION__, __LINE__));
if ( (!pInfo) || (ulInstanceNumber != 1) ){
return ANSC_STATUS_FAILURE;
}
Expand All @@ -934,8 +939,17 @@ WanMgr_DmlDhcpcGetInfo
pInfo->DNSServers[0].Value = inet_addr(p_VirtIf->IP.Ipv4Data.dnsServer);
pInfo->DNSServers[1].Value = inet_addr(p_VirtIf->IP.Ipv4Data.dnsServer1);
pInfo->DHCPStatus = (strcmp(p_VirtIf->IP.Ipv4Data.dhcpState, DHCP_STATE_UP) == 0) ? DML_DHCPC_STATUS_Bound : DML_DHCPC_STATUS_Init;

snprintf(name,sizeof(name),SYSEVENT_IPV4_START_TIME,p_VirtIf->IP.Ipv4Data.ifname);
up_time = WanManager_getUpTime();
sysevent_get(sysevent_fd, sysevent_token, name, value, sizeof(value));
start_time = atoi(value);

pInfo->LeaseTimeRemaining = p_VirtIf->IP.Ipv4Data.leaseTime - (up_time - start_time);
CcspTraceError(("%s-%d: LeaseTimeRemanig=%d, up_time=%d, start_time=%d, leaseTime=%d, name=%s ", __FUNCTION__, __LINE__, pInfo->LeaseTimeRemaining, up_time, start_time, p_VirtIf->IP.Ipv4Data.leaseTime, name));
WanMgrDml_GetIfaceData_release(NULL);
}

pInfo->NumDnsServers = 2;
pInfo->NumIPRouters = 1;
return ANSC_STATUS_SUCCESS;
Expand All @@ -951,6 +965,7 @@ WanMgr_DmlDhcpcGetInfo
PDML_DHCPC_INFO pInfo
)
{
CcspTraceError(("%s-%d: ", __FUNCTION__, __LINE__));
UNREFERENCED_PARAMETER(hContext);
ULONG i;
dhcpv4c_ip_list_t ad;
Expand Down

0 comments on commit c225d5b

Please sign in to comment.