Skip to content

stp: Fix IPC layout and netlink handling between STPMGR and STP daemon - #97

Open
rdhegde wants to merge 6 commits into
sonic-net:masterfrom
rdhegde:rdhegde-pvst-stp
Open

stp: Fix IPC layout and netlink handling between STPMGR and STP daemon#97
rdhegde wants to merge 6 commits into
sonic-net:masterfrom
rdhegde:rdhegde-pvst-stp

Conversation

@rdhegde

@rdhegde rdhegde commented Jul 25, 2026

Copy link
Copy Markdown

Summary

  • Unify duplicated IPC structures between STPMGR and STP daemon into a
    single, packed definition with all required fields.
  • Add sanity checks and error logging for invalid IPC messages and
    unexpected protocol modes.
  • Fix stp_netlink_recv() passing an invalid if_db / ifname into
    stp_netlink_cb().

Motivation

PVST configuration fails when STPMGR and the STP daemon exchange
inconsistent or incomplete IPC data, or when netlink callbacks operate on
invalid interface state. This PR fixes the daemon-side IPC and netlink
handling required for PVST to work reliably.

Part of PVST fix series for #28624.

Changes

  • IPC structures
    • Remove duplicate IPC definitions between STPMGR and STP daemon
    • Pack all IPC structures and add missing structure members
  • Error handling
    • Add sanity check in stp_intf_netlink_cb()
    • Add error logs in stpmgr_process_ipc_msg() for unexpected protocol modes
  • Netlink
    • Fix stp_netlink_recv() calling stp_netlink_cb() with invalid
      if_db / ifname

Related PRs

Repo PR
sonic-buildimage sonic-net/sonic-buildimage#...
sonic-swss sonic-net/sonic-swss#4790
sonic-utilities sonic-net/sonic-utilities#4716

Verification

  • 3-node PVST topology (GNS3 sonic-vs): config reached STP daemon,
    PVST converged
  • Marvell Prestera switches: same PVST validation

Notes for reviewers

  • Start with shared IPC header/struct definitions, then netlink callback path
  • IPC packing changes affect STPMGR ↔ STP message layout; review together
    with sonic-swss#4790

rdhegde added 5 commits July 9, 2026 10:00
- Packed stp IPC structures
- Added missing parameter `loop_guard` to align with swss(stpmgr)
- Renamed parameters: `edge` and `max_hop` to align with swss(stpmgr)
- Renamed MST_INST_CONFIG_MSG to STP_MST_INST_CONFIG_MSG for consistency

Signed-off-by: Ram Hegde <rhegde@marvell.com>
- fix socket return handling
- remove unused variable

Signed-off-by: Ram Hegde <rhegde@marvell.com>
Signed-off-by: Ram Hegde <rhegde@marvell.com>
- uninitialized if_db.ifname is not handled before calling
  stp_netlink_cb()

Signed-off-by: Ram Hegde <rhegde@marvell.com>
Signed-off-by: Ram Hegde <rhegde@marvell.com>
@linux-foundation-easycla

linux-foundation-easycla Bot commented Jul 25, 2026

Copy link
Copy Markdown

CLA Signed
The committers listed above are authorized under a signed CLA.

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

@rdhegde

rdhegde commented Jul 25, 2026

Copy link
Copy Markdown
Author

/easycla

* In stpmgr_process_rx_bpdu(), when PVST BPDUs has no VLAN get the
  port's untagged VLAN
* Fixed typos in code comments

Signed-off-by: Ram Hegde <rhegde@marvell.com>
@rdhegde
rdhegde force-pushed the rdhegde-pvst-stp branch from 1aa8c23 to 334e762 Compare July 25, 2026 13:55
@mssonicbld

Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines

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

@rdhegde rdhegde changed the title PVST bug fixes stp: Fix IPC layout and netlink handling between STPMGR and STP daemon Jul 28, 2026
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