diff options
author | William A. Kennington III <william@wkennington.com> | 2013-12-29 20:58:59 -0600 |
---|---|---|
committer | William A. Kennington III <william@wkennington.com> | 2013-12-30 02:52:55 -0600 |
commit | c6ab810e37c96abea58067f9102c88429e179f2b (patch) | |
tree | cb7e1a56769774b19699cbec5ef4da69eb10e473 /nixos/modules/tasks/network-interfaces.nix | |
parent | 4cc859c6be2b7c99640f964cdba4a5c5e04ef5ca (diff) | |
download | nixpkgs-c6ab810e37c96abea58067f9102c88429e179f2b.tar nixpkgs-c6ab810e37c96abea58067f9102c88429e179f2b.tar.gz nixpkgs-c6ab810e37c96abea58067f9102c88429e179f2b.tar.bz2 nixpkgs-c6ab810e37c96abea58067f9102c88429e179f2b.tar.lz nixpkgs-c6ab810e37c96abea58067f9102c88429e179f2b.tar.xz nixpkgs-c6ab810e37c96abea58067f9102c88429e179f2b.tar.zst nixpkgs-c6ab810e37c96abea58067f9102c88429e179f2b.zip |
network-interfaces: Add mtu setting support
Adds a setting to the network interface configuration for changing the mtu for each specified interface.
Diffstat (limited to 'nixos/modules/tasks/network-interfaces.nix')
-rw-r--r-- | nixos/modules/tasks/network-interfaces.nix | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/nixos/modules/tasks/network-interfaces.nix b/nixos/modules/tasks/network-interfaces.nix index b1ab989f130..6b886468a4b 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}') |