Simplifying defaultGatewayWindowSize according to Eelco suggestions
This commit is contained in:
parent
9a81748f20
commit
38af598658
@ -5,10 +5,6 @@ with pkgs.lib;
|
|||||||
let
|
let
|
||||||
|
|
||||||
cfg = config.networking;
|
cfg = config.networking;
|
||||||
|
|
||||||
windowSize = if cfg.defaultGatewayWindowSize != "" then
|
|
||||||
"window ${cfg.defaultGatewayWindowSize}" else "";
|
|
||||||
|
|
||||||
interfaces = attrValues cfg.interfaces;
|
interfaces = attrValues cfg.interfaces;
|
||||||
hasVirtuals = any (i: i.virtual) interfaces;
|
hasVirtuals = any (i: i.virtual) interfaces;
|
||||||
|
|
||||||
@ -140,8 +136,9 @@ in
|
|||||||
};
|
};
|
||||||
|
|
||||||
networking.defaultGatewayWindowSize = mkOption {
|
networking.defaultGatewayWindowSize = mkOption {
|
||||||
default = "";
|
default = null;
|
||||||
example = "524288";
|
example = 524288;
|
||||||
|
type = types.nullOr types.int;
|
||||||
description = ''
|
description = ''
|
||||||
The window size of the default gateway. It limits maximal data bursts that TCP peers
|
The window size of the default gateway. It limits maximal data bursts that TCP peers
|
||||||
are allowed to send to us.
|
are allowed to send to us.
|
||||||
@ -295,7 +292,9 @@ in
|
|||||||
# Set the default gateway.
|
# Set the default gateway.
|
||||||
${optionalString (cfg.defaultGateway != "") ''
|
${optionalString (cfg.defaultGateway != "") ''
|
||||||
# FIXME: get rid of "|| true" (necessary to make it idempotent).
|
# 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.
|
# Turn on forwarding if any interface has enabled proxy_arp.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user