ot-br-posix icon indicating copy to clipboard operation
ot-br-posix copied to clipboard

[pd] support of multiple prefixes publishing and deprecating

Open yangsong-cnyn opened this issue 9 months ago • 1 comments

Add support of multiple prefixes handling in both

  • dhcpcd.enter-hook (Publishing Prefixes):

    • This script is triggered when dhcpcd gets new or updated IPv6 PD information.
    • It now iterates through multiple new_dhcp6_ia_pd*_prefix* environment variables (where * is a number), allowing for multiple prefixes.
    • For each prefix, it extracts the prefix, length, valid lifetime (vltime), and preferred lifetime (pltime). If lifetime is zero, it means the prefix is deprecated.
    • It then constructs a radvd.conf file that includes multiple prefix blocks, each with its own lifetimes.
    • It reloads or restarts radvd to apply the new configuration.
  • dhcpcd.exit-hook (Deprecating Prefixes):

    • This script is triggered when dhcpcd releases or expires IPv6 PD information.
    • It now iterates through multiple old_dhcp6_ia_pd*_prefix* environment variables to find prefixes that are no longer valid.
    • For each deprecated prefix, it sets the AdvPreferredLifetime and AdvValidLifetime to 0 in radvd.conf.
    • It reloads or restarts radvd to apply the updated configuration.

yangsong-cnyn avatar Feb 28 '25 08:02 yangsong-cnyn

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 44.37%. Comparing base (2b41187) to head (1114765). Report is 982 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff             @@
##             main    #2743       +/-   ##
===========================================
- Coverage   55.77%   44.37%   -11.40%     
===========================================
  Files          87      113       +26     
  Lines        6890    13588     +6698     
  Branches        0      965      +965     
===========================================
+ Hits         3843     6030     +2187     
- Misses       3047     7242     +4195     
- Partials        0      316      +316     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

codecov[bot] avatar Feb 28 '25 08:02 codecov[bot]

@yangsong-cnyn @bukepo I'm trying to understand what the purpose is of this PR and of the function that it is modifying.

If a prefix gets delegated to a BR, that alone won't have any impact on the RAs being sent on the AIL. So no reason to change anything in the RAs based on DHCPv6-PD events alone.

The only requirement is that the RA must advertise all on-mesh+routable prefixes on the AIL, using RIO. But this is already a requirement even if DHCPv6-PD is not used or was not successful. So there should be standard code already doing this.

(This PR looks like it wants to modify the PIO. And per the Thread spec, the AIL on-link prefix that a BR creates using PIO is always a ULA prefix, not dependent on DHCPv6-PD in any way.)

EskoDijk avatar Sep 25 '25 15:09 EskoDijk

@EskoDijk , this PR is probably no longer relevant, as we are switching to using a DHCPv6 Client implemented within OT core.

This PR was an attempt to leverage dhcpcd and communicate the PD prefix using RA message format. Those RAs would never be sent on the AIL.

jwhui avatar Sep 25 '25 15:09 jwhui

@EskoDijk , this PR is probably no longer relevant, as we are switching to using a DHCPv6 Client implemented within OT core.

This PR was an attempt to leverage dhcpcd and communicate the PD prefix using RA message format. Those RAs would never be sent on the AIL.

Ok good to know! It seems to encode the PD prefix(es) in the radvd config format which kind of suggested radvd would use it.

EskoDijk avatar Sep 26 '25 08:09 EskoDijk

Ok good to know! It seems to encode the PD prefix(es) in the radvd config format which kind of suggested radvd would use it.

Yes, the radvd config was specifying the wpan (i.e. Thread) interface.

jwhui avatar Sep 26 '25 21:09 jwhui