Skip to content

Commit

Permalink
Local scope rifs are always local (by definition)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Jasmeet Bagga authored and facebook-github-bot committed Nov 19, 2024
1 parent 3cdc5e0 commit e4884ce
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions fboss/agent/state/Interface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,10 @@ Interface* Interface::modify(std::shared_ptr<SwitchState>* state) {
? (*state)->getSwitchSettings()->cbegin()->second
: std::make_shared<SwitchSettings>();

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<int64_t>(getID()));
auto switchId2Info = switchSettings->getSwitchIdToSwitchInfo();
for (const auto& [_, switchInfo] : switchId2Info) {
Expand All @@ -144,12 +147,13 @@ Interface* Interface::modify(std::shared_ptr<SwitchState>* 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)
Expand Down

0 comments on commit e4884ce

Please sign in to comment.