[202511] recover from stale-SAK after dirty macsec docker restart - #4796
Open
senthil-nexthop wants to merge 1 commit into
Open
[202511] recover from stale-SAK after dirty macsec docker restart#4796senthil-nexthop wants to merge 1 commit into
senthil-nexthop wants to merge 1 commit into
Conversation
Collaborator
|
/azp run |
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
senthil-nexthop
marked this pull request as ready for review
July 27, 2026 20:09
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
senthil-nexthop
force-pushed
the
senthil.macsec-stale-sak-202511
branch
from
July 27, 2026 20:31
ecae5ce to
98f9052
Compare
Collaborator
|
/azp run |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
Collaborator
|
/azp run |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
senthil-nexthop
force-pushed
the
senthil.macsec-stale-sak-202511
branch
from
July 28, 2026 00:22
a827dc2 to
0b227d5
Compare
Collaborator
|
/azp run |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
senthil-nexthop
force-pushed
the
senthil.macsec-stale-sak-202511
branch
from
July 28, 2026 00:23
0b227d5 to
c65e969
Compare
Collaborator
|
/azp run |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
senthil-nexthop
force-pushed
the
senthil.macsec-stale-sak-202511
branch
from
July 28, 2026 17:49
c65e969 to
e9a14c0
Compare
Collaborator
|
/azp run |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
Signed-off-by: senthil-nexthop <senthil@nexthop.ai> Signed-off-by: Senthil Krishnamurthy <senthil@nexthop.ai>
senthil-nexthop
force-pushed
the
senthil.macsec-stale-sak-202511
branch
from
July 29, 2026 23:28
e9a14c0 to
2fc151f
Compare
Collaborator
|
/azp run |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Backport of #4583 to 202511
Cherry-pick of commit
5314f2d7f8ee48cfc501237dae296fb9395f162efrom #4583 — clean apply, no conflicts.Why I did it
After a macsec docker restart that doesn't give
macsecmgrdenough time to calldisableMACsecon every port (e.g. systemdTimeoutStopSecelapsed mid-loop, SIGKILL, or simply 16 ports exceeding the stop window), orchagent'sMACsecOrchin-memory state survives with OIDs pointing at SAs whose SAK was distributed in the prior MKA cycle. The post-restartwpa_supplicantnegotiates a fresh SAK and writes it to APPL_DB, but three code paths fail to propagate it to SAI. The result is asymmetric encryption: the ASIC keeps using the stale SAK while userspace believes the re-key happened, so ICV fails on every received frame and LACPDUs / LLDPDUs get silently dropped.How I did it
Three matching re-key paths in
orchagent/macsecorch.cpp, all detected by the presence of asakfield in the incoming SET:taskUpdateIngressSA:wpa_supplicant'smacsec_sonicdriver installs a new ingress SA in two stages: stage-1 writesactive=false+ full key material; stage-2 writesactive=trueonly. After a dirty restart the SA pre-exists, so the legacy path deletes onactive=falseand the subsequentactive=truecreateMACsecSAfails with no SAK to consume. New behaviour: whenactive=falsearrives on an existing SA AND the SET carries a SAK, dodeleteMACsecSA+createMACsecSAinline using THIS sa_attr's key material — atomically. When no SAK is in the SET, original delete-only path is kept (true deactivate).createMACsecSA: the function's "SA already exists → return task_success" early-exit silently discarded any SAK in the SET.SAI_MACSEC_SA_ATTR_SAKis create-only in SAI, so a re-key requires delete+create. New behaviour: when the SA exists and the SET carries a SAK, treat as re-key:deleteMACsecSA+ recurse. When no SAK is present, keep the existing fast-path.taskUpdateEgressSA: the egress "SA already exists" branch only updatednext_pn; the new SAK in the SET was silently dropped. Mirror the ingress re-key pattern: detect SAK presence,deleteMACsecSA+createMACsecSAwith the new key material.How to verify it
See #4583.
🤖 Generated with Claude Code
Co-authored-by: Senthil Krishnamurthy senthil@nexthop.ai