diff options
author | n0emis <22817873+n0emis@users.noreply.github.com> | 2021-11-16 23:41:17 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-16 23:41:17 +0100 |
commit | eeac1c543d398f167f8886883824fc99266aad40 (patch) | |
tree | 157f2c17d5cb57585ed8b05ea391fc207e445593 /nixos/modules/system/boot/networkd.nix | |
parent | f03db46d3d9b6a7ff52678934e20cb58d987ba2c (diff) | |
download | nixpkgs-eeac1c543d398f167f8886883824fc99266aad40.tar nixpkgs-eeac1c543d398f167f8886883824fc99266aad40.tar.gz nixpkgs-eeac1c543d398f167f8886883824fc99266aad40.tar.bz2 nixpkgs-eeac1c543d398f167f8886883824fc99266aad40.tar.lz nixpkgs-eeac1c543d398f167f8886883824fc99266aad40.tar.xz nixpkgs-eeac1c543d398f167f8886883824fc99266aad40.tar.zst nixpkgs-eeac1c543d398f167f8886883824fc99266aad40.zip |
nixos/networkd: add BatmanAdvanced options (#145963)
Since systemd v248 networkd supports BatmanAdvanced. This adds the according config options to the networkd-module
Diffstat (limited to 'nixos/modules/system/boot/networkd.nix')
-rw-r--r-- | nixos/modules/system/boot/networkd.nix | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/nixos/modules/system/boot/networkd.nix b/nixos/modules/system/boot/networkd.nix index 662dfe2db98..2e17bdf6bb6 100644 --- a/nixos/modules/system/boot/networkd.nix +++ b/nixos/modules/system/boot/networkd.nix @@ -131,6 +131,7 @@ let "fou" "xfrm" "ifb" + "batadv" ]) (assertByteFormat "MTUBytes") (assertMacAddress "MACAddress") @@ -381,6 +382,29 @@ let (assertInt "Table") (assertMinimum "Table" 0) ]; + + sectionBatmanAdvanced = checkUnitConfig "BatmanAdvanced" [ + (assertOnlyFields [ + "GatewayMode" + "Aggregation" + "BridgeLoopAvoidance" + "DistributedArpTable" + "Fragmentation" + "HopPenalty" + "OriginatorIntervalSec" + "GatewayBandwithDown" + "GatewayBandwithUp" + "RoutingAlgorithm" + ]) + (assertValueOneOf "GatewayMode" ["off" "client" "server"]) + (assertValueOneOf "Aggregation" boolValues) + (assertValueOneOf "BridgeLoopAvoidance" boolValues) + (assertValueOneOf "DistributedArpTable" boolValues) + (assertValueOneOf "Fragmentation" boolValues) + (assertInt "HopPenalty") + (assertRange "HopPenalty" 0 255) + (assertValueOneOf "RoutingAlgorithm" ["batman-v" "batman-iv"]) + ]; }; network = { @@ -473,6 +497,7 @@ let "IgnoreCarrierLoss" "Xfrm" "KeepConfiguration" + "BatmanAdvanced" ]) # Note: For DHCP the values both, none, v4, v6 are deprecated (assertValueOneOf "DHCP" ["yes" "no" "ipv4" "ipv6"]) @@ -1056,6 +1081,21 @@ let ''; }; + batmanAdvancedConfig = mkOption { + default = {}; + example = { + GatewayMode = "server"; + RoutingAlgorithm = "batman-v"; + }; + type = types.addCheck (types.attrsOf unitOption) check.netdev.sectionBatmanAdvanced; + description = '' + Each attribute in this set specifies an option in the + <literal>[BatmanAdvanced]</literal> section of the unit. See + <citerefentry><refentrytitle>systemd.netdev</refentrytitle> + <manvolnum>5</manvolnum></citerefentry> for details. + ''; + }; + }; addressOptions = { @@ -1507,6 +1547,10 @@ let [VRF] ${attrsToSection def.vrfConfig} '' + + optionalString (def.batmanAdvancedConfig != { }) '' + [BatmanAdvanced] + ${attrsToSection def.batmanAdvancedConfig} + '' + def.extraConfig; }; |