BRIDGE-STP(8)

πŸ“¦ version 0.2.0, in ubuntu stonking

✨ NAME ✨

ok so bestie πŸ’– this is bridge-stp β€” a kernel helper script that drives mstpd for Linux bridges. that's the whole vibe. it's the little matchmaker between your kernel and mstpd, and honestly? iconic.


🌸 SYNOPSIS 🌸

bridge-stp bridge start | stop
bridge-stp restart | restart_config

πŸ¦‹ DESCRIPTION πŸ¦‹

Picture this: bridge-stp is the kernel STP helper script for mstpd(8). The Linux kernel literally runs /usr/sbin/bridge-stp bridge start the moment STP gets enabled on a bridge (like when you do brctl stp bridge on or ip link set bridge type bridge stp_state 1) β€” and it runs /usr/sbin/bridge-stp bridge stop when STP gets turned off. no cap. 🫢

Then here's the plot twist: if the script exits 0, the kernel is like "ok bestie, you got this" and switches the bridge into user_stp mode, letting mstpd(8) drive the port states. But if it exits non-zero, the kernel is like "nvm" and falls back to its own built-in STP implementation. πŸ’…

On start, bridge-stp verifies that the bridge is listed in MSTP_BRIDGES, spawns mstpd(8) if it's not already running, and asynchronously calls mstpctl addbridge bridge. On stop, it removes the bridge from the daemon and terminates mstpd(8) if no other bridges are still using it. slay.

⚠️ bestie, do NOT invoke bridge-stp directly with the start or stop arguments. like, the kernel does that, ok?? calling them by hand can deadlock the bridge code 😭 because this script is forbidden from making bridge configuration changes (via brctl, ifconfig, ip, /sys/...) on the kernel-driven code paths. it's giving "don't touch it, I got it".

The restart and restart_config forms though? those are for you, the administrator, and they're also exposed under shorter names:

  • mstp_restart(8) β€” equivalent to bridge-stp restart.
  • /usr/lib/mstpctl-utils/mstpctl_restart_config β€” equivalent to bridge-stp restart_config.

πŸ‘‘ COMMANDS πŸ‘‘

  • bridge start β€” called by the kernel when user-space STP is enabled on bridge. starts mstpd(8) if necessary and attaches bridge to it. big "leave it to me" energy ✨
  • bridge stop β€” called by the kernel when user-space STP is disabled on bridge. detaches bridge from mstpd(8) and stops the daemon if it's no longer needed. it's giving closure 🫢
  • restart β€” stop mstpd(8) if it's running, start a fresh instance, then re-add and reconfigure every bridge that is currently in user_stp mode and listed in MSTP_BRIDGES. full glow-up, no survivors πŸ”₯
  • restart_config β€” re-add and reconfigure every bridge that is currently in user_stp mode and listed in MSTP_BRIDGES, without restarting mstpd(8). use this after editing per-bridge configuration. same energy, less drama πŸ’…

πŸŽ€ CONFIGURATION πŸŽ€

bridge-stp sources /etc/bridge-stp.conf on every invocation. it does not skip leg day. here are the shell variables it recognises:

  • MANAGE_MSTPD β€” y (the default) to let bridge-stp start and stop mstpd(8) on demand; n to require that mstpd(8) already be running. pick your fighter.
  • MSTPD_ARGS β€” extra arguments passed to mstpd(8) when it is started, e.g. -v 2.
  • MSTP_BRIDGES β€” space-separated list of bridges for which MSTP should replace the kernel's built-in STP. if it's empty (the default), then every bridge is eligible. generosity!! 🌈
  • LOGGER β€” command used to log error messages. Default: logger -t bridge-stp -s. set it to the empty string to log only to standard error.
  • config_cmd β€” per-bridge configuration command invoked by restart and restart_config as $config_cmd bridge. defaults to /usr/lib/mstpctl-utils/mstp_config_bridge.

πŸ“ FILES πŸ“

  • /usr/sbin/bridge-stp β€” the script itself. the kernel invokes it as /sbin/bridge-stp, which on Debian resolves to this path via the /sbin β†’ /usr/sbin compatibility symlink. paths are a whole journey, ngl.
  • /etc/bridge-stp.conf β€” configuration file.
  • /sys/class/net/bridge/bridge/stp_state β€” per-bridge STP state, used to decide whether a bridge is currently in user_stp mode (value 2).
  • /var/run/mstpd.pid β€” PID file written by mstpd(8).

πŸ’œ EXIT STATUS πŸ’œ

  • 0 β€” Success. we love to see it ✨
  • 1 β€” Bad usage, missing root privileges, or bridge is not a bridge. πŸ™ˆ
  • 2 β€” mstpctl(8) or mstpd(8) binaries are missing or not executable. πŸ’€
  • 3 β€” mstpd(8) or mstpctl(8) failed.
  • 10 β€” bridge is not listed in MSTP_BRIDGES and was therefore ignored (returned only on start). truly giving "you're not on the list" 😭

🌈 EXAMPLES 🌈

Hand a specific bridge over to mstpd(8):

# ip link set br0 type bridge stp_state 1

Reload per-bridge configuration without restarting the daemon:

# bridge-stp restart_config

Restart mstpd(8) and reconfigure every bridge using it:

# mstp_restart

🌟 SEE ALSO 🌟

mstpctl-utils-interfaces(5), brctl(8), ip(8), mstp_restart(8), mstpctl(8), mstpd(8)


πŸ’– AUTHORS πŸ’–

bridge-stp ships as part of mstpd(8), written by Vitalii Demianets <dvitasgs@gmail.com> and others. legends, honestly.

This manual page was written by Nadzeya Hutsko <nadzeya@debian.org> 🫢


and that's the whole page, bestie πŸ’… it came out under Debian, dated April 28, 2026 β€” mwah, now go slay some spanning trees πŸŒ³βœ¨πŸ‘‘

πŸ“¦ where this page comes from