Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
81 commits
Select commit Hold shift + click to select a range
8a6345d
XYZ-999 : ConfigurableWanName for XB
S-Parthiban-Selvaraj Jul 16, 2024
03d4221
Adding WanManager version log
S-Parthiban-Selvaraj Jul 16, 2024
7c64ad1
Adding WanManager Version log
S-Parthiban-Selvaraj Jul 17, 2024
f3dd4d8
Merge branch 'main' into configurable_wan_interface_for_XB
S-Parthiban-Selvaraj Jul 22, 2024
d072a94
Handling IPv6 IANA and IAPD separately
S-Parthiban-Selvaraj Jul 30, 2024
9b1e269
Merge branch 'main' into configurable_wan_interface_for_XB
S-Parthiban-Selvaraj Jul 30, 2024
c124798
Workaround to fix Force toggle
S-Parthiban-Selvaraj Jul 31, 2024
3a84b22
Adding funtions for Router solicit and parsing RA
S-Parthiban-Selvaraj Aug 2, 2024
62c630b
RS RA funtions clean up
S-Parthiban-Selvaraj Aug 2, 2024
b8aea40
Replace toggle funtion with send RS function
S-Parthiban-Selvaraj Aug 2, 2024
1e13651
Adding variables to store the default route value.
S-Parthiban-Selvaraj Aug 7, 2024
0e0ba2d
Fix ipv6 toggle calling
S-Parthiban-Selvaraj Aug 8, 2024
f0bd16d
Fixing lan prefix sysvent and LAN_MANAGER build flag
S-Parthiban-Selvaraj Aug 12, 2024
f45f83c
Fix for LAN manager stateful server restart
S-Parthiban-Selvaraj Aug 13, 2024
dd2db9c
Fixing build error for sky and cleanup
S-Parthiban-Selvaraj Aug 14, 2024
ff18e4b
Code clean up
S-Parthiban-Selvaraj Aug 14, 2024
6dd2568
Moving default route to a new struct independent of DHCPv6 data
S-Parthiban-Selvaraj Aug 15, 2024
7f06a7c
replacing RS and RA funtion with rdisc6 utility
S-Parthiban-Selvaraj Aug 15, 2024
7828845
removing checkIpv6AddressAssignedToBridge function
S-Parthiban-Selvaraj Aug 15, 2024
a176136
Merge branch 'main' into configurable_wan_interface_for_XB
S-Parthiban-Selvaraj Aug 19, 2024
5c6acd8
Cleaning up RestartV6Client workaround created for restarting Ipv6 cl…
S-Parthiban-Selvaraj Aug 19, 2024
bf284f6
Fixing Connectivity check restart in standby mode
S-Parthiban-Selvaraj Aug 19, 2024
2ab8724
Fixing duplicate registrtion of the remote virtual interface to rbus.
S-Parthiban-Selvaraj Aug 29, 2024
8bb4369
Merge branch 'main' into configurable_wan_interface_for_XB
S-Parthiban-Selvaraj Oct 2, 2024
f55d1b5
Fixing IPv6 default route teardoen for Comcast Xfinity devices.
S-Parthiban-Selvaraj Oct 9, 2024
d312132
Fixing Virtual interface status if MAP fails( SKY requirement)
S-Parthiban-Selvaraj Oct 10, 2024
2645592
RDKB-57266 : Workaround to retrieve the correct interface with an act…
S-Parthiban-Selvaraj Oct 15, 2024
08d79e1
RDKB-57269 : Cleaning MAPT workaround added in WanUnification task
S-Parthiban-Selvaraj Oct 15, 2024
0802ac5
RDKB-57266 : Fixing IP.Interface Lowerlayer dml for Comcast devices
S-Parthiban-Selvaraj Oct 15, 2024
ab841a4
Merge branch 'main' into feature-MAPT-Unification
S-Parthiban-Selvaraj Oct 17, 2024
9384b5a
Virtual interface name DML set clean up
S-Parthiban-Selvaraj Oct 17, 2024
dcc4531
RDKB-57269 : MAPT handling when only IANA renewed.
S-Parthiban-Selvaraj Oct 18, 2024
842125d
RDKB-57269 : Handling IPv4 DNS teardown for comcast builds.
S-Parthiban-Selvaraj Oct 21, 2024
e9d4743
RDKB-57269 : Move MAPT parsing APIs to WanManager
S-Parthiban-Selvaraj Oct 22, 2024
c7c4892
RDKB-57269 : MAPT APIs file cleanup.
S-Parthiban-Selvaraj Oct 22, 2024
c809027
Solving compilation error in Configurable wna name disabled builds
S-Parthiban-Selvaraj Oct 22, 2024
78211db
Deleting temp make file
S-Parthiban-Selvaraj Oct 22, 2024
d65deed
RDKB-57269 : Moving DHCPv6 client message handler API to WanManager
S-Parthiban-Selvaraj Oct 23, 2024
38038da
WanMgr_MaptParseOpt95Response cleanup
S-Parthiban-Selvaraj Oct 24, 2024
99488a3
Removing unnecessory APIs
S-Parthiban-Selvaraj Oct 24, 2024
df36c4a
Adding Comcast workaround for IPv4 DNS in Ethernet Wan
S-Parthiban-Selvaraj Oct 24, 2024
ceb1ca2
Fixing IP.Ipv6Changed in standby mode
S-Parthiban-Selvaraj Oct 25, 2024
9966ecf
Fixing PHY toggle sync issue in Autowan mode.
S-Parthiban-Selvaraj Oct 29, 2024
1f87a30
Fixing comments
S-Parthiban-Selvaraj Nov 8, 2024
92faa23
Merge branch 'main' into feature-MAPT-Unification
S-Parthiban-Selvaraj Nov 13, 2024
b210936
Do not add prefix on LAN bridge for the Comcast platforms. Adding Pro…
S-Parthiban-Selvaraj Nov 14, 2024
715f5ca
This is the change to create WAN ipv6 address from the delegated pref…
S-Parthiban-Selvaraj Nov 15, 2024
0abe743
Fixing Prefix and length parsing
S-Parthiban-Selvaraj Nov 15, 2024
f229450
RDKB-50962 : Fixing wanshow syscfg sets
S-Parthiban-Selvaraj Nov 18, 2024
dfa93ba
Code cleanup
S-Parthiban-Selvaraj Nov 18, 2024
ba6daf0
Ipv6 addr assignment and sysevent set
S-Parthiban-Selvaraj Nov 18, 2024
60d5bb3
Adding net.netfilter.nf_conntrack_udp_timeout and net.netfilter.nf_co…
S-Parthiban-Selvaraj Dec 5, 2024
356fa90
Adding commenst for nf_conntrack_udp_timeout_stream
S-Parthiban-Selvaraj Dec 10, 2024
81e1c83
Merge branch 'main' into feature-MAPT-Unification
guto86 Dec 11, 2024
777eaa8
Merge branch 'feature-MAPT-Unification' into feature-wan_Ipv6_address…
S-Parthiban-Selvaraj Dec 24, 2024
e009be8
Merge branch 'main' into feature-wan_Ipv6_address_from_IAPD
S-Parthiban-Selvaraj Jan 13, 2025
c32564a
Including PSM changes for network configurations.
S-Parthiban-Selvaraj Jan 13, 2025
90b5283
Merge branch 'main' into feature-wan_Ipv6_address_from_IAPD
S-Parthiban-Selvaraj Jan 24, 2025
8d90cb3
Modifying IPOE healch echk apis
S-Parthiban-Selvaraj Jan 24, 2025
f37c08d
Fixing WanMgr_SendMsgToIHC funtion call
S-Parthiban-Selvaraj Jan 27, 2025
55f2c3f
Merge branch 'main' into feature-wan_Ipv6_address_from_IAPD
S-Parthiban-Selvaraj Jan 29, 2025
57e6d9c
Removing IPOE LAN dependancy changes
S-Parthiban-Selvaraj Feb 5, 2025
24a976c
Removing LAN bridge IPv6 deletion and life time update from the WanMa…
S-Parthiban-Selvaraj Feb 5, 2025
ef40e85
Fixing dhcpv6_assign_global_ip funtion name
S-Parthiban-Selvaraj Feb 7, 2025
d75a9a7
Modifying DAD check from LAn to WAn interface
S-Parthiban-Selvaraj Feb 7, 2025
414fd9d
Fixing SYSEVENT_IPV6_TOGGLE get
S-Parthiban-Selvaraj Feb 7, 2025
b7c30de
FEATURE_RDKB_CONFIGURABLE_WAN_INTERFACE compilation issue
S-Parthiban-Selvaraj Feb 7, 2025
287e1f7
Merge branch 'main' into feature-wan_Ipv6_address_from_IAPD
S-Parthiban-Selvaraj Jun 6, 2025
86ed474
Merge branch 'main' into feature-wan_Ipv6_address_from_IAPD
S-Parthiban-Selvaraj Jul 14, 2025
42bf6ea
Fixing Ipv6 addr delete
S-Parthiban-Selvaraj Jul 14, 2025
e0d8789
Fixing ipv6 lease refresh case
S-Parthiban-Selvaraj Jul 16, 2025
c1adbfb
DHCPManager support
S-Parthiban-Selvaraj Jul 23, 2025
2a5f4e8
Merge branch 'main' into feature-wan_Ipv6_address_from_IAPD
S-Parthiban-Selvaraj Jul 23, 2025
912fc65
Merge branch 'main' into feature-wan_Ipv6_address_from_IAPD
S-Parthiban-Selvaraj Sep 18, 2025
1b44dc1
Update wanmgr_dhcp_event_handler.c
S-Parthiban-Selvaraj Sep 18, 2025
ed6da65
Fixing the SYSCFG_FIELD_IPV6_PREFIX_ADDRESS syscfg
S-Parthiban-Selvaraj Jan 16, 2026
c8b4a7c
Merge branch 'main' into feature-wan_Ipv6_address_from_IAPD
S-Parthiban-Selvaraj Jan 19, 2026
e81e35e
Apply suggestions from code review
S-Parthiban-Selvaraj Jan 20, 2026
5079060
Fix condition check for handling IAPD in IPv6 lease processing
S-Parthiban-Selvaraj Jan 20, 2026
1398ead
Merge branch 'main' into feature-wan_Ipv6_address_from_IAPD
S-Parthiban-Selvaraj Feb 23, 2026
2754e4d
Apply suggestions from code review
S-Parthiban-Selvaraj Feb 23, 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
1 change: 0 additions & 1 deletion source/TR-181/middle_layer_src/wanmgr_rdkbus_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@ typedef struct _CONTEXT_LINK_OBJECT

