summary refs log tree commit diff
path: root/nixos/modules/system/boot/networkd.nix
diff options
context:
space:
mode:
authorapfelkuchen06 <apfelkuchen@hrnz.li>2023-02-28 00:06:41 +0100
committerapfelkuchen06 <apfelkuchen@hrnz.li>2023-03-16 03:31:04 +0100
commit493ed754187177260848764e3a0c5ea5515984e3 (patch)
tree19b4b2c0b64bd342b8fcb58be1fccf3a9def48ec /nixos/modules/system/boot/networkd.nix
parent88d99a36305d9387383baf7eb88c86e02541f703 (diff)
downloadnixpkgs-493ed754187177260848764e3a0c5ea5515984e3.tar
nixpkgs-493ed754187177260848764e3a0c5ea5515984e3.tar.gz
nixpkgs-493ed754187177260848764e3a0c5ea5515984e3.tar.bz2
nixpkgs-493ed754187177260848764e3a0c5ea5515984e3.tar.lz
nixpkgs-493ed754187177260848764e3a0c5ea5515984e3.tar.xz
nixpkgs-493ed754187177260848764e3a0c5ea5515984e3.tar.zst
nixpkgs-493ed754187177260848764e3a0c5ea5515984e3.zip
nixos/networkd: add HeavyHitterFilter options
Diffstat (limited to 'nixos/modules/system/boot/networkd.nix')
-rw-r--r--nixos/modules/system/boot/networkd.nix25
1 files changed, 25 insertions, 0 deletions
diff --git a/nixos/modules/system/boot/networkd.nix b/nixos/modules/system/boot/networkd.nix
index de94668bb24..31f4f11616a 100644
--- a/nixos/modules/system/boot/networkd.nix
+++ b/nixos/modules/system/boot/networkd.nix
@@ -1386,6 +1386,16 @@ let
           "CeilBufferBytes"
         ])
       ];
+
+      sectionHeavyHitterFilter = checkUnitConfig "HeavyHitterFilter" [
+        (assertOnlyFields [
+          "Parent"
+          "Handle"
+          "PacketLimit"
+        ])
+        (assertInt "PacketLimit")
+        (assertRange "PacketLimit" 0 4294967294)
+      ];
     };
   };
 
@@ -2296,6 +2306,17 @@ let
       '';
     };
 
+    heavyHitterFilterConfig = mkOption {
+      default = {};
+      example = { Parent = "root"; PacketLimit = 10000; };
+      type = types.addCheck (types.attrsOf unitOption) check.network.sectionHeavyHitterFilter;
+      description = lib.mdDoc ''
+        Each attribute in this set specifies an option in the
+        `[HeavyHitterFilter]` section of the unit.  See
+        {manpage}`systemd.network(5)` for details.
+      '';
+    };
+
     name = mkOption {
       type = types.nullOr types.str;
       default = null;
@@ -2815,6 +2836,10 @@ let
           [HierarchyTokenBucketClass]
           ${attrsToSection def.hierarchyTokenBucketClassConfig}
         ''
+        + optionalString (def.heavyHitterFilterConfig != { }) ''
+          [HeavyHitterFilter]
+          ${attrsToSection def.heavyHitterFilterConfig}
+        ''
         + def.extraConfig;
     };