diff options
author | Mathijs Kwik <mathijs@bluescreen303.nl> | 2013-12-30 00:53:45 -0800 |
---|---|---|
committer | Mathijs Kwik <mathijs@bluescreen303.nl> | 2013-12-30 00:53:45 -0800 |
commit | 3668970f7fb8c900d1210be28c90c44e0ef430eb (patch) | |
tree | 508bf25b79657a56c320c3a54d1e95ebfb32b947 /nixos/modules | |
parent | 9b056e1e3ec4312ffd6043f13aa068da09908335 (diff) | |
parent | c6ab810e37c96abea58067f9102c88429e179f2b (diff) | |
download | nixlib-3668970f7fb8c900d1210be28c90c44e0ef430eb.tar nixlib-3668970f7fb8c900d1210be28c90c44e0ef430eb.tar.gz nixlib-3668970f7fb8c900d1210be28c90c44e0ef430eb.tar.bz2 nixlib-3668970f7fb8c900d1210be28c90c44e0ef430eb.tar.lz nixlib-3668970f7fb8c900d1210be28c90c44e0ef430eb.tar.xz nixlib-3668970f7fb8c900d1210be28c90c44e0ef430eb.tar.zst nixlib-3668970f7fb8c900d1210be28c90c44e0ef430eb.zip |
Merge pull request #1430 from wkennington/mtu
network-interfaces: Add mtu setting support
Diffstat (limited to 'nixos/modules')
-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 1249fabc309a..3ecc2d4d5286 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; @@ -381,6 +390,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}') |