This repository has been archived by the owner on Aug 1, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
swss: [portsyncd] fix portsyncd restart case
sonic-net/sonic-swss#1019 Signed-off-by: Wataru Ishida <wataru.ishid@gmail.com>
- Loading branch information
1 parent
9c0a6da
commit a9652d4
Showing
3 changed files
with
62 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
sonic-swss/[portsyncd]:_fix_portsyncd_restart_case_(#1019).patch |
60 changes: 60 additions & 0 deletions
60
patches/sonic-swss/[portsyncd]:_fix_portsyncd_restart_case_(#1019).patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
copporch_bug_fix.patch | ||
[portsyncd]:_fix_portsyncd_restart_case_(#1019).patch |