6255 |
6255 |
function interface_find_child_cfgmtu($realiface) {
|
6256 |
6256 |
global $config;
|
6257 |
6257 |
|
6258 |
|
$interface = convert_real_interface_to_friendly_interface_name($realiface);
|
6259 |
6258 |
$vlans = link_interface_to_vlans($realiface);
|
6260 |
6259 |
$qinqs = link_interface_to_qinqs($realiface);
|
6261 |
6260 |
$bridge = link_interface_to_bridge($realiface);
|
6262 |
|
$gifs = link_interface_to_tunnelif($interface, 'gif');
|
6263 |
|
$gres = link_interface_to_tunnelif($interface, 'gre');
|
6264 |
6261 |
|
6265 |
6262 |
$mtu = 0;
|
6266 |
|
if (is_array($vlans)) {
|
6267 |
|
foreach ($vlans as $vlan) {
|
6268 |
|
$ifass = convert_real_interface_to_friendly_interface_name($vlan['vlanif']);
|
6269 |
|
if (empty($ifass)) {
|
6270 |
|
continue;
|
6271 |
|
}
|
6272 |
|
if (!empty($config['interfaces'][$ifass]['mtu'])) {
|
6273 |
|
if (intval($config['interfaces'][$ifass]['mtu']) > $mtu) {
|
|
6263 |
foreach (array($vlans, $qinqs, array('bridge' => $bridge)) as $ints) {
|
|
6264 |
if (is_array($ints)) {
|
|
6265 |
foreach ($ints as $int) {
|
|
6266 |
$ifass = convert_real_interface_to_friendly_interface_name($int['vlanif']);
|
|
6267 |
if (empty($ifass) && isset($config['interfaces'][$ifass]['enable']) &&
|
|
6268 |
!empty($config['interfaces'][$ifass]['mtu']) &&
|
|
6269 |
(intval($config['interfaces'][$ifass]['mtu']) > $mtu)) {
|
6274 |
6270 |
$mtu = intval($config['interfaces'][$ifass]['mtu']);
|
6275 |
6271 |
}
|
6276 |
6272 |
}
|
6277 |
6273 |
}
|
6278 |
6274 |
}
|
6279 |
|
if (is_array($qinqs)) {
|
6280 |
|
foreach ($qinqs as $qinq) {
|
6281 |
|
$ifass = convert_real_interface_to_friendly_interface_name($qinq['vlanif']);
|
6282 |
|
if (empty($ifass)) {
|
6283 |
|
continue;
|
6284 |
|
}
|
6285 |
|
if (!empty($config['interfaces'][$ifass]['mtu'])) {
|
6286 |
|
if (intval($config['interfaces'][$ifass]['mtu']) > $mtu) {
|
6287 |
|
$mtu = intval($config['interfaces'][$ifass]['mtu']);
|
6288 |
|
}
|
6289 |
|
}
|
6290 |
|
}
|
6291 |
|
}
|
6292 |
|
foreach ($gifs as $gif) {
|
6293 |
|
$ifass = convert_real_interface_to_friendly_interface_name($gif['gifif']);
|
6294 |
|
if (empty($ifass)) {
|
6295 |
|
continue;
|
6296 |
|
}
|
6297 |
|
if (!empty($config['interfaces'][$ifass]['mtu'])) {
|
6298 |
|
if (intval($config['interfaces'][$ifass]['mtu']) > $mtu) {
|
6299 |
|
$mtu = intval($config['interfaces'][$ifass]['mtu']);
|
6300 |
|
}
|
6301 |
|
}
|
6302 |
|
}
|
6303 |
|
foreach ($gres as $gre) {
|
6304 |
|
$ifass = convert_real_interface_to_friendly_interface_name($gre['greif']);
|
6305 |
|
if (empty($ifass)) {
|
6306 |
|
continue;
|
6307 |
|
}
|
6308 |
|
if (!empty($config['interfaces'][$ifass]['mtu'])) {
|
6309 |
|
if (intval($config['interfaces'][$ifass]['mtu']) > $mtu) {
|
6310 |
|
$mtu = intval($config['interfaces'][$ifass]['mtu']);
|
6311 |
|
}
|
6312 |
|
}
|
6313 |
|
}
|
6314 |
|
$ifass = convert_real_interface_to_friendly_interface_name($bridge);
|
6315 |
|
if (!empty($ifass) && !empty($config['interfaces'][$ifass]['mtu'])) {
|
6316 |
|
if (intval($config['interfaces'][$ifass]['mtu']) > $mtu) {
|
6317 |
|
$mtu = intval($config['interfaces'][$ifass]['mtu']);
|
6318 |
|
}
|
6319 |
|
}
|
6320 |
|
unset($vlans, $bridge, $gifs, $gres, $ifass, $vlan);
|
6321 |
6275 |
|
6322 |
6276 |
return $mtu;
|
6323 |
6277 |
}
|