#define DML_ALIAS_NAME_LENGTH 64
#define DML_DHCP_CLIENT_IFNAME "erouter0"
#define CFG_TR181_DHCPv6_SERVER_IfName "brlan0"


ANSC_STATUS SListPushEntryByInsNum (PSLIST_HEADER pListHead, PCONTEXT_LINK_OBJECT pLinkContext);
Expand Down
9 changes: 7 additions & 2 deletions source/WanManager/DHCPv6cMsgHandler/dhcpv6c_msg_apis.c
Original file line number Diff line number Diff line change
Expand Up @@ -674,14 +674,19 @@ static void * WanMgr_DhcpV6MsgHandler()
CcspTraceInfo(("%s %d Prefix Assigned\n", __FUNCTION__, __LINE__));
snprintf(dhcpv6_data.sitePrefix, sizeof(dhcpv6_data.sitePrefix), "%s/%d", v6pref, pref_len);

dhcpv6_data.prefixAssigned = TRUE;
strncpy(dhcpv6_data.pdIfAddress, "", sizeof(dhcpv6_data.pdIfAddress));
dhcpv6_data.prefixCmd = 0;
remove_single_quote(iapd_pretm);
remove_single_quote(iapd_vldtm);
sscanf(iapd_pretm, "%d", &(dhcpv6_data.prefixPltime));
sscanf(iapd_vldtm, "%d", &(dhcpv6_data.prefixVltime));

