Skip to content

Commit

Permalink
Fixed set admin_status for deleted subintf due to late notification
Browse files Browse the repository at this point in the history
  • Loading branch information
EdenGri committed Feb 7, 2023
1 parent 02c2267 commit 2554455
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions cfgmgr/intfmgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -491,13 +491,24 @@ void IntfMgr::updateSubIntfAdminStatus(const string &alias, const string &admin)
std::string IntfMgr::setHostSubIntfAdminStatus(const string &alias, const string &admin_status, const string &parent_admin_status)
{
stringstream cmd;
string res;
string res, cmd_str;

if (parent_admin_status == "up" || admin_status == "down")
{
SWSS_LOG_INFO("subintf %s admin_status: %s", alias.c_str(), admin_status.c_str());
cmd << IP_CMD " link set " << shellquote(alias) << " " << shellquote(admin_status);
EXEC_WITH_ERROR_THROW(cmd.str(), res);
cmd_str = cmd.str();
int ret = swss::exec(cmd_str, res);
if (ret && !isIntfStateOk(alias))
{
// Can happen when a DEL notification is sent by portmgrd immediately followed by a new SET notification
SWSS_LOG_WARN("Setting admin_status to %s netdev failed with cmd:%s, rc:%d, error:%s",
alias.c_str(), cmd_str.c_str(), ret, res.c_str());
}
else if (ret)
{
throw runtime_error(cmd_str + " : " + res);
}
return admin_status;
}
else
Expand Down

0 comments on commit 2554455

Please sign in to comment.