Commit d5a95a4d authored by Franco Fichtner's avatar Franco Fichtner

interfaces: deprecate keyby, it was never used

parent 7d8bb80f
...@@ -819,7 +819,7 @@ function get_configured_ipv6_addresses() ...@@ -819,7 +819,7 @@ function get_configured_ipv6_addresses()
* "media" - use ifconfig to check physical connection * "media" - use ifconfig to check physical connection
* status (much slower) * status (much slower)
*/ */
function get_interface_list($mode = 'active', $keyby = 'physical') function get_interface_list($mode = 'active')
{ {
global $config; global $config;
...@@ -854,12 +854,9 @@ function get_interface_list($mode = 'active', $keyby = 'physical') ...@@ -854,12 +854,9 @@ function get_interface_list($mode = 'active', $keyby = 'physical')
$ifnames = legacy_interface_listget(); $ifnames = legacy_interface_listget();
switch ($mode) { switch ($mode) {
case 'active':
$upints = legacy_interface_listget('up');
break;
case 'media': case 'media':
$intlist = $ifnames; $intlist = $ifnames;
$ifconfig = ""; $ifconfig = '';
exec("/sbin/ifconfig -a", $ifconfig); exec("/sbin/ifconfig -a", $ifconfig);
$regexp = '/(' . implode('|', $intlist) . '):\s/'; $regexp = '/(' . implode('|', $intlist) . '):\s/';
$ifstatus = preg_grep('/status:/', $ifconfig); $ifstatus = preg_grep('/status:/', $ifconfig);
...@@ -871,7 +868,7 @@ function get_interface_list($mode = 'active', $keyby = 'physical') ...@@ -871,7 +868,7 @@ function get_interface_list($mode = 'active', $keyby = 'physical')
} }
break; break;
default: default:
$upints = $ifnames; $upints = legacy_interface_listget('up');
break; break;
} }
...@@ -888,38 +885,25 @@ function get_interface_list($mode = 'active', $keyby = 'physical') ...@@ -888,38 +885,25 @@ function get_interface_list($mode = 'active', $keyby = 'physical')
'mac' => $ifdata['macaddr'] 'mac' => $ifdata['macaddr']
); );
$friendly = '';
if (isset($config['interfaces'])) { if (isset($config['interfaces'])) {
foreach($config['interfaces'] as $name => $int) { foreach($config['interfaces'] as $name => $int) {
if ($int['if'] == $ifname) { if ($int['if'] == $ifname) {
$friendly = $name; $toput['friendly'] = $name;
break;
} }
} }
} }
switch ($keyby) { $dmesg_arr = array();
case 'physical': exec("/sbin/dmesg |grep $ifname | head -n1", $dmesg_arr);
if ($friendly != '') { preg_match_all("/<(.*?)>/i", $dmesg_arr[0], $dmesg);
$toput['friendly'] = $friendly; if (isset($dmesg[1][0])) {
} $toput['dmesg'] = $dmesg[1][0];
$dmesg_arr = array(); } else {
exec("/sbin/dmesg |grep $ifname | head -n1", $dmesg_arr); $toput['dmesg'] = null;
preg_match_all("/<(.*?)>/i", $dmesg_arr[0], $dmesg);
if (isset($dmesg[1][0])) {
$toput['dmesg'] = $dmesg[1][0];
} else {
$toput['dmesg'] = null;
}
$iflist[$ifname] = $toput;
break;
case 'friendly':
case 'ppp':
if ($friendly != '') {
$toput['if'] = $ifname;
$iflist[$friendly] = $toput;
}
break;
} }
$iflist[$ifname] = $toput;
} }
return $iflist; return $iflist;
......
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