Révision 71c26c22
Ajouté par Renato Botelho il y a plus de 9 ans
etc/inc/interfaces.inc | ||
---|---|---|
730 | 730 |
echo gettext("done.") . "\n"; |
731 | 731 |
} |
732 | 732 |
|
733 |
function interface_lagg_configure(&$lagg) {
|
|
733 |
function interface_lagg_configure($lagg) { |
|
734 | 734 |
global $config, $g; |
735 | 735 |
|
736 | 736 |
if (!is_array($lagg)) |
... | ... | |
747 | 747 |
} else |
748 | 748 |
$laggif = pfSense_interface_create("lagg"); |
749 | 749 |
|
750 |
/* Calculate smaller mtu and enforce it */ |
|
751 |
$smallermtu = 0; |
|
752 |
foreach ($members as $member) { |
|
753 |
$opts = pfSense_get_interface_addresses($member); |
|
754 |
$mtu = $opts['mtu']; |
|
755 |
if (!isset($opts['caps']['txcsum'])) |
|
756 |
$commontx = false; |
|
757 |
if (!isset($opts['caps']['rxcsum'])) |
|
758 |
$commonrx = false; |
|
759 |
if (!isset($opts['caps']['tso4'])) |
|
760 |
$commontso4 = false; |
|
761 |
if (!isset($opts['caps']['tso6'])) |
|
762 |
$commontso6 = false; |
|
763 |
if (!isset($opts['caps']['lro'])) |
|
764 |
$commonlro = false; |
|
765 |
if ($smallermtu == 0 && !empty($mtu)) |
|
766 |
$smallermtu = $mtu; |
|
767 |
else if (!empty($mtu) && $mtu < $smallermtu) |
|
768 |
$smallermtu = $mtu; |
|
750 |
/* Check if MTU was defined for this lagg interface */ |
|
751 |
$lagg_mtu = 0; |
|
752 |
if (is_array($config['interfaces'])) { |
|
753 |
foreach ($config['interfaces'] as $ifname => $ifdata) { |
|
754 |
if ($ifdata['if'] != $laggif) |
|
755 |
continue; |
|
756 |
|
|
757 |
if (isset($ifdata['mtu']) && !empty($ifdata['mtu'])) { |
|
758 |
$lagg_mtu = $ifdata['mtu']; |
|
759 |
break; |
|
760 |
} |
|
761 |
} |
|
762 |
} |
|
763 |
|
|
764 |
if ($lagg_mtu == 0) { |
|
765 |
/* Calculate smaller mtu and enforce it */ |
|
766 |
$smallermtu = 0; |
|
767 |
foreach ($members as $member) { |
|
768 |
$opts = pfSense_get_interface_addresses($member); |
|
769 |
$mtu = $opts['mtu']; |
|
770 |
if (!isset($opts['caps']['txcsum'])) |
|
771 |
$commontx = false; |
|
772 |
if (!isset($opts['caps']['rxcsum'])) |
|
773 |
$commonrx = false; |
|
774 |
if (!isset($opts['caps']['tso4'])) |
|
775 |
$commontso4 = false; |
|
776 |
if (!isset($opts['caps']['tso6'])) |
|
777 |
$commontso6 = false; |
|
778 |
if (!isset($opts['caps']['lro'])) |
|
779 |
$commonlro = false; |
|
780 |
if ($smallermtu == 0 && !empty($mtu)) |
|
781 |
$smallermtu = $mtu; |
|
782 |
else if (!empty($mtu) && $mtu < $smallermtu) |
|
783 |
$smallermtu = $mtu; |
|
784 |
} |
|
785 |
$lagg_mtu = $smallermtu; |
|
769 | 786 |
} |
770 | 787 |
|
771 | 788 |
/* Just in case anything is not working well */ |
772 |
if ($smallermtu == 0)
|
|
773 |
$smallermtu = 1500;
|
|
789 |
if ($lagg_mtu == 0)
|
|
790 |
$lagg_mtu = 1500;
|
|
774 | 791 |
|
775 | 792 |
$flags_on = 0; |
776 | 793 |
$flags_off = 0; |
... | ... | |
801 | 818 |
if (!array_key_exists($member, $checklist)) |
802 | 819 |
continue; |
803 | 820 |
/* make sure the parent interface is up */ |
804 |
pfSense_interface_mtu($member, $smallermtu);
|
|
821 |
pfSense_interface_mtu($member, $lagg_mtu);
|
|
805 | 822 |
pfSense_interface_capabilities($member, -$flags_off); |
806 | 823 |
pfSense_interface_capabilities($member, $flags_on); |
807 | 824 |
interfaces_bring_up($member); |
... | ... | |
3123 | 3140 |
interface_vlan_adapt_mtu(link_interface_to_vlans($realhwif), $wancfg['mtu']); |
3124 | 3141 |
} else |
3125 | 3142 |
pfSense_interface_mtu($realif, $wancfg['mtu']); |
3143 |
} else if (substr($realif, 0, 4) == 'lagg') { |
|
3144 |
/* LAGG interface must be destroyed and re-created to change MTU */ |
|
3145 |
if ($wancfg['mtu'] != get_interface_mtu($realif)) { |
|
3146 |
if (isset($config['laggs']['lagg']) && is_array($config['laggs']['lagg'])) { |
|
3147 |
foreach ($config['laggs']['lagg'] as $lagg) { |
|
3148 |
if ($lagg['laggif'] == $realif) { |
|
3149 |
interface_lagg_configure($lagg); |
|
3150 |
break; |
|
3151 |
} |
|
3152 |
} |
|
3153 |
} |
|
3154 |
} |
|
3126 | 3155 |
} else { |
3127 | 3156 |
if ($wancfg['mtu'] != get_interface_mtu($realif)) |
3128 | 3157 |
pfSense_interface_mtu($realif, $wancfg['mtu']); |
... | ... | |
3130 | 3159 |
/* This case is needed when the parent of vlans is being configured */ |
3131 | 3160 |
interface_vlan_adapt_mtu(link_interface_to_vlans($realif), $wancfg['mtu']); |
3132 | 3161 |
} |
3133 |
/* XXX: What about gre/gif/lagg/.. ? */
|
|
3162 |
/* XXX: What about gre/gif/.. ? */ |
|
3134 | 3163 |
} |
3135 | 3164 |
|
3136 | 3165 |
if (does_interface_exist($wancfg['if'])) |
Formats disponibles : Unified diff
Properly set MTU for lagg interface, it fixes #3922