Skip to content

Conversation

@devinmungan
Copy link

Implement stateful DS-Lite V2 in Wan Manager

Summary
This PR integrates the new generation of DS-Lite into wan-manager and
dhcp-manager. Unlike the previous stateless implementation, this version
is stateful and fully integrated into the Wan Manager state machine.

This implementation moves significant logic (including service_dslite.c
and data model handling) out of Utopia and ccsp-p-and-m into
wan-manager, while maintaining backward compatibility for non-volatile
storage keys.

Technical Implementation

  • Architecture Migration:

    • Migrated Device.DSLite TR-181 data model handling from
      ccsp-p-and-m to wan-manager.
    • Moved service_dslite.c logic and non-volatile configuration
      storage from Utopia to wan-manager.
    • Backward Compatibility: Retained existing syscfg keys for
      non-volatile storage to ensure seamless upgrades.
  • Data Model & Mapping:

    • InterfaceSetting entries are now maintained in a separate linked
      list.
    • Introduced #define PSM_WANMANAGER_IF_VIRIF_DSLITE_PATH to map
      InterfaceSetting entries to their corresponding Virtual Interfaces
      using the Alias field.
  • DHCP Integration:

    • DHCPv6 Option 64 is now received by dhcp-manager and propagated to
      wan-manager, where it is stored in the mapped DSLite entry.
  • State Machine:

    • Extended the Virtual Interface state machine to explicitly support
      DS-Lite transition states.

New Features

  1. DNS TTL Tracking & Reliability
    Added logic to handle endpoint changes and failures gracefully:
  • TTL Tracking: Tracks DNS TTL and resolution timestamps for endpoint
    FQDNs.
  • Smart Re-resolution: Periodically checks TTL in the DSLITE_ACTIVE
    state. Re-resolves endpoint when TTL expires, but only restarts the
    tunnel if the resolved address has changed.
  • Failure Handling: Tears down the tunnel if DNS re-resolution fails to
    prevent stale endpoint usage.
  • Retry Logic: Implemented automatic retry every 5 seconds after tunnel
    setup failures (Note: Future improvement planned to make this
    configurable via DM parameter).
  • Optimization: Added address caching to avoid redundant DNS queries.
  1. Dual Stack Provisioning Support
    Introduced specific support for dual-stack provisioning scenarios where
    standard IPv6-only DS-Lite is not sufficient.
  • Flag: FEATURE_DSLITE_V2_DUALSTACK_SUPPORT (Distro feature:
    dslite_v2_dualstack_support).
  • Behavior: If the DS-Lite tunnel fails (e.g., FQDN resolution
    failure), the device will gracefully fallback to the IPv4 address on
    the WAN interface.

Build Configuration
This feature is gated by the following preprocessor macros:

  • FEATURE_DSLITE_V2 (Distro feature: dslite_v2)
  • FEATURE_DSLITE_V2_DUALSTACK_SUPPORT (Distro feature:
    dslite_v2_dualstack_support)

devinmungan and others added 7 commits December 10, 2025 01:10
…11 development)

* RDKBNETWOR-86 : Move Device.DSLite. datamodel implementation to WAN Manager

* DSLite Data Model Migration to WAN Manager

Signed-off-by: Devin Mungan <devin.mungan@infosys.com>
…11 development)

* RDKBNETWOR-85 : DHCP Manager changes for option 64

* parse and import endpoint name data coming from dhcp-manager

Signed-off-by: Devin Mungan <devin.mungan@infosys.com>
…11 development)

* RDKBNETWOR-88 : WAN Manager state machine for DSLite

* Interface state machine is extended to cover DS-Lite mode as well

Signed-off-by: Devin Mungan <devin.mungan@infosys.com>
…11 development)

* RDKBNETWOR-87: DSLite tunnel interface management

* Moved service_dslite from Utopia to WanManager.

Signed-off-by: Govindaraja N B <gnb.ext@libertyglobal.com>
…11 development)

* RDKBNETWOR-89 : WAN Manager DSLite failure/failover handling

Summary
Added DNS TTL tracking with periodic re-resolution and retry logic
to handle endpoint changes and failures gracefully.

Key Changes

- Track DNS TTL and resolution timestamp for endpoint FQDNs
- Periodically check TTL expiration in DSLITE_ACTIVE state
- Re-resolve endpoint when TTL expires; only restart tunnel if address changed
- Tear down tunnel if DNS re-resolution fails (prevents stale endpoint usage)
- Automatic retry every 5 seconds after tunnel setup failures (TODO is adding a DM parameter for it)
- Optimize DNS queries with address caching to avoid redundant resolutions

