Skip to content

RDKB-58910 : Move the WAN IPV6 configuration from LAN bridge#79

Merged
guto86 merged 91 commits into
mainfrom
feature-wan_Ipv6_address_from_IAPD
May 18, 2026
Merged

RDKB-58910 : Move the WAN IPV6 configuration from LAN bridge#79
guto86 merged 91 commits into
mainfrom
feature-wan_Ipv6_address_from_IAPD

Conversation

@S-Parthiban-Selvaraj
Copy link
Copy Markdown
Contributor

@S-Parthiban-Selvaraj S-Parthiban-Selvaraj commented Nov 15, 2024

This PR moves WAN IPv6 configuration from the LAN bridge to the WAN interface itself, addressing an issue where IANA is not assigned by the BNG (Broadband Network Gateway). The changes enable the creation of IPv6 addresses on WAN interfaces from delegated prefixes when IANA addresses are not provided.

Key changes:

Removed IPv6 configuration from LAN bridge and moved it to WAN interfaces
Added new function to construct WAN IPv6 addresses from IAPD (IA Prefix Delegation)
Updated IPv6 utility functions to work with virtual interfaces instead of interface names
Cleaned up LAN-specific IPv6 handling code and legacy bridge mode logic

This PR is dependent on the following related PRs:
rdkcentral/telco-voice-manager#5
rdkcentral/utopia#69
#79
rdkcentral/provisioning-and-management#127
rdkcentral/xconf-client#20
rdkcentral/test-and-diagnostic#172
https://github.com/rdk-gdcs/firewall/pull/5
rdkcentral/sysint-broadband#34

S-Parthiban-Selvaraj and others added 30 commits July 16, 2024 14:26
Reason for change:  Solving Build errors

Test Procedure:
    Updated in Jira.

Risks: none
Priority: P1

Signed-off-by: parthiban.selvaraj <parthiban.selvaraj@sky.uk>
Signed-off-by: parthiban.selvaraj <parthiban.selvaraj@sky.uk>
Signed-off-by: parthiban.selvaraj <parthiban.selvaraj@sky.uk>
Signed-off-by: Parthiban Selvaraj <parthiban.selvaraj@sky.uk>
Signed-off-by: Parthiban Selvaraj <parthiban.selvaraj@sky.uk>
Signed-off-by: S-Parthiban-Selvaraj <parthiban.selvaraj@sky.uk>
Signed-off-by: S-Parthiban-Selvaraj <parthiban.selvaraj@sky.uk>
Signed-off-by: S-Parthiban-Selvaraj <parthiban.selvaraj@sky.uk>
Signed-off-by: S-Parthiban-Selvaraj <parthiban.selvaraj@sky.uk>
Signed-off-by: Parthiban Selvaraj <parthiban.selvaraj@sky.uk>
Signed-off-by: S-Parthiban-Selvaraj <parthiban.selvaraj@sky.uk>
Signed-off-by: Parthiban Selvaraj <parthiban.selvaraj@sky.uk>
Signed-off-by: S-Parthiban-Selvaraj <parthiban.selvaraj@sky.uk>
Signed-off-by: S-Parthiban-Selvaraj <parthiban.selvaraj@sky.uk>
Signed-off-by: S-Parthiban-Selvaraj <parthiban.selvaraj@sky.uk>
Signed-off-by: Parthiban Selvaraj <parthiban.selvaraj@sky.uk>
Signed-off-by: S-Parthiban-Selvaraj <parthiban.selvaraj@sky.uk>
…eint after WFO

Signed-off-by: Parthiban Selvaraj <parthiban.selvaraj@sky.uk>
Signed-off-by: Parthiban Selvaraj <parthiban.selvaraj@sky.uk>
Fixing Virtual interface name set.

Signed-off-by: S-Parthiban-Selvaraj <parthiban.selvaraj@sky.uk>
Signed-off-by: Parthiban Selvaraj <parthiban.selvaraj@sky.uk>
Signed-off-by: Parthiban Selvaraj <parthiban.selvaraj@sky.uk>
…ive VISM for products use the same default name for all interfaces

Signed-off-by: Parthiban Selvaraj <parthiban.selvaraj@sky.uk>
Signed-off-by: S-Parthiban-Selvaraj <parthiban.selvaraj@sky.uk>
Signed-off-by: S-Parthiban-Selvaraj <parthiban.selvaraj@sky.uk>
Copilot AI review requested due to automatic review settings April 24, 2026 13:20
Copy link
Copy Markdown
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

