Merge pull request #274110 from networkException/sysctl-net.core.wmem_max

nixos/{sysctl,caddy}: improvements for net.core.wmem_max

authored by

Lin Jian and committed by
GitHub
73b3a145 9c33df09

+21 -10
+2
nixos/doc/manual/release-notes/rl-2405.section.md
··· 71 `globalRedirect` can now have redirect codes other than 301 through 72 `redirectCode`. 73 74 - Gitea 1.21 upgrade has several breaking changes, including: 75 - Custom themes and other assets that were previously stored in `custom/public/*` now belong in `custom/public/assets/*` 76 - New instances of Gitea using MySQL now ignore the `[database].CHARSET` config option and always use the `utf8mb4` charset, existing instances should migrate via the `gitea doctor convert` CLI command.
··· 71 `globalRedirect` can now have redirect codes other than 301 through 72 `redirectCode`. 73 74 + - [](#opt-boot.kernel.sysctl._net.core.wmem_max_) changed from a string to an integer because of the addition of a custom merge option (taking the highest value defined to avoid conflicts between 2 services trying to set that value), just as [](#opt-boot.kernel.sysctl._net.core.rmem_max_) since 22.11. 75 + 76 - Gitea 1.21 upgrade has several breaking changes, including: 77 - Custom themes and other assets that were previously stored in `custom/public/*` now belong in `custom/public/assets/*` 78 - New instances of Gitea using MySQL now ignore the `[database].CHARSET` config option and always use the `utf8mb4` charset, existing instances should migrate via the `gitea doctor convert` CLI command.
+16 -8
nixos/modules/config/sysctl.nix
··· 21 options = { 22 23 boot.kernel.sysctl = mkOption { 24 - type = types.submodule { 25 freeformType = types.attrsOf sysctlOption; 26 options."net.core.rmem_max" = mkOption { 27 - type = types.nullOr types.ints.unsigned // { 28 - merge = loc: defs: 29 - foldl 30 - (a: b: if b.value == null then null else lib.max a b.value) 31 - 0 32 - (filterOverrides defs); 33 - }; 34 default = null; 35 description = lib.mdDoc "The maximum socket receive buffer size. In case of conflicting values, the highest will be used."; 36 }; 37 }; 38 default = {};
··· 21 options = { 22 23 boot.kernel.sysctl = mkOption { 24 + type = let 25 + highestValueType = types.ints.unsigned // { 26 + merge = loc: defs: 27 + foldl 28 + (a: b: if b.value == null then null else lib.max a b.value) 29 + 0 30 + (filterOverrides defs); 31 + }; 32 + in types.submodule { 33 freeformType = types.attrsOf sysctlOption; 34 options."net.core.rmem_max" = mkOption { 35 + type = types.nullOr highestValueType; 36 default = null; 37 description = lib.mdDoc "The maximum socket receive buffer size. In case of conflicting values, the highest will be used."; 38 + }; 39 + 40 + options."net.core.wmem_max" = mkOption { 41 + type = types.nullOr highestValueType; 42 + default = null; 43 + description = lib.mdDoc "The maximum socket send buffer size. In case of conflicting values, the highest will be used."; 44 }; 45 }; 46 default = {};
+1 -1
nixos/modules/services/torrent/transmission.nix
··· 434 # at least up to the values hardcoded here: 435 (mkIf cfg.settings.utp-enabled { 436 "net.core.rmem_max" = mkDefault 4194304; # 4MB 437 - "net.core.wmem_max" = mkDefault "1048576"; # 1MB 438 }) 439 (mkIf cfg.performanceNetParameters { 440 # Increase the number of available source (local) TCP and UDP ports to 49151.
··· 434 # at least up to the values hardcoded here: 435 (mkIf cfg.settings.utp-enabled { 436 "net.core.rmem_max" = mkDefault 4194304; # 4MB 437 + "net.core.wmem_max" = mkDefault 1048576; # 1MB 438 }) 439 (mkIf cfg.performanceNetParameters { 440 # Increase the number of available source (local) TCP and UDP ports to 49151.
+2 -1
nixos/modules/services/web-servers/caddy/default.nix
··· 342 } 343 ''; 344 345 - # https://github.com/lucas-clemente/quic-go/wiki/UDP-Receive-Buffer-Size 346 boot.kernel.sysctl."net.core.rmem_max" = mkDefault 2500000; 347 348 systemd.packages = [ cfg.package ]; 349 systemd.services.caddy = {
··· 342 } 343 ''; 344 345 + # https://github.com/quic-go/quic-go/wiki/UDP-Buffer-Sizes 346 boot.kernel.sysctl."net.core.rmem_max" = mkDefault 2500000; 347 + boot.kernel.sysctl."net.core.wmem_max" = mkDefault 2500000; 348 349 systemd.packages = [ cfg.package ]; 350 systemd.services.caddy = {