Skip to content

[macsecorch]: Default-initialize m_enable_post to false - #4802

Open
liamkearney-msft wants to merge 1 commit into
sonic-net:masterfrom
liamkearney-msft:fix-macsecorch-enable-post-init
Open

[macsecorch]: Default-initialize m_enable_post to false#4802
liamkearney-msft wants to merge 1 commit into
sonic-net:masterfrom
liamkearney-msft:fix-macsecorch-enable-post-init

Conversation

@liamkearney-msft

Copy link
Copy Markdown

MACsecOrch::m_enable_post is declared without an initializer and is only assigned (= true) on the "macsec-level-post-in-progress" state path. On every other path (e.g. POST/FIPS disabled) it is read as an indeterminate bool at the SAI_MACSEC_ATTR_ENABLE_POST push sites (macsecorch.cpp:1246, 1278) and the guard at 807. That can push ENABLE_POST=true on hardware that does not support POST, causing MACsec SAI object creation to fail with SAI_STATUS_ATTR_NOT_SUPPORTED and MACsec to never initialize.

This would tear down orchagent and wedge the entire LC

Default-initialize the member to false so POST is only enabled when explicitly requested by the state machine.

seen on arista 7800 with 202511

What I did

Why I did it

How I verified it
on local 202511 build on arista 7800 hw
Details if related

MACsecOrch::m_enable_post is declared without an initializer and is only
assigned (= true) on the "macsec-level-post-in-progress" state path. On
every other path (e.g. POST/FIPS disabled) it is read as an indeterminate
bool at the SAI_MACSEC_ATTR_ENABLE_POST push sites (macsecorch.cpp:1246,
1278) and the guard at 807. That can push ENABLE_POST=true on hardware
that does not support POST, causing MACsec SAI object creation to fail
with SAI_STATUS_ATTR_NOT_SUPPORTED and MACsec to never initialize.

Default-initialize the member to false so POST is only enabled when
explicitly requested by the state machine.

Signed-off-by: Liam Kearney <liamkearney@microsoft.com>
Copilot AI review requested due to automatic review settings July 30, 2026 10:13
@mssonicbld

Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request prevents MACsecOrch::m_enable_post from being read as an indeterminate boolean by default-initializing it to false, ensuring MACsec POST is only enabled when explicitly requested by the POST state machine path. This avoids unintentionally pushing SAI_MACSEC_ATTR_ENABLE_POST on platforms that don’t support POST, which can otherwise cause MACsec SAI object creation failures and destabilize orchagent.

Changes:

  • Default-initialize MACsecOrch::m_enable_post to false in the class definition.
  • Ensures the existing if (m_enable_post) guards in macsecorch.cpp only activate when POST is explicitly enabled.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants