diff options
author | apfelkuchen06 <apfelkuchen@hrnz.li> | 2023-02-28 00:06:39 +0100 |
---|---|---|
committer | apfelkuchen06 <apfelkuchen@hrnz.li> | 2023-03-16 03:28:21 +0100 |
commit | d646f7c7f2b69ef4d085f79f7805098b80dc8467 (patch) | |
tree | 647e2b725df9b2d3fac278c0a52c62d9eb8e8574 /nixos | |
parent | 28ddd570f70dd9fe160260672ebf687abc5f2585 (diff) | |
download | nixpkgs-d646f7c7f2b69ef4d085f79f7805098b80dc8467.tar nixpkgs-d646f7c7f2b69ef4d085f79f7805098b80dc8467.tar.gz nixpkgs-d646f7c7f2b69ef4d085f79f7805098b80dc8467.tar.bz2 nixpkgs-d646f7c7f2b69ef4d085f79f7805098b80dc8467.tar.lz nixpkgs-d646f7c7f2b69ef4d085f79f7805098b80dc8467.tar.xz nixpkgs-d646f7c7f2b69ef4d085f79f7805098b80dc8467.tar.zst nixpkgs-d646f7c7f2b69ef4d085f79f7805098b80dc8467.zip |
nixos/networkd: add BridgeFDB options
Diffstat (limited to 'nixos')
-rw-r--r-- | nixos/modules/system/boot/networkd.nix | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/nixos/modules/system/boot/networkd.nix b/nixos/modules/system/boot/networkd.nix index 7bebe3e2811..8b779ebcbf2 100644 --- a/nixos/modules/system/boot/networkd.nix +++ b/nixos/modules/system/boot/networkd.nix @@ -996,6 +996,23 @@ let (assertInt "Priority") (assertRange "Priority" 0 63) ]; + + sectionBridgeFDB = checkUnitConfig "BridgeFDB" [ + (assertOnlyFields [ + "MACAddress" + "Destination" + "VLANId" + "VNI" + "AssociatedWith" + "OutgoingInterface" + ]) + (assertHasField "MACAddress") + (assertInt "VLANId") + (assertRange "VLANId" 0 4094) + (assertInt "VNI") + (assertRange "VNI" 1 16777215) + (assertValueOneOf "AssociatedWith" [ "use" "self" "master" "router" ]) + ]; }; }; @@ -1431,6 +1448,21 @@ let }; }; + bridgeFDBOptions = { + options = { + bridgeFDBConfig = mkOption { + default = {}; + example = { MACAddress = "65:43:4a:5b:d8:5f"; Destination = "192.168.1.42"; VNI = 20; }; + type = types.addCheck (types.attrsOf unitOption) check.network.sectionBridgeFDB; + description = lib.mdDoc '' + Each attribute in this set specifies an option in the + `[BridgeFDB]` section of the unit. See + {manpage}`systemd.network(5)` for details. + ''; + }; + }; + }; + networkOptions = commonNetworkOptions // { linkConfig = mkOption { @@ -1581,6 +1613,16 @@ let ''; }; + bridgeFDBs = mkOption { + default = []; + example = [ { bridgeFDBConfig = { MACAddress = "90:e2:ba:43:fc:71"; Destination = "192.168.100.4"; VNI = 3600; }; } ]; + type = with types; listOf (submodule bridgeFDBOptions); + description = lib.mdDoc '' + A list of BridgeFDB sections to be added to the unit. See + {manpage}`systemd.network(5)` for details. + ''; + }; + name = mkOption { type = types.nullOr types.str; default = null; @@ -1992,6 +2034,10 @@ let [Bridge] ${attrsToSection def.bridgeConfig} '' + + flip concatMapStrings def.bridgeFDBs (x: '' + [BridgeFDB] + ${attrsToSection x.bridgeFDBConfig} + '') + def.extraConfig; }; |