[routing-manager] fix lifetime management of PD prefix (#10310)

This commit updates `PdPrefixManager` to use the newly added
`GetDeprecationTime()` method for managing the lifetime of a DHCPv6
PD prefix. This method calculates the deprecation time using the
prefix preferred lifetime directly, instead of relying on the RA
stale time constant  `GetStaleTime()`.

While the PD prefix may be determined by processing RA messages
received on the Thread interface, the RA stale time is not relevant
in this context. The RA stale time is only applicable to RA messages
received over infra-if. It specifies the time that can pass after the
last RA from a particular router on infra-if before assuming the
router might be unavailable and triggering Router Solicitation
(RS) messages.
This commit is contained in:
Abtin Keshavarzian
2024-05-30 11:36:48 -07:00
committed by GitHub
parent bef804c6be
commit d2e74dc705
3 changed files with 32 additions and 16 deletions
+26 -1
View File
@@ -3977,7 +3977,7 @@ void TestBorderRoutingProcessPlatfromGeneratedNd(void)
}
// 4. Short prefix will be extended to /64.
Log("Short prefix");
Log("4. Short prefix");
{
// The prefix will be padded to a /64 prefix.
Ip6::Prefix raPrefix = PrefixFromString("2001:db8:cafe:0::", 64);
@@ -4004,6 +4004,31 @@ void TestBorderRoutingProcessPlatfromGeneratedNd(void)
VerifyOmrPrefixInNetData(localOmr, /* aDefaultRoute */ false);
}
// 5. Publish a prefix with long lifetime, and wait until it expired.
Log("5. RA message with long prefix lifetime");
{
Ip6::Prefix raPrefix = PrefixFromString("2001:db8:dead:beef::", 64);
SendRouterAdvertToBorderRoutingProcessIcmp6Ra({Pio(raPrefix, 5000, 5000)});
sExpectedRios.Add(raPrefix);
AdvanceTime(10 * 1000);
VerifyPdOmrPrefix(raPrefix);
VerifyOrQuit(sExpectedRios.SawAll());
VerifyOmrPrefixInNetData(raPrefix, /* aDefaultRoute */ false);
AdvanceTime(4900 * 1000);
sExpectedRios.Clear();
VerifyPdOmrPrefix(raPrefix);
VerifyOmrPrefixInNetData(raPrefix, /* aDefaultRoute */ false);
AdvanceTime(200 * 1000);
// Deprecated prefixes will be removed.
VerifyNoPdOmrPrefix();
VerifyOmrPrefixInNetData(localOmr, /* aDefaultRoute */ false);
}
SuccessOrQuit(otBorderRoutingSetEnabled(sInstance, false));
VerifyOrQuit(sHeapAllocatedPtrs.GetLength() <= heapAllocations);