nixos/networkd: add PFIFOHeadDrop options

This commit is contained in:
apfelkuchen06 2023-02-28 00:06:40 +01:00
parent d9e1963a15
commit f75ec30fee

View File

@ -1180,7 +1180,7 @@ let
"LimitBytes"
])
];
};
sectionPFIFO = checkUnitConfig "PFIFO" [
(assertOnlyFields [
"Parent"
@ -1190,6 +1190,16 @@ let
(assertInt "PacketLimit")
(assertRange "PacketLimit" 0 4294967294)
];
sectionPFIFOHeadDrop = checkUnitConfig "PFIFOHeadDrop" [
(assertOnlyFields [
"Parent"
"Handle"
"PacketLimit"
])
(assertInt "PacketLimit")
(assertRange "PacketLimit" 0 4294967294)
];
};
};
@ -1957,6 +1967,17 @@ let
'';
};
pfifoHeadDropConfig = mkOption {
default = {};
example = { Parent = "ingress"; PacketLimit = "300"; };
type = types.addCheck (types.attrsOf unitOption) check.network.sectionPFIFOHeadDrop;
description = lib.mdDoc ''
Each attribute in this set specifies an option in the
`[PFIFOHeadDrop]` section of the unit. See
{manpage}`systemd.network(5)` for details.
'';
};
name = mkOption {
type = types.nullOr types.str;
default = null;
@ -2424,6 +2445,10 @@ let
[PFIFO]
${attrsToSection def.pfifoConfig}
''
+ optionalString (def.pfifoHeadDropConfig != { }) ''
[PFIFOHeadDrop]
${attrsToSection def.pfifoHeadDropConfig}
''
+ def.extraConfig;
};