From 8332312ba1ac1d736b7ef60573060c12203d54c9 Mon Sep 17 00:00:00 2001 From: Chris Buechler Date: Tue, 1 Mar 2016 19:18:50 -0600 Subject: Add function to return the physical interface(s) for a given parent. related to Ticket #5081 --- src/etc/inc/interfaces.inc | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'src/etc') diff --git a/src/etc/inc/interfaces.inc b/src/etc/inc/interfaces.inc index d8535de..2929ca3 100644 --- a/src/etc/inc/interfaces.inc +++ b/src/etc/inc/interfaces.inc @@ -4679,6 +4679,27 @@ function get_parent_interface($interface, $avoidrecurse = false) { return $parents; } +/* + * get_parent_physical_interface($interface): + * - returns an array of parent interface(s) for a given interface friendly name (e.g. wan) + * differs from get_parent_interface in that it traverses to find the physical NICs on lagg + */ +function get_parent_physical_interface($interface) { + global $config; + + $realif = get_parent_interface($interface); + + if (substr($realif[0], 0, 4) == "lagg") { + foreach ($config['laggs']['lagg'] as $lagg) { + if ($realif[0] == $lagg['laggif']) { + return explode(",", $lagg['members']); + } + } + } else { + return $realif; + } +} + function interface_is_wireless_clone($wlif) { if (!stristr($wlif, "_wlan")) { return false; -- cgit v1.1