// Set prefixAssigned to TRUE only if both preferred and valid lifetimes are positive
if (dhcpv6_data.prefixPltime > 0 && dhcpv6_data.prefixVltime > 0)
{
dhcpv6_data.prefixAssigned = TRUE;
} else {
dhcpv6_data.prefixAssigned = FALSE;
}
//IPv6 prefix related sysevents
// Define the eventMaps array as before
Ipv6SyseventMap eventMaps[] = {
Expand Down
13 changes: 12 additions & 1 deletion source/WanManager/wanmgr_dhcp_event_handler.c
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,17 @@ static void copyDhcpv6Data(WANMGR_IPV6_DATA* pDhcpv6Data, const DHCP_MGR_IPV6_MS
pDhcpv6Data->prefixAssigned = leaseInfo->prefixAssigned;
pDhcpv6Data->domainNameAssigned = leaseInfo->domainNameAssigned;
pDhcpv6Data->ipv6_TimeOffset = leaseInfo->ipv6_TimeOffset;
if(!pDhcpv6Data->addrAssigned && pDhcpv6Data->prefixAssigned)
{
/* In an IPv6 lease, if only IAPD is received and we never received IANA,
* We can use the received IAPD to construct a Ipv6 /128 address which can be used for managerment and voice ...
* If we reach this point, only IAPD has been received. Calculate Wan Ipv6 address
*/

CcspTraceInfo(("IANA is not assigned by DHCPV6. Constructing WAN address from the IAPD for Wan Interface \n"));
wanmgr_construct_wan_address_from_IAPD(pDhcpv6Data);
}
Comment on lines 104 to 116
Copy link

Copilot AI Feb 23, 2026

Choose a reason for hiding this comment

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

wanmgr_dhcp_event_handler.c calls wanmgr_construct_wan_address_from_IAPD() but does not include the header that declares it (wanmgr_dhcpv6_apis.h). This will rely on an implicit declaration in some toolchains (or fail to compile under C99/C11 with -Werror=implicit-function-declaration). Please include the proper header or add a forward declaration.

Copilot uses AI. Check for mistakes.

Comment on lines 107 to 117
Copy link

Copilot AI Feb 23, 2026

Choose a reason for hiding this comment

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

copyDhcpv6Data is a copy/helper routine but now has side effects (it may call wanmgr_construct_wan_address_from_IAPD, which runs ip -6 addr add and sets sysevents). Since DHCPv6 lease updates can arrive multiple times, this risks repeatedly trying to add the same /128 address (and doing potentially slow system calls while holding DhcpClientEvents_mutex). Please keep copyDhcpv6Data pure and move the WAN-address construction to the event-handling logic with proper idempotency (e.g., use ip -6 addr replace or check if the address is already present before adding).

Suggested change
if(!pDhcpv6Data->addrAssigned && pDhcpv6Data->prefixAssigned)
{
/* In an IPv6 lease, if only IAPD is received and we never received IANA,
* We can use the received IAPD to construct a Ipv6 /128 address which can be used for managerment and voice ...
* If we reach this point, only IAPD has been received. Canculate Wan Ipv6 address
*/
CcspTraceInfo(("IANA is not assigned by DHCPV6. Constructing WAN address from the IAPD for Wan Interface \n"));
wanmgr_construct_wan_address_from_IAPD(pDhcpv6Data);
}

Copilot uses AI. Check for mistakes.
}

pthread_mutex_t DhcpClientEvents_mutex = PTHREAD_MUTEX_INITIALIZER;
Expand Down Expand Up @@ -189,7 +200,7 @@ void* WanMgr_DhcpClientEventsHandler_Thread(void *arg)
//TODO: Check for sysevents
if(pVirtIf->IP.Ipv6Data.prefixAssigned == TRUE)
{
WanManager_Ipv6PrefixUtil(pVirtIf->Name, SET_LFT, pVirtIf->IP.Ipv6Data.prefixPltime, pVirtIf->IP.Ipv6Data.prefixVltime);
WanManager_Ipv6AddrUtil(pVirtIf, SET_LFT);
sysevent_set(sysevent_fd, sysevent_token, SYSEVENT_RADVD_RESTART, NULL, 0);
}
CcspTraceInfo(("%s-%d : DHCPv6 lease renewed for %s\n", __FUNCTION__, __LINE__, pVirtIf->Name));
Expand Down
202 changes: 138 additions & 64 deletions source/WanManager/wanmgr_dhcpv6_apis.c

Large diffs are not rendered by default.

27 changes: 26 additions & 1 deletion source/WanManager/wanmgr_dhcpv6_apis.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
#define ULOGF
#endif

#define COSA_DML_DHCPV6_SERVER_IFNAME CFG_TR181_DHCPv6_SERVER_IfName
#define COSA_DML_DHCPV6_SERVER_IFNAME "brlan0"

#define COSA_DML_DHCPV6C_PREF_SYSEVENT_NAME "tr_"DML_DHCP_CLIENT_IFNAME"_dhcpv6_client_v6pref"
#define COSA_DML_DHCPV6C_PREF_IAID_SYSEVENT_NAME "tr_"DML_DHCP_CLIENT_IFNAME"_dhcpv6_client_pref_iaid"
Expand Down Expand Up @@ -353,6 +353,31 @@ void _get_shell_output(FILE *fp, char * out, int len);
************************************************************************************/
int setUpLanPrefixIPv6(DML_VIRTUAL_IFACE* pVirtIf);

/**
* @brief Constructs a dedicated WAN IPv6 address from the received IAPD (IA Prefix Delegation).
*
* This function extracts the IPv6 prefix and its length from the given IAPD data. It then uses
* the provided prefix to construct a unique WAN IPv6 address by using the next available /64 subnet.
* The first /64 subnet of the IAPD is reserved for LAN, while the next /64 is used for the WAN address.
* The constructed WAN address is assigned to the specified WAN interface.
*
* @param[in] pIpv6DataNew Pointer to the WANMGR_IPV6_DATA structure.
*
* @return
* - 0 on success.
* - -1 on failure (e.g., invalid prefix format, prefix length >= 64, or system command failure).
*
* @note The function assumes that if the prefix length is less than 64, there are sufficient bits available
* to split the IAPD into multiple /64 subnets. If the prefix length is 64 or greater, it logs an error
* and returns -1 since further subnetting is not possible.
*
* ### Example:
* Given an IAPD of "2a06:5906:13:d000::/56", the function may construct the following addresses:
* - LAN IPv6 Address Range: "2a06:5906:13:d000::/64"
* - WAN IPv6 Address: "2a06:5906:13:d001::1/128"
*/
int wanmgr_construct_wan_address_from_IAPD(WANMGR_IPV6_DATA *pIpv6DataNew);

ANSC_STATUS WanMgr_Handle_Dhcpv6_NetLink_Address_Event(IPv6NetLinkAddrEvent *pstAddrEvent);

#endif //_WANMGR_DHCPV6_APIS_H_
140 changes: 46 additions & 94 deletions source/WanManager/wanmgr_interface_sm.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,6 @@
#define POSTD_START_FILE "/tmp/.postd_started"
#define SELECTED_MODE_TIMEOUT_SECONDS 10

#if defined(FEATURE_IPOE_HEALTH_CHECK) && defined(IPOE_HEALTH_CHECK_LAN_SYNC_SUPPORT)
extern lanState_t lanState;
#endif

#if defined(FEATURE_464XLAT)
typedef enum
Expand Down Expand Up @@ -198,7 +195,7 @@ static ANSC_STATUS WanManager_ClearDHCPData(DML_VIRTUAL_IFACE * pVirtIf);
* lan ipv6 address ready to use.
* @return RETURN_OK on success else RETURN_ERR
*************************************************************************************/
static int checkIpv6LanAddressIsReadyToUse(DML_VIRTUAL_IFACE* p_VirtIf);
static int checkIpv6AddressIsReadyToUse(DML_VIRTUAL_IFACE* p_VirtIf);

#ifdef FEATURE_MAPE
/*************************************************************************************
Expand Down Expand Up @@ -1035,57 +1032,37 @@ int wan_updateDNS(WanMgr_IfaceSM_Controller_t* pWanIfaceCtrl, BOOL addIPv4, BOOL
return ret;
}

/* Check Duplicate Address Detection (DAD) status. The way it works is that
after an address is added to an interface, the operating system uses the
Neighbor Discovery Protocol to check if any other host on the network
has the same address. The whole process will take around 3 to 4 seconds
to complete. Also we need to check and ensure that the gateway has
a valid default route entry.

/**
* @brief Checks if the IPv6 address is ready to use.
*
* This function checks the tentative address, detects Duplicate Address Detection (DAD) failure, and verifies the default route.
* If DAD fails, it also triggers a Router Solicitation.
*
* @param p_VirtIf Pointer to the virtual interface structure.
* @return int 0 on success, negative value on failure.
*/
static int checkIpv6LanAddressIsReadyToUse(DML_VIRTUAL_IFACE* p_VirtIf)
static int checkIpv6AddressIsReadyToUse(DML_VIRTUAL_IFACE* p_VirtIf)
{
char buffer[BUFLEN_256] = {0};
FILE *fp_dad = NULL;
FILE *fp_route = NULL;
FILE *fp_dad = NULL;
FILE *fp_route = NULL;
int dad_flag = 0;
int route_flag = 0;
int i;
char IfaceName[BUFLEN_16] = {0};
int BridgeMode = 0;

{ //TODO : temporary debug code to identify the bridgemode sysevent failure issue.
char Output[BUFLEN_16] = {0};
if (sysevent_get(sysevent_fd, sysevent_token, "bridge_mode", Output, sizeof(Output)) !=0)
{
CcspTraceError(("%s-%d: bridge_mode sysevent get failed. \n", __FUNCTION__, __LINE__));
}
BridgeMode = atoi(Output);
CcspTraceInfo(("%s-%d: <<DEBUG>> bridge_mode sysevent value set to =%d \n", __FUNCTION__, __LINE__, BridgeMode));
}
/*TODO:
*Below Code should be removed once V6 Prefix/IP is assigned on erouter0 Instead of brlan0 for sky Devices.
*/
strncpy(IfaceName, ETH_BRIDGE_NAME, sizeof(IfaceName)-1);
if (WanMgr_isBridgeModeEnabled() == TRUE)
{
CcspTraceInfo(("%s-%d: Device is in bridge mode. Assigning IPv6 address on WAN interface.\n", __FUNCTION__, __LINE__));
memset(IfaceName, 0, sizeof(IfaceName));
strncpy(IfaceName, p_VirtIf->Name, sizeof(IfaceName)-1);
}
CcspTraceInfo(("%s-%d: IfaceName=%s, BridgeMode=%d \n", __FUNCTION__, __LINE__, IfaceName, BridgeMode));

/* TODO: the below code assumes if the LAN ipv6 address is tentaive for 15 seconds DAD has failed. Do we need additional check?
* IANA dad is handled in the DHCPv6 client for the Wan Interface.
* Should we remove the IP from LAN bridge and request a different Delegated prefix?
* Should we use EUI-64 based Interface identifiers for all platforms?
*/
/* Check Duplicate Address Detection (DAD) status. The way it works is that after an address is added to an interface, the operating system uses the
Neighbor Discovery Protocol to check if any other host on the network has the same address. The whole process will take around 3 to 4 seconds
to complete. Also we need to check and ensure that the gateway has a valid default route entry.
*/
// Note: This check is not strictly necessary and this check could delay the WAN up by 15 seconds in worst case. If the IPv6 address (IANA) is obtained via DHCPv6, and the DHCP client already performs the DAD check.
// However, it is beneficial to verify that the WAN IPv6 address is auto-calculated from the delegated prefix or via SLAAC.

for(i=0; i<15; i++)
for(int i=0; i<15; i++)
{
buffer[0] = '\0';
if(dad_flag == 0)
{
if ((fp_dad = v_secure_popen("r","ip address show dev %s tentative", IfaceName)))
if ((fp_dad = v_secure_popen("r","ip address show dev %s tentative", p_VirtIf->Name)))
{
if(fp_dad != NULL)
{
Expand All @@ -1098,7 +1075,6 @@ static int checkIpv6LanAddressIsReadyToUse(DML_VIRTUAL_IFACE* p_VirtIf)
}
}
}

if(dad_flag == 0)
{
sleep(1);
Expand All @@ -1122,10 +1098,10 @@ static int checkIpv6LanAddressIsReadyToUse(DML_VIRTUAL_IFACE* p_VirtIf)
}
}

//if DAD failed on LAN bridge, log an ERROR message and continue with the WAN process.
//if DAD failed on WAN interface, log an ERROR message and continue with the WAN process.
if(dad_flag == 0 || route_flag == 0)
{
CcspTraceError(("%s %d dad_flag[%d] route_flag[%d] Failed \n", __FUNCTION__, __LINE__,dad_flag,route_flag));
CcspTraceError(("%s %d dad_flag[%s] route_flag[%s] Failed \n", __FUNCTION__, __LINE__, dad_flag ? "SUCCESS" : "FAILED", route_flag ? "SUCCESS" : "FAILED"));
}

if(route_flag == 0)
Expand Down Expand Up @@ -1627,8 +1603,9 @@ static int wan_tearDownIPv6(WanMgr_IfaceSM_Controller_t * pWanIfaceCtrl)
}
}
#endif