Copilot reviewed 13 out of 13 changed files in this pull request and generated 7 comments.


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

Comment thread source/WanManager/wanmgr_interface_sm.c
Comment thread source/WanManager/wanmgr_dhcpv6_apis.c Outdated
Comment thread source/WanManager/wanmgr_dhcpv6_apis.c
Comment thread source/WanManager/wanmgr_ipc.c
Comment thread source/WanManager/wanmgr_net_utils.c
Comment thread source/WanManager/wanmgr_dhcpv6_apis.c Outdated
Comment thread source/WanManager/wanmgr_net_utils.c
S-Parthiban-Selvaraj and others added 2 commits April 27, 2026 15:59
…4. WAN address now comes from the same /64 as LAN.

2. Changed prefix_length >= 64 to prefix_length > 64 — Now accepts /64 delegations (previously rejected them). Only rejects prefixes longer than /64 where no /64 subnet can be derived.

3. Updated all comments and doxygen with RFC references:

RFC 7084 Section 4.2 WAA-7 — CE router MUST create address from delegated prefix
RFC 9096 Section 3.3 & 3.5 — Addresses should track prefix lifetimes; using same /64 aligns with renumbering expectations
RFC 4862 Section 5.4 — DAD is mandatory, provides collision safeguard
Inline comments explain why EUI-64 is collision-free (different MACs) and why ::1 suffix is safe
- Enable NDP proxy on the LAN bridge to respond to Neighbor Solicitations for the WAN address.
- Add NDP proxy entry for the WAN address to facilitate upstream routing and prevent DAD success for LAN clients.
- Update function to remove NDP proxy entry when removing IPv6 routes and addresses.

Co-authored-by: Copilot <copilot@github.com>
Copilot AI review requested due to automatic review settings April 28, 2026 12:41
Copy link
Copy Markdown
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

Copilot reviewed 13 out of 13 changed files in this pull request and generated 8 comments.


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

Comment thread source/WanManager/wanmgr_dhcpv6_apis.c
Comment thread source/WanManager/wanmgr_dhcpv6_apis.c Outdated
Comment thread source/WanManager/wanmgr_dhcpv6_apis.c
Comment thread source/WanManager/wanmgr_interface_sm.c Outdated
Comment thread source/WanManager/wanmgr_dhcpv6_apis.c Outdated
Comment thread source/WanManager/wanmgr_dhcpv6_apis.h Outdated
Comment thread source/WanManager/wanmgr_dhcpv6_apis.c Outdated
Comment thread source/WanManager/wanmgr_interface_sm.c Outdated
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copy link
Copy Markdown
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

Copilot reviewed 13 out of 13 changed files in this pull request and generated 5 comments.

Comment thread source/WanManager/wanmgr_net_utils.c
Comment thread source/WanManager/wanmgr_dhcp_event_handler.c
Comment thread source/WanManager/wanmgr_dhcpv6_apis.h Outdated
Comment thread source/WanManager/wanmgr_dhcpv6_apis.c
Comment thread source/WanManager/DHCPv6cMsgHandler/dhcpv6c_msg_apis.c
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings May 18, 2026 15:27
guto86
guto86 previously approved these changes May 18, 2026
Copy link
Copy Markdown
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

Copilot reviewed 13 out of 13 changed files in this pull request and generated 5 comments.

Comments suppressed due to low confidence (2)

