summary refs log tree commit diff
path: root/modules/tasks/network-interfaces.nix
diff options
context:
space:
mode:
authorLluís Batlle i Rossell <viric@viric.name>2013-01-06 23:20:48 +0100
committerLluís Batlle i Rossell <viric@viric.name>2013-01-06 23:20:48 +0100
commit38af5986584621921c438c8bee08747f202106c1 (patch)
tree1f97502c3c78063b90cb51985af13dfad307c5ca /modules/tasks/network-interfaces.nix
parent9a81748f2044ccea5e5083e3c8b38c4f6f79cda6 (diff)
downloadnixpkgs-38af5986584621921c438c8bee08747f202106c1.tar
nixpkgs-38af5986584621921c438c8bee08747f202106c1.tar.gz
nixpkgs-38af5986584621921c438c8bee08747f202106c1.tar.bz2
nixpkgs-38af5986584621921c438c8bee08747f202106c1.tar.lz
nixpkgs-38af5986584621921c438c8bee08747f202106c1.tar.xz
nixpkgs-38af5986584621921c438c8bee08747f202106c1.tar.zst
nixpkgs-38af5986584621921c438c8bee08747f202106c1.zip
Simplifying defaultGatewayWindowSize according to Eelco suggestions
Diffstat (limited to 'modules/tasks/network-interfaces.nix')
-rw-r--r--modules/tasks/network-interfaces.nix13
1 files changed, 6 insertions, 7 deletions
diff --git a/modules/tasks/network-interfaces.nix b/modules/tasks/network-interfaces.nix
index 740c3b83cda..bbc357b1b29 100644
--- a/modules/tasks/network-interfaces.nix
+++ b/modules/tasks/network-interfaces.nix
@@ -5,10 +5,6 @@ with pkgs.lib;
 let
 
   cfg = config.networking;
-
-  windowSize = if cfg.defaultGatewayWindowSize != "" then 
-    "window ${cfg.defaultGatewayWindowSize}" else "";
-
   interfaces = attrValues cfg.interfaces;
   hasVirtuals = any (i: i.virtual) interfaces;
 
@@ -140,8 +136,9 @@ in
     };
 
     networking.defaultGatewayWindowSize = mkOption {
-      default = "";
-      example = "524288";
+      default = null;
+      example = 524288;
+      type = types.nullOr types.int;
       description = ''
         The window size of the default gateway. It limits maximal data bursts that TCP peers
         are allowed to send to us.
@@ -295,7 +292,9 @@ in
                 # Set the default gateway.
                 ${optionalString (cfg.defaultGateway != "") ''
                   # FIXME: get rid of "|| true" (necessary to make it idempotent).
-                  ip route add default via "${cfg.defaultGateway}" ${windowSize} || true
+                  ip route add default via "${cfg.defaultGateway}" ${
+                    optionalString (cfg.defaultGatewayWindowSize != null)
+                      "window ${cfg.defaultGatewayWindowSize}"} || true
                 ''}
 
                 # Turn on forwarding if any interface has enabled proxy_arp.