From c6ab810e37c96abea58067f9102c88429e179f2b Mon Sep 17 00:00:00 2001 From: "William A. Kennington III" Date: Sun, 29 Dec 2013 20:58:59 -0600 Subject: network-interfaces: Add mtu setting support Adds a setting to the network interface configuration for changing the mtu for each specified interface. --- nixos/modules/tasks/network-interfaces.nix | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'nixos/modules/tasks') diff --git a/nixos/modules/tasks/network-interfaces.nix b/nixos/modules/tasks/network-interfaces.nix index b1ab989f130f..6b886468a4b8 100644 --- a/nixos/modules/tasks/network-interfaces.nix +++ b/nixos/modules/tasks/network-interfaces.nix @@ -58,6 +58,15 @@ let ''; }; + mtu = mkOption { + default = null; + example = 9000; + type = types.nullOr types.int; + description = '' + MTU size for packets leaving the interface. Leave empty to use the default. + ''; + }; + virtual = mkOption { default = false; type = types.bool; @@ -342,6 +351,11 @@ in echo "setting MAC address to ${i.macAddress}..." ip link set "${i.name}" address "${i.macAddress}" '' + + optionalString (i.mtu != null) + '' + echo "setting MTU to ${toString i.mtu}..." + ip link set "${i.name}" mtu "${toString i.mtu}" + '' + optionalString (i.ipAddress != null) '' cur=$(ip -4 -o a show dev "${i.name}" | awk '{print $4}') -- cgit 1.4.1