Skip to content

Commit

Permalink
Do not delete port from stateDB on deletion of VLAN member (bridgeport)
Browse files Browse the repository at this point in the history
Also, cleanup g_init and g_portSet flag and data strcutures usage.
  • Loading branch information
vasant17 authored and zhenggen-xu committed Nov 15, 2019
1 parent 317ce51 commit 92e6497
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions portsyncd/linksync.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,12 @@ void LinkSync::onMsg(int nlmsg_type, struct nl_object *obj)
return;
}

/* If this is a bridge port, return */
if (master)
{
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
Expand Down Expand Up @@ -237,15 +243,11 @@ void LinkSync::onMsg(int nlmsg_type, struct nl_object *obj)
vector<FieldValueTuple> temp;
if (m_portTable.get(key, temp))
{
/* Host interface is created */
if (!g_init && g_portSet.find(key) != g_portSet.end())
{
g_portSet.erase(key);
FieldValueTuple tuple("state", "ok");
vector<FieldValueTuple> vector;
vector.push_back(tuple);
m_statePortTable.set(key, vector);
SWSS_LOG_NOTICE("Publish %s(ok) to state db", key.c_str());
}
g_portSet.erase(key);
FieldValueTuple tuple("state", "ok");
vector<FieldValueTuple> vector;
vector.push_back(tuple);
m_statePortTable.set(key, vector);
SWSS_LOG_NOTICE("Publish %s(ok) to state db", key.c_str());
}
}

0 comments on commit 92e6497

Please sign in to comment.