Scroll to navigation

BRIDGE-STP(8) System Manager's Manual BRIDGE-STP(8)

NAME

bridge-stp — kernel helper script that drives mstpd for Linux bridges

SYNOPSIS

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

DESCRIPTION

bridge-stp is the kernel STP helper script for mstpd(8). The Linux kernel runs /usr/sbin/bridge-stp bridge start when STP is enabled on a bridge (via brctl stp bridge on or ip link set bridge type bridge stp_state 1), and /usr/sbin/bridge-stp bridge stop when STP is disabled. If the script exits 0, the kernel switches the bridge into mode and lets mstpd(8) drive port states; if it exits non-zero, the kernel falls back to its built-in STP implementation.

On start, bridge-stp verifies that the bridge is listed in MSTP_BRIDGES, spawns mstpd(8) if it is 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.

bridge-stp must not be invoked directly with the start or stop arguments (the kernel does that); 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.

The restart and restart_config forms are intended for direct use by the administrator and are 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.
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 is no longer needed.
Stop mstpd(8) if it is running, start a fresh instance, then re-add and reconfigure every bridge that is currently in user_stp mode and listed in MSTP_BRIDGES.
Re-add and reconfigure every bridge that is currently in user_stp mode and listed in MSTP_BRIDGES, without restarting mstpd(8). Use after editing per-bridge configuration.

CONFIGURATION

bridge-stp sources /etc/bridge-stp.conf on every invocation. The following shell variables are recognised:

MANAGE_MSTPD
(the default) to let bridge-stp start and stop mstpd(8) on demand; n to require that mstpd(8) already be running.
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 empty (the default), every bridge is eligible.
LOGGER
Command used to log error messages. Default: logger -t bridge-stp -s. Set 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.
/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

Success.
Bad usage, missing root privileges, or bridge is not a bridge.
mstpctl(8) or mstpd(8) binaries are missing or not executable.
mstpd(8) or mstpctl(8) failed.
bridge is not listed in MSTP_BRIDGES and was therefore ignored (returned only on start).

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.

This manual page was written by Nadzeya Hutsko <nadzya.info@gmail.com>

April 28, 2026 Nixpkgs