0
0
Fork 0
mirror of https://github.com/NixOS/nixpkgs.git synced 2025-07-13 21:50:33 +03:00

nixos/networkd: add [Bridge] section to netdev conf

This setting was missing from netdev.

This commit additionally adds a test using the new
section, ensuring that STP can be enabled.
This commit is contained in:
Astrid Yu 2024-04-11 00:56:18 -07:00
parent ed817f4699
commit ed854ed0e3
5 changed files with 153 additions and 0 deletions

View file

@ -186,6 +186,37 @@ let
(assertNetdevMacAddress "MACAddress")
];
sectionBridge = checkUnitConfig "Bridge" [
(assertOnlyFields [
"HelloTimeSec"
"MaxAgeSec"
"ForwardDelaySec"
"AgeingTimeSec"
"Priority"
"GroupForwardMask"
"DefaultPVID"
"MulticastQuerier"
"MulticastSnooping"
"VLANFiltering"
"VLANProtocol"
"STP"
"MulticastIGMPVersion"
])
(assertInt "HelloTimeSec")
(assertInt "MaxAgeSec")
(assertInt "ForwardDelaySec")
(assertInt "AgeingTimeSec")
(assertRange "Priority" 0 65535)
(assertRange "GroupForwardMask" 0 65535)
(assertRangeOrOneOf "DefaultPVID" 0 4094 ["none"])
(assertValueOneOf "MulticastQuerier" boolValues)
(assertValueOneOf "MulticastSnooping" boolValues)
(assertValueOneOf "VLANFiltering" boolValues)
(assertValueOneOf "VLANProtocol" ["802.1q" "802.ad"])
(assertValueOneOf "STP" boolValues)
(assertValueOneOf "MulticastIGMPVersion" [2 3])
];
sectionVLAN = checkUnitConfig "VLAN" [
(assertOnlyFields [
"Id"
@ -1635,6 +1666,17 @@ let
'';
};
bridgeConfig = mkOption {
default = {};
example = { STP = true; };
type = types.addCheck (types.attrsOf unitOption) check.netdev.sectionBridge;
description = ''
Each attribute in this set specifies an option in the
`[Bridge]` section of the unit. See
{manpage}`systemd.netdev(5)` for details.
'';
};
vlanConfig = mkOption {
default = {};
example = { Id = 4; };