From 56da23dc5ffebdb6cf52f3b46abebc0ef56e9861 Mon Sep 17 00:00:00 2001 From: Ermal Date: Wed, 4 May 2011 21:31:53 +0000 Subject: Fixes #1394. Create a function get_itnerface_default_mtu and use it for resetting the mtu of a interface to default when needed. This adds the overhead of fetching the interface mtu and comparing with the default one every interface configuration run. --- etc/inc/interfaces.inc | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/etc/inc/interfaces.inc b/etc/inc/interfaces.inc index 7a9ba5a..4a3cd88 100644 --- a/etc/inc/interfaces.inc +++ b/etc/inc/interfaces.inc @@ -2579,6 +2579,11 @@ function interface_configure($interface = "wan", $reloadall = false, $linkupeven } if (!empty($wancfg['mtu'])) pfSense_interface_mtu($realhwif, $wancfg['mtu']); + else { + $mtu = get_interface_default_mtu(remove_numbers($realhwif)); + if ($mtu != get_interface_mtu($realhwif)) + pfSense_interface_mtu($mtu); + } $options = pfSense_get_interface_addresses($realhwif); if (is_array($options) && isset($options['caps']['polling'])) { @@ -3689,6 +3694,27 @@ EOD; unlink_if_exists($cron_file); } +function get_interface_default_mtu($type = "ethernet") { + switch ($type) { + case "gre": + return 1476; + break; + case "gif": + return 1280; + break; + case "tun": + case "vlan": + case "tap": + case "ethernet": + default: + return 1500; + break; + } + + /* Never reached */ + return 1500; +} + function get_vip_descr($ipaddress) { global $config; -- cgit v1.1