nixos/networkd: add [IPVLAN] and [IPVTAP] configuration options to systemd.netdev files
[IPVLAN](https://www.freedesktop.org/software/systemd/man/latest/systemd.netdev.html#%5BIPVLAN%5D%20Section%20Options) [IPVTAP](https://www.freedesktop.org/software/systemd/man/latest/systemd.netdev.html#%5BIPVTAP%5D%20Section%20Options)
This commit is contained in:
parent
7686f24675
commit
bc7a939ced
2 changed files with 40 additions and 0 deletions
|
@ -23,6 +23,12 @@ in {
|
|||
'' + optionalString (def.vlanConfig != { }) ''
|
||||
[VLAN]
|
||||
${attrsToSection def.vlanConfig}
|
||||
'' + optionalString (def.ipvlanConfig != { }) ''
|
||||
[IPVLAN]
|
||||
${attrsToSection def.ipvlanConfig}
|
||||
'' + optionalString (def.ipvtapConfig != { }) ''
|
||||
[IPVTAP]
|
||||
${attrsToSection def.ipvtapConfig}
|
||||
'' + optionalString (def.macvlanConfig != { }) ''
|
||||
[MACVLAN]
|
||||
${attrsToSection def.macvlanConfig}
|
||||
|
|
|
@ -122,6 +122,16 @@ let
|
|||
(assertValueOneOf "PacketInfo" boolValues)
|
||||
(assertValueOneOf "VNetHeader" boolValues)
|
||||
];
|
||||
|
||||
# See https://www.freedesktop.org/software/systemd/man/latest/systemd.netdev.html#%5BIPVTAP%5D%20Section%20Options
|
||||
ipVlanVtapChecks = [
|
||||
(assertOnlyFields [
|
||||
"Mode"
|
||||
"Flags"
|
||||
])
|
||||
(assertValueOneOf "Mode" ["L2" "L3" "L3S" ])
|
||||
(assertValueOneOf "Flags" ["private" "vepa" "bridge" ])
|
||||
];
|
||||
in {
|
||||
|
||||
sectionNetdev = checkUnitConfig "Netdev" [
|
||||
|
@ -192,6 +202,10 @@ let
|
|||
(assertValueOneOf "ReorderHeader" boolValues)
|
||||
];
|
||||
|
||||
sectionIPVLAN = checkUnitConfig "IPVLAN" ipVlanVtapChecks;
|
||||
|
||||
sectionIPVTAP = checkUnitConfig "IPVTAP" ipVlanVtapChecks;
|
||||
|
||||
sectionMACVLAN = checkUnitConfig "MACVLAN" [
|
||||
(assertOnlyFields [
|
||||
"Mode"
|
||||
|
@ -1625,6 +1639,26 @@ let
|
|||
'';
|
||||
};
|
||||
|
||||
ipvlanConfig = mkOption {
|
||||
default = {};
|
||||
example = { Mode = "L2"; Flags = "private"; };
|
||||
type = types.addCheck (types.attrsOf unitOption) check.netdev.sectionIPVLAN;
|
||||
description = lib.mdDoc ''
|
||||
Each attribute in this set specifies an option in the `[IPVLAN]` section of the unit.
|
||||
See {manpage}`systemd.netdev(5)` for details.
|
||||
'';
|
||||
};
|
||||
|
||||
ipvtapConfig = mkOption {
|
||||
default = {};
|
||||
example = { Mode = "L3"; Flags = "vepa"; };
|
||||
type = types.addCheck (types.attrsOf unitOption) check.netdev.sectionIPVTAP;
|
||||
description = lib.mdDoc ''
|
||||
Each attribute in this set specifies an option in the `[IPVTAP]` section of the unit.
|
||||
See {manpage}`systemd.netdev(5)` for details.
|
||||
'';
|
||||
};
|
||||
|
||||
macvlanConfig = mkOption {
|
||||
default = {};
|
||||
example = { Mode = "private"; };
|
||||
|
|
Loading…
Reference in a new issue