Skip to content

[terway] Fix eRDMA link matching without mutating the ENI MAC - #1081

Merged
l1b0k merged 1 commit into
AliyunContainerService:mainfrom
BSWANG:fix/erdma-link-mac-1080
Nov 20, 2026
Merged

l1b0k merged 1 commit into
AliyunContainerService:mainfrom
BSWANG:fix/erdma-link-mac-1080

Conversation

@BSWANG

@BSWANG BSWANG commented Nov 20, 2026

Copy link
Copy Markdown
Member

GetERdmaFromLink aliases the caller's HardwareAddr and toggles its first byte for every RDMA candidate. A valid match in the second (or another even) position is missed, and successful odd-position matches mutate the input, making repeated calls unreliable.

Copy the MAC before applying the GUID bit conversion. Add nine mocked regression cases for matching positions 1–4, repeated calls on the same link, MAC preservation on success and failure, empty/no-match lists, invalid GUIDs after a mismatch, and RDMA enumeration errors.

Addresses the matcher failure reported in #1080. Local-IPAM allocation eligibility and ERDMA RPC policy remain separate issues.

Validation

Linux / Go 1.26.2:

  • The new regression test fails on the unmodified base.
  • go test -gcflags=all=-l -race ./plugin/driver/utils -run '^TestGetERdmaFromLink_Matching$' -count=10 passes.
  • The matcher test also passes with the privileged build tag.
  • go test -gcflags=all=-l -race ./plugin/driver/utils -count=1 passes without the privileged build tag.
  • make vet passes; make lint reports 0 issues.
  • Generation and formatting produce no unrelated changes; git diff --check passes.
  • make test-quick was attempted but does not pass in this environment: Unix socket/netlink operations return operation not permitted, and envtest control-plane startup fails.
  • Docker/kind datapath tests and ACK/eRDMA hardware validation were not available.

Copy the caller-owned hardware address before toggling the GUID bit so
candidate matching is independent of list position and repeated calls.
Add mocked coverage for candidate order, unchanged input and error paths.

Refs AliyunContainerService#1080
@BSWANG
BSWANG requested a review from l1b0k November 20, 2026 02:26
@codecov

codecov Bot commented Nov 20, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 81.94%. Comparing base (330a754) to head (f5a1642).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1081      +/-   ##
==========================================
+ Coverage   81.90%   81.94%   +0.04%     
==========================================
  Files         126      126              
  Lines       17068    17068              
==========================================
+ Hits        13979    13987       +8     
+ Misses       2076     2070       -6     
+ Partials     1013     1011       -2     
Flag Coverage Δ
unittests 81.94% <100.00%> (+0.04%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@l1b0k
l1b0k merged commit a05e695 into AliyunContainerService:main Nov 20, 2026
9 checks passed
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.

2 participants