Skip to content

Commit

Permalink
Avoid adding loopback interface (ip link add) when setting nat zone o…
Browse files Browse the repository at this point in the history
…n loopback interface (sonic-net#1434)

Signed-off-by: Akhilesh Samineni <[email protected]>
  • Loading branch information
AkhileshSamineni authored Sep 17, 2020
1 parent 4aa48d6 commit 40ff871
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
8 changes: 7 additions & 1 deletion cfgmgr/intfmgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,12 @@ bool IntfMgr::doIntfGeneralTask(const vector<string>& keys,

if (is_lo)
{
addLoopbackIntf(alias);
if (m_loopbackIntfList.find(alias) == m_loopbackIntfList.end())
{
addLoopbackIntf(alias);
m_loopbackIntfList.insert(alias);
SWSS_LOG_INFO("Added %s loopback interface", alias.c_str());
}
}
else
{
Expand Down Expand Up @@ -598,6 +603,7 @@ bool IntfMgr::doIntfGeneralTask(const vector<string>& keys,
if (is_lo)
{
delLoopbackIntf(alias);
m_loopbackIntfList.erase(alias);
}

if (!subIntfAlias.empty())
Expand Down
1 change: 1 addition & 0 deletions cfgmgr/intfmgr.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ class IntfMgr : public Orch
Table m_statePortTable, m_stateLagTable, m_stateVlanTable, m_stateVrfTable, m_stateIntfTable;

std::set<std::string> m_subIntfList;
std::set<std::string> m_loopbackIntfList;

void setIntfIp(const std::string &alias, const std::string &opCmd, const IpPrefix &ipPrefix);
void setIntfVrf(const std::string &alias, const std::string &vrfName);
Expand Down

0 comments on commit 40ff871

Please sign in to comment.