From 56db0d3eff95d387b8c9c4abc61690e81eea71c7 Mon Sep 17 00:00:00 2001 From: Jonathan Hui Date: Mon, 23 May 2022 13:26:04 -0700 Subject: [PATCH] [routing-manager] remove vicarious router discovery feature (#7727) The vicarious router discovery feature depends on the ability to receive Router Advertisement messages sent in response to Router Solicitation messages from other hosts. However, this does not work since Router Advertisement messages are often sent unicast in response. --- src/core/border_router/routing_manager.cpp | 39 ------------------- src/core/border_router/routing_manager.hpp | 15 ------- src/core/config/border_router.h | 10 ----- .../config/openthread-core-config-check.h | 4 ++ ...uter_solicit.py => test_on_link_prefix.py} | 2 +- 5 files changed, 5 insertions(+), 65 deletions(-) rename tests/scripts/thread-cert/border_router/{test_vicarious_router_solicit.py => test_on_link_prefix.py} (99%) diff --git a/src/core/border_router/routing_manager.cpp b/src/core/border_router/routing_manager.cpp index f606bfc2b..c05edc0a1 100644 --- a/src/core/border_router/routing_manager.cpp +++ b/src/core/border_router/routing_manager.cpp @@ -73,9 +73,6 @@ RoutingManager::RoutingManager(Instance &aInstance) , mDiscoveredPrefixStaleTimer(aInstance, HandleDiscoveredPrefixStaleTimer) , mRouterAdvertisementCount(0) , mLastRouterAdvertisementSendTime(TimerMilli::GetNow() - kMinDelayBetweenRtrAdvs) -#if OPENTHREAD_CONFIG_BORDER_ROUTING_VICARIOUS_RS_ENABLE - , mVicariousRouterSolicitTimer(aInstance, HandleVicariousRouterSolicitTimer) -#endif , mRouterSolicitTimer(aInstance, HandleRouterSolicitTimer) , mRouterSolicitCount(0) , mRoutingPolicyTimer(aInstance, HandleRoutingPolicyTimer) @@ -292,9 +289,6 @@ void RoutingManager::Stop(void) mRouterAdvertisementCount = 0; -#if OPENTHREAD_CONFIG_BORDER_ROUTING_VICARIOUS_RS_ENABLE - mVicariousRouterSolicitTimer.Stop(); -#endif mRouterSolicitTimer.Stop(); mRouterSolicitCount = 0; @@ -787,10 +781,6 @@ void RoutingManager::StartRouterSolicitationDelay(void) OT_ASSERT(mRouterSolicitCount == 0); -#if OPENTHREAD_CONFIG_BORDER_ROUTING_VICARIOUS_RS_ENABLE - mVicariousRouterSolicitTimer.Stop(); -#endif - static_assert(kMaxRtrSolicitationDelay > 0, "invalid maximum Router Solicitation delay"); randomDelay = Random::NonCrypto::GetUint32InRange(0, Time::SecToMsec(kMaxRtrSolicitationDelay)); @@ -991,27 +981,6 @@ bool RoutingManager::IsValidOnLinkPrefix(const Ip6::Prefix &aOnLinkPrefix) return !aOnLinkPrefix.IsLinkLocal() && !aOnLinkPrefix.IsMulticast(); } -#if OPENTHREAD_CONFIG_BORDER_ROUTING_VICARIOUS_RS_ENABLE -void RoutingManager::HandleVicariousRouterSolicitTimer(Timer &aTimer) -{ - aTimer.Get().HandleVicariousRouterSolicitTimer(); -} - -void RoutingManager::HandleVicariousRouterSolicitTimer(void) -{ - LogInfo("Vicarious router solicitation time out"); - - for (const ExternalPrefix &prefix : mDiscoveredPrefixes) - { - if (prefix.mTimeLastUpdate <= mTimeVicariousRouterSolicitStart) - { - StartRouterSolicitationDelay(); - break; - } - } -} -#endif - void RoutingManager::HandleRouterSolicitTimer(Timer &aTimer) { aTimer.Get().HandleRouterSolicitTimer(); @@ -1118,14 +1087,6 @@ void RoutingManager::HandleRouterSolicit(const InfraIf::Icmp6Packet &aPacket, co LogInfo("Received Router Solicitation from %s on %s", aSrcAddress.ToString().AsCString(), mInfraIf.ToString().AsCString()); -#if OPENTHREAD_CONFIG_BORDER_ROUTING_VICARIOUS_RS_ENABLE - if (!mVicariousRouterSolicitTimer.IsRunning()) - { - mTimeVicariousRouterSolicitStart = TimerMilli::GetNow(); - mVicariousRouterSolicitTimer.Start(Time::SecToMsec(kVicariousSolicitationTime)); - } -#endif - // Schedule routing policy evaluation with random jitter to respond with Router Advertisement. StartRoutingPolicyEvaluationJitter(kRaReplyJitter); } diff --git a/src/core/border_router/routing_manager.hpp b/src/core/border_router/routing_manager.hpp index 02c68de5c..2ec9e6828 100644 --- a/src/core/border_router/routing_manager.hpp +++ b/src/core/border_router/routing_manager.hpp @@ -237,13 +237,6 @@ private: // The value is chosen in range of [`kMaxRtrAdvInterval` upper bound (1800s), `kDefaultOnLinkPrefixLifetime`]. static constexpr uint32_t kRtrAdvStaleTime = 1800; - // The VICARIOUS_SOLICIT_TIME in seconds. The Routing Manager will consider - // the discovered prefixes invalid if they are not refreshed after receiving - // a Router Solicitation message. - // The value is equal to Router Solicitation timeout. - static constexpr uint32_t kVicariousSolicitationTime = - kRtrSolicitationInterval * (kMaxRtrSolicitations - 1) + kMaxRtrSolicitationDelay; - static_assert(kMinRtrAdvInterval <= 3 * kMaxRtrAdvInterval / 4, "invalid RA intervals"); static_assert(kDefaultOmrPrefixLifetime >= kMaxRtrAdvInterval, "invalid default OMR prefix lifetime"); static_assert(kDefaultOnLinkPrefixLifetime >= kMaxRtrAdvInterval, "invalid default on-link prefix lifetime"); @@ -327,10 +320,6 @@ private: void SendRouterAdvertisement(const OmrPrefixArray &aNewOmrPrefixes, const Ip6::Prefix *aNewOnLinkPrefix); bool IsRouterSolicitationInProgress(void) const; -#if OPENTHREAD_CONFIG_BORDER_ROUTING_VICARIOUS_RS_ENABLE - static void HandleVicariousRouterSolicitTimer(Timer &aTimer); - void HandleVicariousRouterSolicitTimer(void); -#endif static void HandleRouterSolicitTimer(Timer &aTimer); void HandleRouterSolicitTimer(void); static void HandleDiscoveredPrefixInvalidTimer(Timer &aTimer); @@ -416,10 +405,6 @@ private: uint32_t mRouterAdvertisementCount; TimeMilli mLastRouterAdvertisementSendTime; -#if OPENTHREAD_CONFIG_BORDER_ROUTING_VICARIOUS_RS_ENABLE - TimerMilli mVicariousRouterSolicitTimer; - TimeMilli mTimeVicariousRouterSolicitStart; -#endif TimerMilli mRouterSolicitTimer; TimeMilli mTimeRouterSolicitStart; uint8_t mRouterSolicitCount; diff --git a/src/core/config/border_router.h b/src/core/config/border_router.h index 5e45b387a..f3959d50d 100644 --- a/src/core/config/border_router.h +++ b/src/core/config/border_router.h @@ -75,16 +75,6 @@ #define OPENTHREAD_CONFIG_BORDER_ROUTING_MAX_DISCOVERED_PREFIXES 8 #endif -/** - * @def OPENTHREAD_CONFIG_BORDER_ROUTING_VICARIOUS_RS_ENABLE - * - * Define to 1 to enable Border Routing Vicarious Router Solicitation. - * - */ -#ifndef OPENTHREAD_CONFIG_BORDER_ROUTING_VICARIOUS_RS_ENABLE -#define OPENTHREAD_CONFIG_BORDER_ROUTING_VICARIOUS_RS_ENABLE 1 -#endif - /** * @def OPENTHREAD_CONFIG_BORDER_ROUTING_NAT64_ENABLE * diff --git a/src/core/config/openthread-core-config-check.h b/src/core/config/openthread-core-config-check.h index ed8495aaa..1536ec2ff 100644 --- a/src/core/config/openthread-core-config-check.h +++ b/src/core/config/openthread-core-config-check.h @@ -623,4 +623,8 @@ #error "OPENTHREAD_CONFIG_PLATFORM_CSL_UNCERT was removed and no longer supported" #endif +#ifdef OPENTHREAD_CONFIG_BORDER_ROUTING_VICARIOUS_RS_ENABLE +#error "OPENTHREAD_CONFIG_BORDER_ROUTING_VICARIOUS_RS_ENABLE was removed and no longer supported" +#endif + #endif // OPENTHREAD_CORE_CONFIG_CHECK_H_ diff --git a/tests/scripts/thread-cert/border_router/test_vicarious_router_solicit.py b/tests/scripts/thread-cert/border_router/test_on_link_prefix.py similarity index 99% rename from tests/scripts/thread-cert/border_router/test_vicarious_router_solicit.py rename to tests/scripts/thread-cert/border_router/test_on_link_prefix.py index 065cdae1b..8d273f1aa 100755 --- a/tests/scripts/thread-cert/border_router/test_vicarious_router_solicit.py +++ b/tests/scripts/thread-cert/border_router/test_on_link_prefix.py @@ -34,7 +34,7 @@ import config import thread_cert # Test description: -# This test verifies Vicarious Router Solicitation. +# This test verifies on-link prefix configuration. # # Topology: # -------------(eth)----------------------------