Skip to content

Commit cdffff3

Browse files
author
Volodymyr Samotiy
authored
[vnet] Fix IP2ME route creation logic for BITMAP VNET interface (#1284)
* [vnet] Fix IP2ME route creation logic for BITMAP VNET interface
1 parent bfaadcd commit cdffff3

File tree

3 files changed

+21
-2
lines changed

3 files changed

+21
-2
lines changed

orchagent/intfsorch.cpp

+17
Original file line numberDiff line numberDiff line change
@@ -1094,6 +1094,23 @@ void IntfsOrch::generateInterfaceMap()
10941094
m_updateMapsTimer->start();
10951095
}
10961096

1097+
bool IntfsOrch::updateSyncdIntfPfx(const string &alias, const IpPrefix &ip_prefix, bool add)
1098+
{
1099+
if (add && m_syncdIntfses[alias].ip_addresses.count(ip_prefix) == 0)
1100+
{
1101+
m_syncdIntfses[alias].ip_addresses.insert(ip_prefix);
1102+
return true;
1103+
}
1104+
1105+
if (!add && m_syncdIntfses[alias].ip_addresses.count(ip_prefix) > 0)
1106+
{
1107+
m_syncdIntfses[alias].ip_addresses.erase(ip_prefix);
1108+
return true;
1109+
}
1110+
1111+
return false;
1112+
}
1113+
10971114
void IntfsOrch::doTask(SelectableTimer &timer)
10981115
{
10991116
SWSS_LOG_ENTER();

orchagent/intfsorch.h

+2
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@ class IntfsOrch : public Orch
6060
return m_syncdIntfses;
6161
}
6262

63+
bool updateSyncdIntfPfx(const string &alias, const IpPrefix &ip_prefix, bool add = true);
64+
6365
private:
6466

6567
SelectableTimer* m_updateMapsTimer = nullptr;

orchagent/vnetorch.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -717,7 +717,7 @@ bool VNetBitmapObject::addIntf(const string& alias, const IpPrefix *prefix)
717717
intfMap_.emplace(alias, intfInfo);
718718
}
719719

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

740740
auto& intf = intfMap_.at(alias);
741741

742-
if (prefix)
742+
if (prefix && gIntfsOrch->updateSyncdIntfPfx(alias, *prefix, false))
743743
{
744744
gIntfsOrch->removeIp2MeRoute(gVirtualRouterId, *prefix);
745745
}

0 commit comments

Comments
 (0)