[routing-manager] require on-link prefix to support SLAAC (#7142)

Existing IPv6 implementations may not implement DHCPv6 to acquire an
IPv6 address. As a result, a Thread Border Router must advertise a ULA
if there is no existing prefix that supports SLAAC (i.e. has A flag
set).
This commit is contained in:
Jonathan Hui
2021-11-08 21:33:21 -08:00
committed by GitHub
parent dd16a0587e
commit 39a1f55447
2 changed files with 7 additions and 8 deletions
+5 -6
View File
@@ -795,10 +795,9 @@ bool RoutingManager::IsValidOmrPrefix(const Ip6::Prefix &aOmrPrefix)
(aOmrPrefix.mLength >= 3 && (aOmrPrefix.GetBytes()[0] & 0xE0) == 0x20);
}
bool RoutingManager::IsValidOnLinkPrefix(const RouterAdv::PrefixInfoOption &aPio, bool aManagedAddrConfig)
bool RoutingManager::IsValidOnLinkPrefix(const RouterAdv::PrefixInfoOption &aPio)
{
return IsValidOnLinkPrefix(aPio.GetPrefix()) && aPio.GetOnLink() &&
(aPio.GetAutoAddrConfig() || aManagedAddrConfig);
return IsValidOnLinkPrefix(aPio.GetPrefix()) && aPio.GetOnLink() && aPio.GetAutoAddrConfig();
}
bool RoutingManager::IsValidOnLinkPrefix(const Ip6::Prefix &aOnLinkPrefix)
@@ -1015,7 +1014,7 @@ void RoutingManager::HandleRouterAdvertisement(const Ip6::Address &aSrcAddress,
if (pio->IsValid())
{
needReevaluate |= UpdateDiscoveredPrefixes(*pio, routerAdvMessage->GetManagedAddrConfig());
needReevaluate |= UpdateDiscoveredPrefixes(*pio);
}
}
break;
@@ -1052,7 +1051,7 @@ exit:
return;
}
bool RoutingManager::UpdateDiscoveredPrefixes(const RouterAdv::PrefixInfoOption &aPio, bool aManagedAddrConfig)
bool RoutingManager::UpdateDiscoveredPrefixes(const RouterAdv::PrefixInfoOption &aPio)
{
Ip6::Prefix prefix = aPio.GetPrefix();
bool needReevaluate = false;
@@ -1060,7 +1059,7 @@ bool RoutingManager::UpdateDiscoveredPrefixes(const RouterAdv::PrefixInfoOption
ExternalPrefix onLinkPrefix;
ExternalPrefix *existingPrefix = nullptr;
if (!IsValidOnLinkPrefix(aPio, aManagedAddrConfig))
if (!IsValidOnLinkPrefix(aPio))
{
otLogInfoBr("Ignore invalid on-link prefix in PIO: %s", prefix.ToString().AsCString());
ExitNow();
+2 -2
View File
@@ -306,7 +306,7 @@ private:
void DeprecateOnLinkPrefix(void);
void HandleRouterSolicit(const Ip6::Address &aSrcAddress, const uint8_t *aBuffer, uint16_t aBufferLength);
void HandleRouterAdvertisement(const Ip6::Address &aSrcAddress, const uint8_t *aBuffer, uint16_t aBufferLength);
bool UpdateDiscoveredPrefixes(const RouterAdv::PrefixInfoOption &aPio, bool aManagedAddrConfig);
bool UpdateDiscoveredPrefixes(const RouterAdv::PrefixInfoOption &aPio);
bool UpdateDiscoveredPrefixes(const RouterAdv::RouteInfoOption &aRio);
bool InvalidateDiscoveredPrefixes(const Ip6::Prefix *aPrefix = nullptr, bool aIsOnLinkPrefix = true);
void InvalidateAllDiscoveredPrefixes(void);
@@ -315,7 +315,7 @@ private:
static bool IsValidOmrPrefix(const NetworkData::OnMeshPrefixConfig &aOnMeshPrefixConfig);
static bool IsValidOmrPrefix(const Ip6::Prefix &aOmrPrefix);
static bool IsValidOnLinkPrefix(const RouterAdv::PrefixInfoOption &aPio, bool aManagedAddrConfig);
static bool IsValidOnLinkPrefix(const RouterAdv::PrefixInfoOption &aPio);
static bool IsValidOnLinkPrefix(const Ip6::Prefix &aOnLinkPrefix);
// Indicates whether the Routing Manager is running (started).