/** Unconfig IPv6. */
if ( WanManager_Ipv6PrefixUtil(p_VirtIf->Name, DEL_ADDR,0,0) < 0)
if ( WanManager_Ipv6AddrUtil(p_VirtIf, DEL_ADDR) < 0)
{
AnscTraceError(("%s %d - Failed to remove inactive address \n", __FUNCTION__,__LINE__));
}
Expand Down Expand Up @@ -1661,6 +1638,7 @@ static int wan_tearDownIPv6(WanMgr_IfaceSM_Controller_t * pWanIfaceCtrl)
sysevent_set(sysevent_fd, sysevent_token, SYSEVENT_FIREWALL_RESTART, NULL, 0);

//RBUS_WAN_IP
//TODO : **************************** Check this ************************
Copy link

Copilot AI Feb 23, 2026

Choose a reason for hiding this comment

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

This placeholder TODO (//TODO : **************************** Check this ************************) is not actionable and will be hard to triage later. Please either remove it or replace it with a specific TODO that states what needs to be verified and under what conditions (ideally with a ticket reference).

Suggested change
//TODO : **************************** Check this ************************
// TODO: Verify that the RBUS_WAN_IP IPv6 sysevent keys cleared below are correct for all product variants when WAN IPv6 goes down.

Copilot uses AI. Check for mistakes.
Copy link

Copilot AI Feb 23, 2026

Choose a reason for hiding this comment

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

The added //TODO : **************************** Check this ************************ is a placeholder and doesn’t describe an actionable task. Please replace it with a specific TODO (what/why) and ideally a ticket reference, or remove it if not needed.

Suggested change
//TODO : **************************** Check this ************************

Copilot uses AI. Check for mistakes.
#if defined (RBUS_WAN_IP)
#if defined(_RDKB_GLOBAL_PRODUCT_REQ_)
unsigned char ConfigureWANIPv6OnLANBridgeSupport = FALSE;
Expand Down Expand Up @@ -1869,14 +1847,14 @@ static ANSC_STATUS WanMgr_SendMsgTo_ConnectivityCheck(WanMgr_IfaceSM_Controller_
//Restarting firewall to add IPOE_HEALTH_CHECK firewall rules.
sysevent_set(sysevent_fd, sysevent_token, SYSEVENT_FIREWALL_RESTART, NULL, 0);
}
WanMgr_SendMsgToIHC(IPOE_MSG_WAN_CONNECTION_UP, p_VirtIf->Name);
WanMgr_SendMsgToIHC(IPOE_MSG_WAN_CONNECTION_UP, p_VirtIf);
pWanIfaceCtrl->IhcV4Status = IHC_STARTED;
}
}
else if(type == CONNECTION_MSG_IPV4 && ConnStatus == FALSE)
{
CcspTraceInfo(("%s %d Sending IPOE_MSG_WAN_CONNECTION_DOWN \n", __FUNCTION__, __LINE__));
WanMgr_SendMsgToIHC(IPOE_MSG_WAN_CONNECTION_DOWN, p_VirtIf->Name);
WanMgr_SendMsgToIHC(IPOE_MSG_WAN_CONNECTION_DOWN, p_VirtIf);
pWanIfaceCtrl->IhcV4Status = IHC_STOPPED;
}
else if(type == CONNECTION_MSG_IPV6 && ConnStatus == TRUE)
Expand All @@ -1892,14 +1870,14 @@ static ANSC_STATUS WanMgr_SendMsgTo_ConnectivityCheck(WanMgr_IfaceSM_Controller_
//Restarting firewall to add IPOE_HEALTH_CHECK firewall rules.
sysevent_set(sysevent_fd, sysevent_token, SYSEVENT_FIREWALL_RESTART, NULL, 0);
}
WanMgr_SendMsgToIHC(IPOE_MSG_WAN_CONNECTION_IPV6_UP, p_VirtIf->Name);
WanMgr_SendMsgToIHC(IPOE_MSG_WAN_CONNECTION_IPV6_UP, p_VirtIf);
pWanIfaceCtrl->IhcV6Status = IHC_STARTED;
}
}
else if(type == CONNECTION_MSG_IPV6 && ConnStatus == FALSE)
{
CcspTraceInfo(("%s %d Sending IPOE_MSG_WAN_CONNECTION_IPV6_DOWN \n", __FUNCTION__, __LINE__));
WanMgr_SendMsgToIHC(IPOE_MSG_WAN_CONNECTION_IPV6_DOWN, p_VirtIf->Name);
WanMgr_SendMsgToIHC(IPOE_MSG_WAN_CONNECTION_IPV6_DOWN, p_VirtIf);
pWanIfaceCtrl->IhcV6Status = IHC_STOPPED;
}

