Skip to content

Commit

Permalink
Revert "Integrate fix for sonic-net#389"
Browse files Browse the repository at this point in the history
This reverts commit a3b1ec0.
  • Loading branch information
zhenggen-xu committed Dec 17, 2017
1 parent 36480e0 commit fd0bef6
Showing 1 changed file with 3 additions and 31 deletions.
34 changes: 3 additions & 31 deletions portsyncd/linksync.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,43 +92,15 @@ void LinkSync::onMsg(int nlmsg_type, struct nl_object *obj)
nlmsg_type, key.c_str(), admin, oper, addrStr, ifindex, master);
}

/* Insert or update the ifindex to key map */
m_ifindexNameMap[ifindex] = key;

/* teamd instances are dealt in teamsyncd */
if (type && !strcmp(type, TEAM_DRV_NAME))
{
return;
}

/* In the event of swss restart, it is possible to get netlink messages during bridge
* delete, interface delete etc which are part of cleanup. These netlink messages for
* the front-panel interface must not be published or it will update the statedb with
* old interface info and result in subsequent failures. A new interface creation shall
* not have master or admin status iff_up. So if the first netlink message comes with these
* values set, it is considered to be happening during a cleanup process.
* Fix to ignore this and any further messages for this ifindex
*/

static std::map<unsigned int, std::string> m_ifindexOldNameMap;
if (m_ifindexNameMap.find(ifindex) == m_ifindexNameMap.end())
{
if (master)
{
m_ifindexOldNameMap[ifindex] = key;
SWSS_LOG_INFO("nlmsg type:%d Ignoring for %d, master %d", nlmsg_type, ifindex, master);
return;
}
else if (m_ifindexOldNameMap.find(ifindex) != m_ifindexOldNameMap.end())
{
if (m_ifindexOldNameMap[ifindex] == key)
{
SWSS_LOG_INFO("nlmsg type:%d Ignoring message for old interface %d", nlmsg_type, ifindex);
return;
}
}
}

/* Insert or update the ifindex to key map */
m_ifindexNameMap[ifindex] = key;

vector<FieldValueTuple> fvVector;
FieldValueTuple a("admin_status", admin ? "up" : "down");
FieldValueTuple m("mtu", to_string(mtu));
Expand Down

0 comments on commit fd0bef6

Please sign in to comment.