From 846f4af7a5c8c9529b403639365f425c93b90d77 Mon Sep 17 00:00:00 2001 From: Patryk Wychowaniec Date: Sat, 3 Jan 2026 16:56:51 +0100 Subject: [PATCH 1/3] mstpd: 0.0.8 -> 0.1.0 --- pkgs/by-name/ms/mstpd/package.nix | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/pkgs/by-name/ms/mstpd/package.nix b/pkgs/by-name/ms/mstpd/package.nix index 8ac547aa902a..e2c6fac0d045 100644 --- a/pkgs/by-name/ms/mstpd/package.nix +++ b/pkgs/by-name/ms/mstpd/package.nix @@ -8,30 +8,23 @@ stdenv.mkDerivation (finalAttrs: { pname = "mstpd"; - version = "0.0.8"; + version = "0.1.0"; src = fetchFromGitHub { owner = "mstpd"; repo = "mstpd"; rev = finalAttrs.version; - sha256 = "1xkfydxljdnj49p5r3mirk4k146428b6imfc9bkfps9yjn64mkgb"; + hash = "sha256-m4gbVXAPIYGQvTFaSziFuOO6say5kgUsk7NSdqXgKmA="; }; - patches = [ - (fetchpatch { - name = "fix-strncpy-gcc9.patch"; - url = "https://github.com/mstpd/mstpd/commit/d27d7e93485d881d8ff3a7f85309b545edbe1fc6.patch"; - sha256 = "19456daih8l3y6m9kphjr7pj7slrqzbj6yacnlgznpxyd8y4d86y"; - }) - ]; - nativeBuildInputs = [ autoreconfHook ]; configureFlags = [ "--prefix=$(out)" "--sysconfdir=$(out)/etc" - "--sbindir=$(out)/sbin" + "--sbindir=$(out)/bin" "--libexecdir=$(out)/lib" + "--with-bashcompletiondir=$(out)/share/bash-completion/completions" ]; meta = { From fff32c002caea11faeb13d94c425f269c2a5225d Mon Sep 17 00:00:00 2001 From: Patryk Wychowaniec Date: Sat, 17 Jan 2026 14:11:39 +0100 Subject: [PATCH 2/3] nixos/tests/rstp: init --- nixos/tests/all-tests.nix | 1 + nixos/tests/containers-restart_networking.nix | 31 --------- nixos/tests/rstp.nix | 66 +++++++++++++++++++ 3 files changed, 67 insertions(+), 31 deletions(-) create mode 100644 nixos/tests/rstp.nix diff --git a/nixos/tests/all-tests.nix b/nixos/tests/all-tests.nix index 2b538a450c2f..1a2a22a02903 100644 --- a/nixos/tests/all-tests.nix +++ b/nixos/tests/all-tests.nix @@ -1408,6 +1408,7 @@ in rspamd-trainer = runTest ./rspamd-trainer.nix; rss-bridge = handleTest ./web-apps/rss-bridge { }; rss2email = handleTest ./rss2email.nix { }; + rstp = runTest ./rstp.nix; rstudio-server = runTest ./rstudio-server.nix; rsync = runTest ./rsync.nix; rsyncd = runTest ./rsyncd.nix; diff --git a/nixos/tests/containers-restart_networking.nix b/nixos/tests/containers-restart_networking.nix index aef845a90ed8..42b8351afdf7 100644 --- a/nixos/tests/containers-restart_networking.nix +++ b/nixos/tests/containers-restart_networking.nix @@ -55,24 +55,6 @@ ]; }; }; - - specialisation.eth1-rstp.configuration = { - networking.bridges.br0 = { - interfaces = [ "eth1" ]; - rstp = lib.mkForce true; - }; - - networking.interfaces = { - eth1.ipv4.addresses = lib.mkForce [ ]; - eth1.ipv6.addresses = lib.mkForce [ ]; - br0.ipv4.addresses = [ - { - address = "192.168.1.2"; - prefixLength = 24; - } - ]; - }; - }; }; }; @@ -100,19 +82,6 @@ "grep eth1 /run/br0.interfaces >&2", ) - # activating rstp needs another service, therefore the bridge will restart and the container will lose its connectivity - # with subtest("Bridged configuration with STP"): - # client.succeed("/run/booted-system/specialisation/eth1-rstp/bin/switch-to-configuration test >&2") - # client.execute("ip -4 a >&2") - # client.execute("ip l >&2") - # - # client.succeed( - # "ping 192.168.1.122 -c 1 -n >&2", - # "nixos-container run webserver -- ping -c 1 -n 192.168.1.2 >&2", - # "ip l show eth1 |grep 'master br0' >&2", - # "grep eth1 /run/br0.interfaces >&2", - # ) - with subtest("Reverting to initial configuration preserves connectivity"): client.succeed( "/run/booted-system/bin/switch-to-configuration test >&2" diff --git a/nixos/tests/rstp.nix b/nixos/tests/rstp.nix new file mode 100644 index 000000000000..23477f5a63d8 --- /dev/null +++ b/nixos/tests/rstp.nix @@ -0,0 +1,66 @@ +{ pkgs, lib, ... }: +{ + name = "rstp"; + + nodes = { + client = { + containers = { + peer = { + autoStart = true; + privateNetwork = true; + hostBridge = "br0"; + + config = { + networking = { + interfaces = { + eth0 = { + ipv4.addresses = [ + { + address = "192.168.1.122"; + prefixLength = 24; + } + ]; + }; + }; + }; + }; + }; + }; + + networking = { + bridges = { + br0 = { + interfaces = [ ]; + rstp = true; + }; + }; + + interfaces = { + eth1 = { + ipv4.addresses = lib.mkForce [ ]; + ipv6.addresses = lib.mkForce [ ]; + }; + + br0 = { + ipv4.addresses = [ + { + address = "192.168.1.2"; + prefixLength = 24; + } + ]; + }; + }; + }; + + virtualisation = { + vlans = [ 1 ]; + }; + }; + }; + + testScript = '' + client.start() + client.wait_for_unit("default.target") + client.wait_until_succeeds("journalctl | grep 'Port vb-peer : up'", timeout=10) + ''; +} From 7109a7914bd5402c961482e5e39a81b7ec5ae942 Mon Sep 17 00:00:00 2001 From: Patryk Wychowaniec Date: Sat, 17 Jan 2026 14:23:51 +0100 Subject: [PATCH 3/3] mstpd: remove `$out/bin/bridge-stp` --- pkgs/by-name/ms/mstpd/package.nix | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/pkgs/by-name/ms/mstpd/package.nix b/pkgs/by-name/ms/mstpd/package.nix index e2c6fac0d045..6851c95f2646 100644 --- a/pkgs/by-name/ms/mstpd/package.nix +++ b/pkgs/by-name/ms/mstpd/package.nix @@ -27,6 +27,20 @@ stdenv.mkDerivation (finalAttrs: { "--with-bashcompletiondir=$(out)/share/bash-completion/completions" ]; + # bridge-stp is a helper called by the kernel whenever STP is enabled/disabled + # on a bridge - the built-in version is incompatible with NixOS, so there's no + # point keeping it around. + # + # An alternative script gets automatically generated by NixOS network module + # whenever a bridge needs mstpd (grep for `bridgeStp`). + postInstall = '' + rm $out/bin/bridge-stp + + # Remove now-dangling symlinks, too + rm $out/bin/mstp_restart + rm $out/lib/mstpctl-utils/mstpctl_restart_config + ''; + meta = { description = "Multiple Spanning Tree Protocol daemon"; homepage = "https://github.com/mstpd/mstpd";