Expand Down Expand Up @@ -2753,7 +2731,6 @@ static eWanState_t wan_transition_ipv6_down(WanMgr_IfaceSM_Controller_t* pWanIfa
WanMgr_Rbus_EventPublishHandler(param_name, "", RBUS_STRING);
snprintf(param_name, sizeof(param_name), "Device.X_RDK_WanManager.Interface.%d.VirtualInterface.%d.IP.IPv6Prefix", p_VirtIf->baseIfIdx+1, p_VirtIf->VirIfIdx+1);
WanMgr_Rbus_EventPublishHandler(param_name, "", RBUS_STRING);
WanManager_UpdateInterfaceStatus (p_VirtIf, WANMGR_IFACE_CONNECTION_IPV6_DOWN);

//Disable accept_ra
Copy link

Copilot AI Jan 20, 2026

Choose a reason for hiding this comment

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

Comment lacks proper spacing. Should be '// Disable accept_ra' with space after '//'.

Suggested change
//Disable accept_ra
// Disable accept_ra

Copilot uses AI. Check for mistakes.
WanMgr_Configure_accept_ra(p_VirtIf, FALSE);
Expand All @@ -2775,6 +2752,16 @@ static eWanState_t wan_transition_ipv6_down(WanMgr_IfaceSM_Controller_t* pWanIfa
}
}

