[routing-manager] stop PD if there is another prefix with higher preference in netdata (#10289)

This commit adds a new IDLE state to PdPrefixManager.

PdPrefixManager enters idle state when PD is enabled and there is
already a BR requesting PD prefix. When there are multiple BRs
publishing PD prefix at the same time, the one with lexcial smaller
prefix wins.
This commit is contained in:
Song GUO
2024-09-29 23:27:30 -07:00
committed by GitHub
parent 6e46e2e9f1
commit 7cd179e23a
10 changed files with 232 additions and 13 deletions
+9 -1
View File
@@ -4213,9 +4213,17 @@ void TestBorderRoutingProcessPlatfromGeneratedNd(void)
AdvanceTime(1000000);
VerifyPdOmrPrefix(raPrefix);
sExpectedRios.Add(newRaPrefix);
// When the prefix is replaced, there will be a short period when the old prefix is still in the netdata, and PD
// manager will refuse to request the prefix.
SendRouterAdvertToBorderRoutingProcessIcmp6Ra(
{Pio(raPrefix, 0, 0), Pio(newRaPrefix, kValidLitime, kPreferredLifetime)});
sExpectedRios.Add(newRaPrefix);
// Advance a short period of time to wait for a stable PD state.
AdvanceTime(5000);
VerifyOrQuit(sInstance->Get<BorderRouter::RoutingManager>().GetDhcp6PdState() ==
BorderRouter::RoutingManager::kDhcp6PdStateRunning);
SendRouterAdvertToBorderRoutingProcessIcmp6Ra({Pio(newRaPrefix, kValidLitime, kPreferredLifetime)});
AdvanceTime(1000000);
VerifyOrQuit(sExpectedRios.SawAll());