interfaces: fix crash report and deprecate 'hwif' ifinfo element

This commit is contained in:
Franco Fichtner 2016-08-05 08:42:34 +02:00
parent 4725b679ad
commit da3b10c664
2 changed files with 5 additions and 4 deletions

View File

@ -4912,10 +4912,11 @@ function get_interface_info($ifdescr)
global $config;
$ifinfo = array();
if (empty($config['interfaces'][$ifdescr])) {
return;
}
$ifinfo['hwif'] = $config['interfaces'][$ifdescr]['if'];
$ifinfo['if'] = get_real_interface($ifdescr);
$chkif = $ifinfo['if'];
@ -4925,7 +4926,7 @@ function get_interface_info($ifdescr)
$ifinfo['subnet'] = $ifinfotmp['subnet'];
$ifup = legacy_interface_listget('up');
$ifinfo['status'] = in_array($chkif, $ifup) ? 'up' : 'down';
$ifinfo['status'] = (is_array($ifup) && in_array($chkif, $ifup)) ? 'up' : 'down';
$ifinfo['linklocal'] = get_interface_linklocal($ifdescr);
$ifinfo['ipaddrv6'] = get_interface_ipv6($ifdescr);

View File

@ -80,7 +80,7 @@ include("head.inc");
<tr>
<th colspan="2">
<i class="fa fa-chevron-down" style="cursor: pointer;" data-toggle="collapse" data-target="#<?= htmlspecialchars($ifname) ?>"></i>
<?= htmlspecialchars($ifname) ?> <?= gettext("interface") ?> (<?= htmlspecialchars($ifdescr) ?>, <?= htmlspecialchars($ifinfo['hwif']) ?>)
<?= htmlspecialchars($ifname) ?> <?= gettext("interface") ?> (<?= htmlspecialchars($ifdescr) ?>, <?= htmlspecialchars($ifinfo['if']) ?>)
<?php
if (!isset($first_row)):
$first_row=false; ?>
@ -440,7 +440,7 @@ include("head.inc");
$real_interface = "";
$interrupt_total = "";
$interrupt_sec = "";
$real_interface = $ifinfo['hwif'];
$real_interface = $ifinfo['if'];
$interrupt_total = `vmstat -i | grep $real_interface | awk '{ print $3 }'`;
$interrupt_sec = `vmstat -i | grep $real_interface | awk '{ print $4 }'`;
if(strstr($interrupt_total, "hci")) {