Commit c9e04ae0 authored by Per von Zweigbergk's avatar Per von Zweigbergk

(get_interface_list) Properly handle an interface not appearing in dmesg

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