Signed-off-by: Devin Mungan <devin.mungan@infosys.com>
…11 development)

* RDKBNETWOR-89 : WAN Manager DSLite failure/failover handling

Add Dual-Stack device-mode awareness to the DS-Lite feature.
By design, DS-Lite is enabled only when the CPE operates in IPv6-only mode.
For platforms that intentionally want DS-Lite in Dual-Stack mode, enable the distro feature:
dslite_v2_dualstack_support

Signed-off-by: Devin Mungan <devin.mungan@infosys.com>
…11 development)

* Enhance error handling and update the state-machine flow
  to align with the latest design agreed with the Tiger Team.
Copilot AI review requested due to automatic review settings December 11, 2025 10:58
@devinmungan devinmungan requested a review from a team as a code owner December 11, 2025 10:58
@github-actions
Copy link

github-actions bot commented Dec 11, 2025

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR integrates stateful DS-Lite V2 into WAN Manager, moving significant logic from Utopia and ccsp-p-and-m while maintaining backward compatibility. The implementation includes DNS TTL tracking with smart re-resolution, failure handling with automatic retry logic, and optional dual-stack provisioning support.

Key Changes:

  • Migrated Device.DSLite TR-181 data model handling and service_dslite.c logic to WAN Manager
  • Added DS-Lite states to WAN interface state machine with DNS TTL-based endpoint management
  • Integrated DHCPv6 Option 64 handling for dynamic endpoint provisioning

Reviewed changes

Copilot reviewed 25 out of 25 changed files in this pull request and generated no comments.

Show a summary per file
File Description
wanmgr_interface_sm.c Extended state machine with DS-Lite states, setup/teardown logic, and retry mechanism
wanmgr_dslite.c Core DS-Lite implementation including DNS resolution with TTL tracking and tunnel management
wanmgr_dslite.h DS-Lite public API definitions for tunnel and configuration management
wanmgr_data.c DS-Lite data structures and access functions for configuration management
wanmgr_dml_dslite_apis.c TR-181 data model implementation for Device.DSLite object
wanmgr_dhcp_event_handler.c DHCPv6 Option 64 endpoint name integration
wanmgr_telemetry.h/.c DS-Lite telemetry event definitions and handlers
configure.ac Build configuration for DS-Lite V2 feature flag
Comments suppressed due to low confidence (1)

source/WanManager/wanmgr_dslite.c:1

  • The function WanMgr_SysCfgSetStr should validate that the value parameter is not NULL before calling strlen() or other string operations on it. Without this check, there's potential for undefined behavior if value is NULL.
/*

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@govindaraja-nb
Copy link

I have read the CLA Document and I hereby sign the CLA

Copy link

@sichevoi sichevoi left a comment

Choose a reason for hiding this comment

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

I'll continue later this week.

Copy link

@sichevoi sichevoi left a comment

Choose a reason for hiding this comment

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

I've finished this part.


if (pid > 0)
{
sprintf(cmdline_buf, "/proc/%d/cmdline", pid);
Copy link

Choose a reason for hiding this comment

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

Could you please comment why is this needed? I have trouble understanding the logic.

Copy link
Author

Choose a reason for hiding this comment

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

probably copied from utopia. @govindaraja-nb need your input pls

Choose a reason for hiding this comment

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

Yes, this logic was copied from Utopia (service_dslite).
So instead of keeping this logic, I updated it to simply restart Zebra. Also moved all service restarts into helper WanMgr_Dslite_RestartServices().

devinmungan and others added 2 commits January 12, 2026 14:37
- change dhcpv6 & dml related AFTR FQDN naming to aftr instead of endpointName
  keep internal naming as "endpointName" since internals also will have endpointAddr
  and these parameters are already under DSLite context therefore both function
  and struct namings suggest endPointName is a DSLite related field.
- change TunnelV4Addr to X_RDKCENTRAL-COM_TunnelV4Addr as it's not a standard TR-181 DM
- convert ANSC to generic
- link libevent to wanmgr only if DSLITE_SUPPORT flag exists
- add telemetry event for the case WAN_ERROR_DSLITE_STATUS_FAILED
- add helper to restart required services during DSLite up/down
- remove wanmgr_restart_zebra() and move zebra restart into the helper function.

Signed-off-by: Govindaraja N B <gnb.ext@libertyglobal.com>
Copilot AI review requested due to automatic review settings January 12, 2026 15:07
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants