Skip to content

fix: sync port_fast to APPL_DB on boot when portfast already configured#87

Open
salahadell wants to merge 1 commit intosonic-net:masterfrom
salahadell:fix/portfast-appl-db-boot-sync
Open

fix: sync port_fast to APPL_DB on boot when portfast already configured#87
salahadell wants to merge 1 commit intosonic-net:masterfrom
salahadell:fix/portfast-appl-db-boot-sync

Conversation

@salahadell
Copy link
Copy Markdown

Description

After a reboot, stpd initializes g_fastspan_config_mask to all-1s
(PORT_MASK_SET_ALL) as a boot-time default. When stpmgrd replays
persisted CONFIG_DB with portfast=true, stpmgr_config_fastspan()
hits the is_member guard and returns early without calling
stpsync_update_port_fast(). As a result, port_fast is never written
to APPL_DB and show spanning-tree displays PortFast as N even
though it is configured.

This only affects reboots: on first-time setup the CLI creates STP_PORT
entries with portfast=false, which triggers the disable path and clears
the mask bits before the user enables PortFast. After reboot the config
is already true so no disable/clear step occurs, leaving the guard
always firing on the enable path.

Fix

Ensure stpsync_update_port_fast() is called before the early
return in both the enable and disable branches of
stpmgr_config_fastspan(). This guarantees APPL_DB reflects the current
portfast state whenever config is replayed, regardless of the initial
mask value.

Testing

  • Configure portfast on an interface, reboot.
  • Verify show spanning-tree shows PortFast Y after boot.
  • Verify toggling portfast on/off still works correctly at runtime.

@mssonicbld
Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

Signed-off-by: Salah Adel <salah-adel2011@hotmail.com>
@salahadell salahadell force-pushed the fix/portfast-appl-db-boot-sync branch from d7f83ff to eb98497 Compare April 14, 2026 12:52
@mssonicbld
Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@salahadell
Copy link
Copy Markdown
Author

@divyachandralekha @lihuay , Could you please review this fix? It addresses a boot-time APPL_DB sync issue for PortFast configuration.

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