(get_interface_list) Properly handle an interface not appearing in dmesg

This commit is contained in:
Per von Zweigbergk 2016-08-13 16:42:24 +00:00
parent 4870ff1061
commit c9e04ae0f7

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;