nixos/systemd-networkd: Allow three value variant in ipv6AcceptRAConfig.RouteMetric option (#507540)
This commit is contained in:
@@ -278,6 +278,21 @@ rec {
|
||||
attr ? ${name} && !(hasPrefix "@" attr.${name})
|
||||
) "Systemd ${group} field `${name}' is not a systemd credential";
|
||||
|
||||
assertRouteMetricOrTriple =
|
||||
name: group: attr:
|
||||
let
|
||||
isMetric = n: 0 <= n && 4294967295 >= n;
|
||||
|
||||
parts = splitString ":" attr.${name};
|
||||
partsValid =
|
||||
length parts == 3 && all (p: (match "[0-9]+" p) != null && isMetric (toIntBase10 p)) parts;
|
||||
valid = (isInt attr.${name} && isMetric attr.${name}) || partsValid;
|
||||
in
|
||||
optional (attr ? ${name} && !valid) (
|
||||
"Systemd ${group} field `${name}' must either be an integer in the range [0,4294967295]"
|
||||
+ " or a string containing three integers separated with `:`"
|
||||
);
|
||||
|
||||
checkUnitConfig =
|
||||
group: checks: attrs:
|
||||
let
|
||||
|
||||
@@ -1744,8 +1744,7 @@ let
|
||||
(assertValueOneOf "UseDNR" boolValues)
|
||||
(assertValueOneOf "UseDomains" (boolValues ++ [ "route" ]))
|
||||
(assertRange "RouteTable" 0 4294967295)
|
||||
(assertInt "RouteMetric")
|
||||
(assertRange "RouteMetric" 0 4294967295)
|
||||
(assertRouteMetricOrTriple "RouteMetric")
|
||||
(assertValueOneOf "QuickAck" boolValues)
|
||||
(assertValueOneOf "UseMTU" boolValues)
|
||||
(assertValueOneOf "UseHopLimit" boolValues)
|
||||
|
||||
Reference in New Issue
Block a user