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
|
@ -23,6 +23,12 @@ in {
|
||||||
'' + optionalString (def.vlanConfig != { }) ''
|
'' + optionalString (def.vlanConfig != { }) ''
|
||||||
[VLAN]
|
[VLAN]
|
||||||
${attrsToSection def.vlanConfig}
|
${attrsToSection def.vlanConfig}
|
||||||
|
'' + optionalString (def.ipvlanConfig != { }) ''
|
||||||
|
[IPVLAN]
|
||||||
|
${attrsToSection def.ipvlanConfig}
|
||||||
|
'' + optionalString (def.ipvtapConfig != { }) ''
|
||||||
|
[IPVTAP]
|
||||||
|
${attrsToSection def.ipvtapConfig}
|
||||||
'' + optionalString (def.macvlanConfig != { }) ''
|
'' + optionalString (def.macvlanConfig != { }) ''
|
||||||
[MACVLAN]
|
[MACVLAN]
|
||||||
${attrsToSection def.macvlanConfig}
|
${attrsToSection def.macvlanConfig}
|
||||||
|
|
|
@ -122,6 +122,16 @@ let
|
||||||
(assertValueOneOf "PacketInfo" boolValues)
|
(assertValueOneOf "PacketInfo" boolValues)
|
||||||
(assertValueOneOf "VNetHeader" 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 {
|
in {
|
||||||
|
|
||||||
sectionNetdev = checkUnitConfig "Netdev" [
|
sectionNetdev = checkUnitConfig "Netdev" [
|
||||||
|
@ -192,6 +202,10 @@ let
|
||||||
(assertValueOneOf "ReorderHeader" boolValues)
|
(assertValueOneOf "ReorderHeader" boolValues)
|
||||||
];
|
];
|
||||||
|
|
||||||
|
sectionIPVLAN = checkUnitConfig "IPVLAN" ipVlanVtapChecks;
|
||||||
|
|
||||||
|
sectionIPVTAP = checkUnitConfig "IPVTAP" ipVlanVtapChecks;
|
||||||
|
|
||||||
sectionMACVLAN = checkUnitConfig "MACVLAN" [
|
sectionMACVLAN = checkUnitConfig "MACVLAN" [
|
||||||
(assertOnlyFields [
|
(assertOnlyFields [
|
||||||
"Mode"
|
"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 {
|
macvlanConfig = mkOption {
|
||||||
default = {};
|
default = {};
|
||||||
example = { Mode = "private"; };
|
example = { Mode = "private"; };
|
||||||
|
|
Loading…
Reference in New Issue
Block a user