Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incremental config add/del of IPv4/IPv6 addr on Loopback0 intf is not working #767

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 8 additions & 2 deletions cfgmgr/intfmgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -196,11 +196,14 @@ bool IntfMgr::doIntfAddrTask(const vector<string>& keys,
return false;
}

// Set Interface IP except for lo
if (!is_lo)
{
setIntfIp(alias, "add", ip_prefix.to_string(), ip_prefix.isV4());
}
else
{
setIntfIp("lo", "add", ip_prefix.to_string(), ip_prefix.isV4());
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not just remove "if (!is_lo)" ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Initially I thought about that :-). But alias value is not 'lo'.
The 'alias' value for loopback interface is "Loopback0" as passed from the config command. The 'is_lo' boolean is set based by comparing the 'alias' name prefix with LOOPBACK_PREFIX (Loopback).
Hence the above change.


std::vector<FieldValueTuple> fvVector;
FieldValueTuple f("family", ip_prefix.isV4() ? IPV4_NAME : IPV6_NAME);
Expand All @@ -213,11 +216,14 @@ bool IntfMgr::doIntfAddrTask(const vector<string>& keys,
}
else if (op == DEL_COMMAND)
{
// Set Interface IP except for lo
if (!is_lo)
{
setIntfIp(alias, "del", ip_prefix.to_string(), ip_prefix.isV4());
}
else
{
setIntfIp("lo", "del", ip_prefix.to_string(), ip_prefix.isV4());
}
m_appIntfTableProducer.del(appKey);
m_stateIntfTable.del(keys[0] + state_db_key_delimiter + keys[1]);
}
Expand Down