From e4884ced4014af431c096b3b1c3e27f76dcb869d Mon Sep 17 00:00:00 2001 From: Jasmeet Bagga Date: Tue, 19 Nov 2024 01:46:31 -0800 Subject: [PATCH] Local scope rifs are always local (by definition) Summary: As titled. No need to look in sys port ranges for these Reviewed By: daiwei1983 Differential Revision: D66142093 Privacy Context Container: L1125642 fbshipit-source-id: c0f32b23c73e08de1c74e25cd77f1d218db7f2ef --- fboss/agent/state/Interface.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/fboss/agent/state/Interface.cpp b/fboss/agent/state/Interface.cpp index 7cb771847c7c4..4fbdcca3127da 100644 --- a/fboss/agent/state/Interface.cpp +++ b/fboss/agent/state/Interface.cpp @@ -134,7 +134,10 @@ Interface* Interface::modify(std::shared_ptr* state) { ? (*state)->getSwitchSettings()->cbegin()->second : std::make_shared(); - if (getType() == cfg::InterfaceType::SYSTEM_PORT) { + if (getType() == cfg::InterfaceType::SYSTEM_PORT && + getScope() == cfg::Scope::GLOBAL) { + // For global system port RIFs, look whether these fall + // in my sysport ranges. If so, the RIF is local auto id(static_cast(getID())); auto switchId2Info = switchSettings->getSwitchIdToSwitchInfo(); for (const auto& [_, switchInfo] : switchId2Info) { @@ -144,12 +147,13 @@ Interface* Interface::modify(std::shared_ptr* state) { isLocal = true; break; } - if (isLocal) { - break; - } + } + if (isLocal) { + break; } } } else { + // VLAN based rifs, or rifs with local scope are always local isLocal = true; } auto interfaces = isLocal ? (*state)->getInterfaces()->modify(state)