WanManager_UpdateInterfaceStatus (p_VirtIf, WANMGR_IFACE_CONNECTION_IPV6_DOWN);
//clear IPv6 lease from the interface data
memset(&(p_VirtIf->IP.Ipv6Data), 0, sizeof(WANMGR_IPV6_DATA));
if (p_VirtIf->IP.pIpcIpv6Data != NULL )
{
//free memory
free(p_VirtIf->IP.pIpcIpv6Data);
p_VirtIf->IP.pIpcIpv6Data = NULL;
}

#if defined(FEATURE_464XLAT)
xlat_status = xlat_state_get();
if(xlat_status == XLAT_ON)
Expand Down Expand Up @@ -3649,7 +3636,7 @@ static eWanState_t wan_state_obtaining_ip_addresses(WanMgr_IfaceSM_Controller_t*
p_VirtIf->IP.Ipv6Changed = FALSE;
return WAN_STATE_OBTAINING_IP_ADDRESSES;
}
if (checkIpv6LanAddressIsReadyToUse(p_VirtIf) == RETURN_OK)
if (checkIpv6AddressIsReadyToUse(p_VirtIf) == RETURN_OK)
{
return wan_transition_ipv6_up(pWanIfaceCtrl);
}
Expand Down Expand Up @@ -3720,7 +3707,7 @@ static eWanState_t wan_state_standby(WanMgr_IfaceSM_Controller_t* pWanIfaceCtrl)
}
p_VirtIf->IP.Ipv6Changed = FALSE;
}
if (checkIpv6LanAddressIsReadyToUse(p_VirtIf) == RETURN_OK)
if (checkIpv6AddressIsReadyToUse(p_VirtIf) == RETURN_OK)
{
ret = wan_transition_ipv6_up(pWanIfaceCtrl);
CcspTraceInfo((" %s %d - IPv6 Address Assigned to Bridge Yet.\n", __FUNCTION__, __LINE__));
Expand Down Expand Up @@ -3823,7 +3810,7 @@ static eWanState_t wan_state_ipv4_leased(WanMgr_IfaceSM_Controller_t* pWanIfaceC
p_VirtIf->IP.Ipv6Changed = FALSE;
return WAN_STATE_IPV4_LEASED;
}
if (checkIpv6LanAddressIsReadyToUse(p_VirtIf) == RETURN_OK)
if (checkIpv6AddressIsReadyToUse(p_VirtIf) == RETURN_OK)
{
return wan_transition_ipv6_up(pWanIfaceCtrl);
}
Expand Down Expand Up @@ -3931,7 +3918,7 @@ static eWanState_t wan_state_ipv6_leased(WanMgr_IfaceSM_Controller_t* pWanIfaceC
}
#if defined(FEATURE_MAPT) || defined(FEATURE_SUPPORT_MAPT_NAT46) || defined(FEATURE_MAPE)
else if (pInterface->Selection.Status == WAN_IFACE_ACTIVE &&
((p_VirtIf->EnableMAPT == TRUE && p_VirtIf->MAP.MaptStatus == WAN_IFACE_MAPT_STATE_UP && checkIpv6LanAddressIsReadyToUse(p_VirtIf) ==RETURN_OK)
((p_VirtIf->EnableMAPT == TRUE && p_VirtIf->MAP.MaptStatus == WAN_IFACE_MAPT_STATE_UP && checkIpv6AddressIsReadyToUse(p_VirtIf) ==RETURN_OK)
|| (p_VirtIf->MAP.dhcp6cMAPparameters.mapType == MAP_TYPE_MAPE && p_VirtIf->Status == WAN_IFACE_STATUS_UP && p_VirtIf->MAP.MapeStatus == WAN_IFACE_MAPE_STATE_UP)))
{
CcspTraceInfo(("%s %d - calling wan_transition_map_up \n", __FUNCTION__, __LINE__));
Expand Down Expand Up @@ -3960,18 +3947,6 @@ static eWanState_t wan_state_ipv6_leased(WanMgr_IfaceSM_Controller_t* pWanIfaceC

WanMgr_CheckDefaultRA(p_VirtIf);

#if defined(FEATURE_IPOE_HEALTH_CHECK) && defined(IPOE_HEALTH_CHECK_LAN_SYNC_SUPPORT)
if(lanState == LAN_STATE_STOPPED)
{
WanMgr_SendMsgTo_ConnectivityCheck(pWanIfaceCtrl, CONNECTION_MSG_IPV6 , FALSE);
lanState = LAN_STATE_RESET;
}
else if(lanState == LAN_STATE_STARTED)
{
WanMgr_SendMsgTo_ConnectivityCheck(pWanIfaceCtrl, CONNECTION_MSG_IPV6 , TRUE);
lanState = LAN_STATE_RESET;
}
#endif
return WAN_STATE_IPV6_LEASED;
}

Expand Down Expand Up @@ -4070,7 +4045,7 @@ static eWanState_t wan_state_dual_stack_active(WanMgr_IfaceSM_Controller_t* pWan
}
#if defined(FEATURE_MAPT) || defined(FEATURE_SUPPORT_MAPT_NAT46) || defined(FEATURE_MAPE)
else if (pInterface->Selection.Status == WAN_IFACE_ACTIVE &&
((p_VirtIf->EnableMAPT == TRUE && p_VirtIf->MAP.MaptStatus == WAN_IFACE_MAPT_STATE_UP && checkIpv6LanAddressIsReadyToUse(p_VirtIf) ==RETURN_OK)
((p_VirtIf->EnableMAPT == TRUE && p_VirtIf->MAP.MaptStatus == WAN_IFACE_MAPT_STATE_UP && checkIpv6AddressIsReadyToUse(p_VirtIf) ==RETURN_OK)
|| (p_VirtIf->MAP.dhcp6cMAPparameters.mapType == MAP_TYPE_MAPE && p_VirtIf->Status == WAN_IFACE_STATUS_UP && p_VirtIf->MAP.MapeStatus == WAN_IFACE_MAPE_STATE_UP)))
{
CcspTraceInfo(("%s %d - calling wan_transition_map_up \n", __FUNCTION__, __LINE__));
Expand Down Expand Up @@ -4106,18 +4081,6 @@ static eWanState_t wan_state_dual_stack_active(WanMgr_IfaceSM_Controller_t* pWan
WanMgr_MonitorDhcpApps(pWanIfaceCtrl);
WanMgr_CheckDefaultRA(p_VirtIf);

#if defined(FEATURE_IPOE_HEALTH_CHECK) && defined(IPOE_HEALTH_CHECK_LAN_SYNC_SUPPORT)
if(lanState == LAN_STATE_STOPPED)
{
WanMgr_SendMsgTo_ConnectivityCheck(pWanIfaceCtrl, CONNECTION_MSG_IPV6 , FALSE);
lanState = LAN_STATE_RESET;
}
else if(lanState == LAN_STATE_STARTED)
{
WanMgr_SendMsgTo_ConnectivityCheck(pWanIfaceCtrl, CONNECTION_MSG_IPV6 , TRUE);
lanState = LAN_STATE_RESET;
}
#endif
return WAN_STATE_DUAL_STACK_ACTIVE;
}

Expand Down Expand Up @@ -4262,18 +4225,7 @@ static eWanState_t wan_state_map_active(WanMgr_IfaceSM_Controller_t* pWanIfaceCt
WanMgr_MonitorDhcpApps(pWanIfaceCtrl);

WanMgr_CheckDefaultRA(p_VirtIf);
#if defined(FEATURE_IPOE_HEALTH_CHECK) && defined(IPOE_HEALTH_CHECK_LAN_SYNC_SUPPORT)
if(lanState == LAN_STATE_STOPPED)
{
WanMgr_SendMsgTo_ConnectivityCheck(pWanIfaceCtrl, CONNECTION_MSG_IPV6 , FALSE);
lanState = LAN_STATE_RESET;
}
else if(lanState == LAN_STATE_STARTED)
{
WanMgr_SendMsgTo_ConnectivityCheck(pWanIfaceCtrl, CONNECTION_MSG_IPV6 , TRUE);
lanState = LAN_STATE_RESET;
}
#endif

return WAN_STATE_MAP_ACTIVE;
}

Expand Down
Loading
Loading