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 17, 2024
1 parent f3db8e7 commit de1dfde
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions source/WanManager/wanmgr_dhcpv4_apis.c
Original file line number Diff line number Diff line change
Expand Up @@ -918,6 +918,10 @@ 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;

if ( (!pInfo) || (ulInstanceNumber != 1) ){
return ANSC_STATUS_FAILURE;
Expand All @@ -934,8 +938,16 @@ 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);
WanMgrDml_GetIfaceData_release(NULL);
}

pInfo->NumDnsServers = 2;
pInfo->NumIPRouters = 1;
return ANSC_STATUS_SUCCESS;
Expand Down

0 comments on commit de1dfde

Please sign in to comment.