Commit c3894df0 authored by Ad Schellevis's avatar Ad Schellevis

(legacy) fix media selection in interfaces.php

parent cf732b0e
...@@ -1323,15 +1323,18 @@ if (isset($a_interfaces[$if]['wireless'])) { ...@@ -1323,15 +1323,18 @@ if (isset($a_interfaces[$if]['wireless'])) {
// Find all possible media options for the interface // Find all possible media options for the interface
$mediaopts_list = array(); $mediaopts_list = array();
exec("/sbin/ifconfig -m {$pconfig['if']} | grep \"media \"", $mediaopts); $optlist_intf = get_parent_interface($pconfig['if']);
foreach ($mediaopts as $mediaopt){ if (count($optlist_intf) > 0) {
preg_match("/media (.*)/", $mediaopt, $matches); exec("/sbin/ifconfig -m {$optlist_intf[0]} | grep \"media \"", $mediaopts);
if (preg_match("/(.*) mediaopt (.*)/", $matches[1], $matches1)){ foreach ($mediaopts as $mediaopt){
// there is media + mediaopt like "media 1000baseT mediaopt full-duplex" preg_match("/media (.*)/", $mediaopt, $matches);
array_push($mediaopts_list, $matches1[1] . " " . $matches1[2]); if (preg_match("/(.*) mediaopt (.*)/", $matches[1], $matches1)){
} else { // there is media + mediaopt like "media 1000baseT mediaopt full-duplex"
// there is only media like "media 1000baseT" array_push($mediaopts_list, $matches1[1] . " " . $matches1[2]);
array_push($mediaopts_list, $matches[1]); } else {
// there is only media like "media 1000baseT"
array_push($mediaopts_list, $matches[1]);
}
} }
} }
......
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