Adding defaultGatewayWindowSize
This allows setting the max tcp window size for the route of the default gateway (usually the internet access). It works only for non-DHCP configurations by now.
This commit is contained in:
parent
1aea92c4ce
commit
9a81748f20
@ -5,6 +5,10 @@ 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;
|
||||||
|
|
||||||
@ -135,6 +139,15 @@ in
|
|||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
networking.defaultGatewayWindowSize = mkOption {
|
||||||
|
default = "";
|
||||||
|
example = "524288";
|
||||||
|
description = ''
|
||||||
|
The window size of the default gateway. It limits maximal data bursts that TCP peers
|
||||||
|
are allowed to send to us.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
networking.nameservers = mkOption {
|
networking.nameservers = mkOption {
|
||||||
default = [];
|
default = [];
|
||||||
example = ["130.161.158.4" "130.161.33.17"];
|
example = ["130.161.158.4" "130.161.33.17"];
|
||||||
@ -282,7 +295,7 @@ 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}" || true
|
ip route add default via "${cfg.defaultGateway}" ${windowSize} || 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