From c3894df0a62b07b6bfc0f13c2deb1c84633fb517 Mon Sep 17 00:00:00 2001 From: Ad Schellevis Date: Fri, 5 Feb 2016 17:22:06 +0100 Subject: [PATCH] (legacy) fix media selection in interfaces.php --- src/www/interfaces.php | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/src/www/interfaces.php b/src/www/interfaces.php index 3b4afa790..ac663f44f 100644 --- a/src/www/interfaces.php +++ b/src/www/interfaces.php @@ -1323,15 +1323,18 @@ if (isset($a_interfaces[$if]['wireless'])) { // Find all possible media options for the interface $mediaopts_list = array(); -exec("/sbin/ifconfig -m {$pconfig['if']} | grep \"media \"", $mediaopts); -foreach ($mediaopts as $mediaopt){ - preg_match("/media (.*)/", $mediaopt, $matches); - if (preg_match("/(.*) mediaopt (.*)/", $matches[1], $matches1)){ - // there is media + mediaopt like "media 1000baseT mediaopt full-duplex" - array_push($mediaopts_list, $matches1[1] . " " . $matches1[2]); - } else { - // there is only media like "media 1000baseT" - array_push($mediaopts_list, $matches[1]); +$optlist_intf = get_parent_interface($pconfig['if']); +if (count($optlist_intf) > 0) { + exec("/sbin/ifconfig -m {$optlist_intf[0]} | grep \"media \"", $mediaopts); + foreach ($mediaopts as $mediaopt){ + preg_match("/media (.*)/", $mediaopt, $matches); + if (preg_match("/(.*) mediaopt (.*)/", $matches[1], $matches1)){ + // there is media + mediaopt like "media 1000baseT mediaopt full-duplex" + array_push($mediaopts_list, $matches1[1] . " " . $matches1[2]); + } else { + // there is only media like "media 1000baseT" + array_push($mediaopts_list, $matches[1]); + } } }