Skip to content

[teammgr]: Validate port channel table keys - #4846

Open
ashutosh-agrawal wants to merge 3 commits into
sonic-net:masterfrom
ashutosh-agrawal:fix/teammgr-interface-key-validation
Open

ashutosh-agrawal wants to merge 3 commits into
sonic-net:masterfrom
ashutosh-agrawal:fix/teammgr-interface-key-validation

Conversation

@ashutosh-agrawal

@ashutosh-agrawal ashutosh-agrawal commented Aug 26, 2026 •

Copy link
Copy Markdown
Member

Description of PR

Summary:

Validate port-channel and member names where teammgrd consumes LAG, LAG-member, and port-state entries. The checks use swss::isInterfaceNameValid() from sonic-swss-common.

Issue: no GitHub issue is linked.

Type of change

  • Bug fix
  • New feature
  • Refactor / cleanup
  • Documentation update
  • Test improvement

Approach

What is the motivation for this PR?

teammgrd receives compound keys from Redis and later uses their components in interface operations and command arguments. Validating both components at the consumer boundary prevents malformed keys from being partially parsed, while the shared helper keeps the accepted interface syntax consistent across SWSS daemons.

How did you do it?

Validate port-channel and member names where teammgrd consumes LAG, LAG-member, and port-state entries. The checks use swss::isInterfaceNameValid() from sonic-swss-common.

Member keys are parsed in one helper and are accepted only when they contain exactly one port-channel name and one member name. The same validation is applied before interface lookup and LAG member add/remove operations. Names passed to teamd, teamdctl, and interface commands are quoted, and the ifreq copy is length-bounded.

Valid port-channel and member entries continue through the existing lifecycle path unchanged.

Depends on the shared validator added by sonic-swss-common #1240, which is merged. This PR contains only the teammgrd consumer changes.

How did you verify/test it?

  • Built tests_teammgrd in the Bookworm environment.
  • All 14 tests passed.
  • Added coverage for invalid LAG names, malformed member keys, and quoted member-removal commands.

Any platform specific information?

No platform-specific behavior is described in this change.

Documentation

No documentation change is described for this fix.

@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).

@ashutosh-agrawal

Copy link
Copy Markdown
Member Author

Temporarily paused until the shared interface-name helper is available on master.

@azure-pipelines

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

@mssonicbld

Copy link
Copy Markdown
Collaborator

/azp run

@ashutosh-agrawal
ashutosh-agrawal force-pushed the fix/teammgr-interface-key-validation branch from 69721ae to 6809449 Compare August 27, 2026 19:36
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines will not run the associated pipelines, because the pull request was updated after the run command was issued. Review the pull request again and issue a new run command.

@mssonicbld

Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines

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

Reject malformed LAG and member identifiers before processing and construct command operands safely.

Signed-off-by: Ashutosh Agrawal <ashu@cisco.com>
@ashutosh-agrawal
ashutosh-agrawal force-pushed the fix/teammgr-interface-key-validation branch from 6809449 to d1011c8 Compare September 16, 2026 19:18
@mssonicbld

Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines

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

@ashutosh-agrawal
ashutosh-agrawal marked this pull request as ready for review September 16, 2026 19:23
@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:
There may be pipelines that require an authorized user to comment /azp run to run.

@mssonicbld

Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines

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

@ashutosh-agrawal

Copy link
Copy Markdown
Member Author

/azpw run

@mssonicbld

Copy link
Copy Markdown
Collaborator

⚠️ Notice: /azpw run only runs failed jobs now. If you want to trigger a whole pipline run, please rebase your branch or close and reopen the PR.
💡 Tip: You can also use /azpw retry to retry failed jobs directly.

Retrying failed(or canceled) jobs...

@mssonicbld

Copy link
Copy Markdown
Collaborator

Retrying failed(or canceled) stages in build 1223245:

✅Stage Test:

  • Job vstest: retried.

Signed-off-by: Ashutosh Agrawal <ashu@cisco.com>
@mssonicbld

Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines

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

Comment thread cfgmgr/teammgr.cpp
Signed-off-by: Ashutosh Agrawal <ashu@cisco.com>
@mssonicbld

Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines

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

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