From 024c7e1694c6305981aa2fef25a4033e1cc86ffa Mon Sep 17 00:00:00 2001 From: Franco Fichtner Date: Mon, 6 Dec 2021 14:05:22 +0100 Subject: [PATCH] interfaces: return $ifname and decouple the search loop This looks like a typo in the original code as we expect to return a "wan|lan|optx" thingy. "Parent" lookup isn't really very useful except for PPP types. The question is if there is an edge case that would still allow this to resolve when the other code preceeding it can not. --- src/etc/inc/interfaces.inc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/etc/inc/interfaces.inc b/src/etc/inc/interfaces.inc index 4f0637f60..65c2ae4b9 100644 --- a/src/etc/inc/interfaces.inc +++ b/src/etc/inc/interfaces.inc @@ -3536,10 +3536,13 @@ function convert_real_interface_to_friendly_interface_name($interface = 'wan') if (get_real_interface($ifname) == $interface) { return $ifname; } + } + // search unnecessary? + foreach (array_keys($all_interfaces) as $ifname) { list ($ifparent) = get_parent_interface($ifname); if ($ifparent == $interface) { - return $ifparent; + return $ifname; } } @@ -3658,7 +3661,6 @@ function get_parent_interface($interface) return $parents; } - function interface_get_wireless_base($wlif) { if (!strstr($wlif, '_wlan')) {