source/WanManager/wanmgr_dhcpv6_apis.c:1676

  • wanmgr_construct_wan_address_from_IAPD() ignores the return value of WanMgr_create_eui64_ipv6_address() and then unconditionally sets addrAssigned=true/addrCmd=ADD. If address construction fails (or produces an empty/invalid address), the subsequent ip -6 addr add will be executed with bad input and the lease will be treated as valid. Please check the return value, validate the generated address string, and propagate failures (return -1 / don’t set addrAssigned) when construction or command execution fails.
    if(IPv6EUI64FormatSupport)
    {
        /* EUI-64: IID derived from WAN interface MAC — deterministically unique per interface.
         * No collision possible with LAN clients (different MACs produce different IIDs). */
        char prefStr[128] = {0};
        inet_ntop(AF_INET6, &prefix, prefStr, sizeof(prefStr));
        CcspTraceInfo(("%s %d EUI64 format is enabled, using prefix %s for WAN address\n", __FUNCTION__, __LINE__, prefStr));
        snprintf(cmdLine, sizeof(cmdLine), "%s/%d", prefStr, prefix_length);
        WanMgr_create_eui64_ipv6_address(cmdLine, pIpv6DataNew->ifname, pIpv6DataNew->address);
    }
    else
    {
        /* Non-EUI-64: Use well-known suffix ::1 (mirrors IPv4 gateway convention).
         * SLAAC EUI-64 clients never generate ::1; DHCPv6 server should exclude ::1 from pool. */
        CcspTraceInfo(("%s %d EUI64 format is not enabled, using WAN_SUFFIX %d\n", __FUNCTION__, __LINE__, WAN_SUFFIX));
        prefix.s6_addr[15] = WAN_SUFFIX;
        inet_ntop(AF_INET6, &prefix, pIpv6DataNew->address, sizeof(pIpv6DataNew->address));
    }
    
    pIpv6DataNew->addrAssigned = true;
    pIpv6DataNew->addrCmd = IFADDRCONF_ADD;

    CcspTraceInfo(("%s %d Calculated WAN address %s/128\n", __FUNCTION__, __LINE__, pIpv6DataNew->address));

source/WanManager/wanmgr_dhcpv6_apis.c:1699

  • Even when ip -6 addr add ... or ip -6 neigh add proxy ... fails, the function still returns 0 and leaves addrAssigned set. Consider treating these command failures as fatal (return -1 and avoid updating sysevents/flags) so upper layers can retry or fall back cleanly.
    CcspTraceInfo(("%s %d Calculated WAN address %s/128\n", __FUNCTION__, __LINE__, pIpv6DataNew->address));
    // Assign the /128 host address on the WAN interface
    memset(cmdLine, 0, sizeof(cmdLine));
    snprintf(cmdLine, sizeof(cmdLine), "ip -6 addr add %s/128 dev %s", pIpv6DataNew->address, pIpv6DataNew->ifname);
    if (WanManager_DoSystemActionWithStatus(__FUNCTION__, cmdLine) != 0)
        CcspTraceError(("failed to run cmd: %s", cmdLine));

    /* Enable NDP proxy on the LAN bridge so the kernel responds to Neighbor Solicitations
     * for the WAN address on brlan0. This ensures:
     *  - LAN clients performing DAD for this address will get a Neighbor Advertisement back,
     *    causing their DAD to fail (preventing them from using the WAN address). */
    memset(cmdLine, 0, sizeof(cmdLine));
    snprintf(cmdLine, sizeof(cmdLine), "sysctl -w net.ipv6.conf.%s.proxy_ndp=1", COSA_DML_DHCPV6_SERVER_IFNAME);
    WanManager_DoSystemActionWithStatus(__FUNCTION__, cmdLine);

    /* Add NDP proxy entry for the WAN address on the LAN bridge.
     * This makes the kernel respond to Neighbor Solicitations for our WAN address
     * on brlan0, which:
     *  1. Enables upstream routing to reach the WAN address via the LAN bridge if needed.
     *  2. Causes DAD to fail for any LAN client that tries to use this address. */
    memset(cmdLine, 0, sizeof(cmdLine));
    snprintf(cmdLine, sizeof(cmdLine), "ip -6 neigh add proxy %s dev %s", pIpv6DataNew->address, COSA_DML_DHCPV6_SERVER_IFNAME);
    if (WanManager_DoSystemActionWithStatus(__FUNCTION__, cmdLine) != 0)
        CcspTraceError(("%s %d failed to add NDP proxy entry on %s for %s\n", __FUNCTION__, __LINE__, COSA_DML_DHCPV6_SERVER_IFNAME, pIpv6DataNew->address));

Comment thread source/WanManager/wanmgr_net_utils.c
Comment thread source/WanManager/wanmgr_net_utils.c
Comment thread source/WanManager/wanmgr_dhcpv6_apis.c
Comment thread source/WanManager/wanmgr_dhcp_event_handler.c
Comment thread source/WanManager/wanmgr_dhcpv6_apis.c
@guto86 guto86 merged commit 6b3cf1f into main May 18, 2026
11 checks passed
@github-actions github-actions Bot locked and limited conversation to collaborators May 18, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants