mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-20 12:42:24 +00:00
nixos/networkd: add BatmanAdvanced options (#145963)
Since systemd v248 networkd supports BatmanAdvanced. This adds the according config options to the networkd-module
This commit is contained in:
parent
f03db46d3d
commit
eeac1c543d
|
@ -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;
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue