Skip to content

Commit

Permalink
[vnet] Fix IP2ME route creation logic for BITMAP VNET interface (soni…
Browse files Browse the repository at this point in the history
…c-net#1284)

* [vnet] Fix IP2ME route creation logic for BITMAP VNET interface
  • Loading branch information
Volodymyr Samotiy authored and abdosi committed May 21, 2020
1 parent 2218ed4 commit 62d4af4
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
17 changes: 17 additions & 0 deletions orchagent/intfsorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1052,6 +1052,23 @@ void IntfsOrch::generateInterfaceMap()
m_updateMapsTimer->start();
}

bool IntfsOrch::updateSyncdIntfPfx(const string &alias, const IpPrefix &ip_prefix, bool add)
{
if (add && m_syncdIntfses[alias].ip_addresses.count(ip_prefix) == 0)
{
m_syncdIntfses[alias].ip_addresses.insert(ip_prefix);
return true;
}

if (!add && m_syncdIntfses[alias].ip_addresses.count(ip_prefix) > 0)
{
m_syncdIntfses[alias].ip_addresses.erase(ip_prefix);
return true;
}

return false;
}

void IntfsOrch::doTask(SelectableTimer &timer)
{
SWSS_LOG_ENTER();
Expand Down
2 changes: 2 additions & 0 deletions orchagent/intfsorch.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ class IntfsOrch : public Orch
return m_syncdIntfses;
}

bool updateSyncdIntfPfx(const string &alias, const IpPrefix &ip_prefix, bool add = true);

private:

SelectableTimer* m_updateMapsTimer = nullptr;
Expand Down
4 changes: 2 additions & 2 deletions orchagent/vnetorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -717,7 +717,7 @@ bool VNetBitmapObject::addIntf(const string& alias, const IpPrefix *prefix)
intfMap_.emplace(alias, intfInfo);
}

if (prefix)
if (prefix && gIntfsOrch->updateSyncdIntfPfx(alias, *prefix))
{
gIntfsOrch->addIp2MeRoute(gVirtualRouterId, *prefix);
}
Expand All @@ -739,7 +739,7 @@ bool VNetBitmapObject::removeIntf(const string& alias, const IpPrefix *prefix)

auto& intf = intfMap_.at(alias);

if (prefix)
if (prefix && gIntfsOrch->updateSyncdIntfPfx(alias, *prefix, false))
{
gIntfsOrch->removeIp2MeRoute(gVirtualRouterId, *prefix);
}
Expand Down

0 comments on commit 62d4af4

Please sign in to comment.