Commit ddc987e2 authored by Franco Fichtner's avatar Franco Fichtner

interfaces: fix a (mildy amusing) crash report

parent 2daf0e20
...@@ -3995,34 +3995,38 @@ function convert_friendly_interface_to_real_interface_name($interface) { ...@@ -3995,34 +3995,38 @@ function convert_friendly_interface_to_real_interface_name($interface) {
return get_real_interface($interface); return get_real_interface($interface);
} }
/* /* convert fxp0 -> wan, etc. */
* convert_real_interface_to_friendly_interface_name($interface): convert fxp0 -> wan, etc. function convert_real_interface_to_friendly_interface_name($interface = 'wan')
*/ {
function convert_real_interface_to_friendly_interface_name($interface = "wan") {
global $config; global $config;
/* XXX: For speed reasons reference directly the interface array */ if (!isset($config['interfaces'])) {
$ifdescrs = &$config['interfaces']; /* some people do trigger this, I don't know why :) */
//$ifdescrs = get_configured_interface_list(false, true); return NULL;
}
foreach ($ifdescrs as $if => $ifname) { foreach ($config['interfaces'] as $if => $ifname) {
if ($if == $interface || $ifname['if'] == $interface) if ($if == $interface || $ifname['if'] == $interface) {
return $if; return $if;
}
if (get_real_interface($if) == $interface) if (get_real_interface($if) == $interface) {
return $if; return $if;
}
$int = get_parent_interface($if, true); $int = get_parent_interface($if, true);
if (is_array($int)) { if (is_array($int)) {
foreach ($int as $iface) { foreach ($int as $iface) {
if ($iface == $interface) if ($iface == $interface) {
return $if; return $if;
}
} }
} }
} }
if ($interface == "enc0") if ($interface == 'enc0') {
return 'IPsec'; return 'IPsec';
}
return NULL; return NULL;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment