Merge pull request #1135 from pv2b/fix-missing-dmesg

(get_interface_list) Properly handle an interface not appearing in dmesg
This commit is contained in:
Franco Fichtner 2016-08-13 20:22:10 +02:00 committed by GitHub
commit c77dd450ac

View File

@ -948,12 +948,13 @@ function get_interface_list($only_active = false)
}
$dmesg_arr = array();
$toput['dmesg'] = null;
exec("/sbin/dmesg |grep $ifname", $dmesg_arr);
preg_match_all("/<(.*?)>/i", $dmesg_arr[0], $dmesg);
if (isset($dmesg[1][0])) {
$toput['dmesg'] = $dmesg[1][0];
} else {
$toput['dmesg'] = null;
if (count($dmesg_arr) > 0) {
preg_match_all("/<(.*?)>/i", $dmesg_arr[0], $dmesg);
if (isset($dmesg[1][0])) {
$toput['dmesg'] = $dmesg[1][0];
}
}
$iflist[$ifname] = $toput;