Skip to content
This repository has been archived by the owner on Aug 1, 2023. It is now read-only.

Commit

Permalink
swss: [portsyncd] fix portsyncd restart case
Browse files Browse the repository at this point in the history
sonic-net/sonic-swss#1019

Signed-off-by: Wataru Ishida <wataru.ishid@gmail.com>
  • Loading branch information
ishidawataru committed May 18, 2021
1 parent 9c0a6da commit a9652d4
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 0 deletions.
1 change: 1 addition & 0 deletions patches/series
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
sonic-swss/[portsyncd]:_fix_portsyncd_restart_case_(#1019).patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
Index: usonic/sm/sonic-swss/portsyncd/linksync.cpp
===================================================================
--- usonic.orig/sm/sonic-swss/portsyncd/linksync.cpp
+++ usonic/sm/sonic-swss/portsyncd/linksync.cpp
@@ -95,20 +95,27 @@ LinkSync::LinkSync(DBConnector *appl_db,
if (!WarmStart::isWarmStart())
{
/* See the comments for g_portSet in portsyncd.cpp */
- for (string port : g_portSet)
+ for (auto port_iter = g_portSet.begin(); port_iter != g_portSet.end();)
{
+ string port = *port_iter;
vector<FieldValueTuple> temp;
+ bool portFound = false;
if (m_portTable.get(port, temp))
{
for (auto it : temp)
{
if (fvField(it) == "admin_status")
{
- g_portSet.erase(port);
+ port_iter = g_portSet.erase(port_iter);
+ portFound = true;
break;
}
}
}
+ if (!portFound)
+ {
+ ++port_iter;
+ }
}

for (idx_p = if_ni;
Index: usonic/sm/sonic-swss/portsyncd/portsyncd.cpp
===================================================================
--- usonic.orig/sm/sonic-swss/portsyncd/portsyncd.cpp
+++ usonic/sm/sonic-swss/portsyncd/portsyncd.cpp
@@ -79,10 +79,6 @@ int main(int argc, char **argv)
WarmStart::checkWarmStart("portsyncd", "swss");
const bool warm = WarmStart::isWarmStart();

- LinkSync sync(&appl_db, &state_db);
- NetDispatcher::getInstance().registerMessageHandler(RTM_NEWLINK, &sync);
- NetDispatcher::getInstance().registerMessageHandler(RTM_DELLINK, &sync);
-
try
{
NetLink netlink;
@@ -102,6 +98,10 @@ int main(int argc, char **argv)
}
}

+ LinkSync sync(&appl_db, &state_db);
+ NetDispatcher::getInstance().registerMessageHandler(RTM_NEWLINK, &sync);
+ NetDispatcher::getInstance().registerMessageHandler(RTM_DELLINK, &sync);
+
s.addSelectable(&netlink);
s.addSelectable(&portCfg);

1 change: 1 addition & 0 deletions patches/sonic-swss/series
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
copporch_bug_fix.patch
[portsyncd]:_fix_portsyncd_restart_case_(#1019).patch

0 comments on commit a9652d4

Please sign in to comment.