Skip to content

Commit 8f1d035

Browse files
authored
[macsecmgr]: Wait for port up before enabling macsec (sonic-net#2032)
What I did Change the prerequisite of enabling macsec to port up Why I did it The macsec-related API calls have to be executed after the API calls for gearbox port setup have been done. For that reason, before this change, enabling macsec through config_db.json after reboot cannot succeed. To fix it by this change, the API calls for enabling macsec are executed only after the port is up. How I verified it Details if related
1 parent 4912a77 commit 8f1d035

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

cfgmgr/macsecmgr.cpp

+4-1
Original file line numberDiff line numberDiff line change
@@ -547,10 +547,13 @@ bool MACsecMgr::isPortStateOk(const std::string & port_name)
547547

548548
std::vector<FieldValueTuple> temp;
549549
std::string state;
550+
std::string oper_status;
550551

551552
if (m_statePortTable.get(port_name, temp)
552553
&& get_value(temp, "state", state)
553-
&& state == "ok")
554+
&& state == "ok"
555+
&& get_value(temp, "netdev_oper_status", oper_status)
556+
&& oper_status == "up")
554557
{
555558
SWSS_LOG_DEBUG("Port '%s' is ready", port_name.c_str());
556559
return true;

0 commit comments

Comments
 (0)