diff options
author | Ermal <eri@pfsense.org> | 2014-02-21 11:54:49 +0000 |
---|---|---|
committer | Ermal <eri@pfsense.org> | 2014-02-21 11:55:23 +0000 |
commit | 9510780ffa41bf1b19989b418e9a356702ba5576 (patch) | |
tree | 32a22579432d2bc00fefc9aa0747dcbe9e36f4f9 /etc/inc/interfaces.inc | |
parent | 57cd35cf98c5cb4a00d5a4ecae18310a5045bc34 (diff) | |
download | pfsense-9510780ffa41bf1b19989b418e9a356702ba5576.zip pfsense-9510780ffa41bf1b19989b418e9a356702ba5576.tar.gz |
Avoid recursion of convert_real_interface_to_friendly_interface_name with get_parent and on linkup of parent interface properly configure especially useful on ppp type links
Diffstat (limited to 'etc/inc/interfaces.inc')
-rw-r--r-- | etc/inc/interfaces.inc | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/etc/inc/interfaces.inc b/etc/inc/interfaces.inc index 2f6214f..4921b0c 100644 --- a/etc/inc/interfaces.inc +++ b/etc/inc/interfaces.inc @@ -3712,19 +3712,19 @@ function convert_real_interface_to_friendly_interface_name($interface = "wan") { //$ifdescrs = get_configured_interface_list(false, true); foreach ($ifdescrs as $if => $ifname) { - if ($if == $interface || $config['interfaces'][$if]['if'] == $interface) + if ($if == $interface || $ifname['if'] == $interface) return $if; if (get_real_interface($if) == $interface) return $if; - // XXX: This case doesn't work anymore (segfaults - recursion?) - should be replaced with something else or just removed. - // Not to be replaced with get_real_interface - causes slow interface listings here because of recursion! - /* - $int = get_parent_interface($if); - if ($int[0] == $interface) - return $ifname; - */ + $int = get_parent_interface($if, true); + if (is_array($int)) { + foreach ($int as $iface) { + if ($iface == $interface) + return $if; + } + } } return NULL; @@ -3803,7 +3803,7 @@ function convert_real_interface_to_friendly_descr($interface) { * -- returns empty array if an invalid interface is passed * (Only handles ppps and vlans now.) */ -function get_parent_interface($interface) { +function get_parent_interface($interface, $avoidrecurse = false) { global $config; $parents = array(); @@ -3813,7 +3813,7 @@ function get_parent_interface($interface) { return $parents; // If we got a real interface, find it's friendly assigned name - if ($interface == $realif) + if ($interface == $realif && $avoidrecurse == false) $interface = convert_real_interface_to_friendly_interface_name($interface); if (!empty($interface) && isset($config['interfaces'][$interface])) { |