Skip to content

Commit 26e1723

Browse files
authored
[fdborch] Fixed Orchagent crash in FDB flush on port disable. (#1369)
* [fdborch] Fixed Orchagent crash in FDB flush on port disable. Signed-off-by: Rajkumar Pennadam Ramamoorthy <[email protected]>
1 parent a1530e3 commit 26e1723

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

orchagent/fdborch.cpp

+7-5
Original file line numberDiff line numberDiff line change
@@ -232,12 +232,13 @@ void FdbOrch::update(sai_fdb_event_t type,
232232
update.entry.mac.to_string().c_str(),
233233
vlanName.c_str(), update.port.m_alias.c_str());
234234

235-
for (const auto& itr : m_entries)
235+
for (auto itr = m_entries.begin(); itr != m_entries.end();)
236236
{
237-
if (itr.port_name == update.port.m_alias)
237+
auto next_item = std::next(itr);
238+
if (itr->port_name == update.port.m_alias)
238239
{
239-
update.entry.mac = itr.mac;
240-
update.entry.bv_id = itr.bv_id;
240+
update.entry.mac = itr->mac;
241+
update.entry.bv_id = itr->bv_id;
241242
update.add = false;
242243

243244
storeFdbEntryState(update);
@@ -246,7 +247,8 @@ void FdbOrch::update(sai_fdb_event_t type,
246247
{
247248
observer->update(SUBJECT_TYPE_FDB_CHANGE, &update);
248249
}
249-
}
250+
}
251+
itr = next_item;
250252
}
251253
}
252254
else if (bridge_port_id == SAI_NULL_OBJECT_ID)

0 commit comments

Comments
 (0)