From da3b10c6645e7d335139ed46073689da2f572012 Mon Sep 17 00:00:00 2001 From: Franco Fichtner Date: Fri, 5 Aug 2016 08:42:34 +0200 Subject: [PATCH] interfaces: fix crash report and deprecate 'hwif' ifinfo element --- src/etc/inc/interfaces.inc | 5 +++-- src/www/status_interfaces.php | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/etc/inc/interfaces.inc b/src/etc/inc/interfaces.inc index 880c4de52..76d558c58 100644 --- a/src/etc/inc/interfaces.inc +++ b/src/etc/inc/interfaces.inc @@ -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); diff --git a/src/www/status_interfaces.php b/src/www/status_interfaces.php index fb45d75ca..939ac1d45 100644 --- a/src/www/status_interfaces.php +++ b/src/www/status_interfaces.php @@ -80,7 +80,7 @@ include("head.inc"); - (, ) + (, ) @@ -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")) {