mirror of
https://github.com/espressif/openthread.git
synced 2026-08-07 11:17:46 +00:00
[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:
@@ -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();
|
||||
|
||||
@@ -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).
|
||||
|
||||
Reference in New Issue
Block a user