Skip to content

Commit

Permalink
RDKB-57269 : MAPT handling when only IANA renewed.
Browse files Browse the repository at this point in the history
Fixing ipv4 DNS teardown when MAPT configured.(Comcast)
Fixing Ipv4 lease time (webui)

Signed-off-by: Parthiban Selvaraj <[email protected]>
  • Loading branch information
S-Parthiban-Selvaraj committed Oct 18, 2024
1 parent 9384b5a commit 90628c0
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 12 deletions.
3 changes: 2 additions & 1 deletion source/TR-181/include/wanmgr_dml.h
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,7 @@ typedef struct _WANMGR_IPV4_DATA
char dnsServer[BUFLEN_64]; /** New dns Server, if addressAssigned==TRUE */
char dnsServer1[BUFLEN_64]; /** New dns Server, if addressAssigned==TRUE */
uint32_t mtuSize; /** New MTU size, if mtuAssigned==TRUE */
uint32_t leaseReceivedTime; /** Lease received time*/
#if defined(FEATURE_RDKB_CONFIGURABLE_WAN_INTERFACE)
int32_t timeOffset; /** New time offset, if addressAssigned==TRUE */
bool isTimeOffsetAssigned; /** Is the time offset assigned ? */
Expand All @@ -312,7 +313,7 @@ typedef struct _WANMGR_IPV4_DATA
uint32_t downstreamCurrRate; /** Downstream rate */
char dhcpServerId[BUFLEN_64]; /** Dhcp server id */
char dhcpState[BUFLEN_64]; /** Dhcp state. */
uint32_t leaseTime; /** Lease time, , if addressAssigned==TRUE */
uint32_t leaseTime; /** Lease time */
#endif
} WANMGR_IPV4_DATA;

Expand Down
3 changes: 2 additions & 1 deletion source/WanManager/wanmgr_dhcpv4_apis.c
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ ANSC_STATUS wanmgr_handle_dhcpv4_event_data(DML_VIRTUAL_IFACE* pVirtIf)

// update current IPv4 data
wanmgr_dchpv4_get_ipc_msg_info(&(pVirtIf->IP.Ipv4Data), pDhcpcInfo);

pVirtIf->IP.Ipv4Data.leaseReceivedTime = up_time;
/* Assign the address to the inetrface when received. Remaining configurations are updated when activated from VISM*/
CcspTraceInfo(("%s %d - Received Ipv4 lease for interface %s. Configuring address on interface\n", __FUNCTION__, __LINE__, pVirtIf->IP.Ipv4Data.ifname));
/** Setup IPv4: such as
Expand Down Expand Up @@ -940,6 +940,7 @@ 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;
pInfo->LeaseTimeRemaining = (p_VirtIf->IP.Ipv4Data.leaseReceivedTime + p_VirtIf->IP.Ipv4Data.leaseTime) - WanManager_getUpTime();
WanMgrDml_GetIfaceData_release(NULL);
}
pInfo->NumDnsServers = 2;
Expand Down
6 changes: 6 additions & 0 deletions source/WanManager/wanmgr_dhcpv6_apis.c
Original file line number Diff line number Diff line change
Expand Up @@ -1686,6 +1686,12 @@ ANSC_STATUS wanmgr_handle_dhcpv6_event_data(DML_VIRTUAL_IFACE * pVirtIf)
strncpy(Ipv6DataNew.pdIfAddress, pDhcp6cInfoCur->pdIfAddress, sizeof(Ipv6DataNew.pdIfAddress));
pNewIpcMsg->prefixAssigned = true;
Ipv6DataNew.prefixAssigned = true;
#ifdef FEATURE_MAPT
//get MAP-T previous data
CcspTraceWarning(("%s %d Using previous MAPT configuration\n", __FUNCTION__, __LINE__));
memcpy(&(pNewIpcMsg->mapt), &(pVirtIf->MAP.dhcp6cMAPTparameters), sizeof(ipc_mapt_data_t));
pNewIpcMsg->maptAssigned = (pVirtIf->MAP.MaptStatus == WAN_IFACE_MAPT_STATE_UP);
#endif
}

#else
Expand Down
22 changes: 12 additions & 10 deletions source/WanManager/wanmgr_interface_sm.c
Original file line number Diff line number Diff line change
Expand Up @@ -1231,21 +1231,12 @@ static int wan_tearDownIPv4(WanMgr_IfaceSM_Controller_t * pWanIfaceCtrl)
}
#endif

/*TODO:
*Should be removed once MAPT Unified. After PandM Added V4 default route, it got deleted here.
*/
#if defined(FEATURE_SUPPORT_MAPT_NAT46)
if (p_VirtIf->EnableMAPT == FALSE)
{
#endif
if (WanManager_DelDefaultGatewayRoute(DeviceNwMode, pWanIfaceCtrl->DeviceNwModeChanged, &p_VirtIf->IP.Ipv4Data) != RETURN_OK)
{
CcspTraceError(("%s %d - Failed to Del default system gateway", __FUNCTION__, __LINE__));
ret = RETURN_ERR;
}
#if defined(FEATURE_SUPPORT_MAPT_NAT46)
}
#endif

/* ReSet the required sysevents. */
sysevent_set(sysevent_fd, sysevent_token, SYSEVENT_IPV4_CONNECTION_STATE, WAN_STATUS_DOWN, 0);
sysevent_set(sysevent_fd, sysevent_token, SYSEVENT_CURRENT_IPV4_LINK_STATE, WAN_STATUS_DOWN, 0);
Expand Down Expand Up @@ -2645,6 +2636,17 @@ static eWanState_t wan_transition_mapt_up(WanMgr_IfaceSM_Controller_t* pWanIface
{
wan_transition_ipv4_down(pWanIfaceCtrl);

/** Reset IPv4 DNS configuration. This call is to make sure IPv4 DNS is removed. **/
if (wan_updateDNS(pWanIfaceCtrl, FALSE, TRUE) != RETURN_OK)
{
CcspTraceError(("%s %d - Failed to configure IPv6 DNS servers \n", __FUNCTION__, __LINE__));
ret = RETURN_ERR;
}
else
{
CcspTraceInfo(("%s %d - IPv6 DNS servers configured successfully \n", __FUNCTION__, __LINE__));
}

#if defined(FEATURE_MAPT)
#if defined(IVI_KERNEL_SUPPORT)
snprintf(cmdEnableIpv4Traffic,sizeof(cmdEnableIpv4Traffic),"ip ro rep default dev %s", p_VirtIf->Name);
Expand Down

0 comments on commit 90628c0

Please sign in to comment.