networkd: Allow combinations of WakeOnLan policies

To comply with the systemd.link WakeOnLan[^1] specification, the option
"off" and all other possible policy combinations must be allowed.

[^1]: https://www.freedesktop.org/software/systemd/man/systemd.link.html#WakeOnLan=
This commit is contained in:
ign0tus 2023-09-28 17:04:35 +02:00
parent d76e8633bf
commit 237f7ba7d2
2 changed files with 5 additions and 1 deletions

View File

@ -80,6 +80,10 @@ in rec {
optional (attr ? ${name} && !elem attr.${name} values)
"Systemd ${group} field `${name}' cannot have value `${toString attr.${name}}'.";
assertValuesSomeOfOr = name: values: default: group: attr:
optional (attr ? ${name} && !(all (x: elem x values) (splitString " " attr.${name}) || attr.${name} == default))
"Systemd ${group} field `${name}' cannot have value `${toString attr.${name}}'.";
assertHasField = name: group: attr:
optional (!(attr ? ${name}))
"Systemd ${group} field `${name}' must exist.";

View File

@ -83,7 +83,7 @@ let
(assertByteFormat "BitsPerSecond")
(assertValueOneOf "Duplex" ["half" "full"])
(assertValueOneOf "AutoNegotiation" boolValues)
(assertValueOneOf "WakeOnLan" ["phy" "unicast" "multicast" "broadcast" "arp" "magic" "secureon" "off"])
(assertValuesSomeOfOr "WakeOnLan" ["phy" "unicast" "multicast" "broadcast" "arp" "magic" "secureon"] "off")
(assertValueOneOf "Port" ["tp" "aui" "bnc" "mii" "fibre"])
(assertValueOneOf "ReceiveChecksumOffload" boolValues)
(assertValueOneOf "TransmitChecksumOffload" boolValues)