Get 1st wireless iface, fixes client dashboard widget

This commit is contained in:
billz 2020-06-09 13:09:58 +01:00
parent 7d06bece80
commit e9470aaf7f
1 changed files with 5 additions and 1 deletions

View File

@ -90,7 +90,11 @@ function DisplayDashboard(&$extraFooterScripts)
define('SSIDMAXLEN', 32);
// Warning iw comes with: "Do NOT screenscrape this tool, we don't consider its output stable."
exec('iw dev '.$_SESSION['client_iface'].' link ', $stdoutIw);
// fetch first wireless interface
$iface = $_SESSION['client_iface'];
exec("iw dev | awk '$1==\"Interface\" && $2!=\"$iface\" {print $2}'",$iface2);
$host_iface = empty($iface2) ? $iface1 : trim($iface2[0]);
exec('iw dev ' .$host_iface. ' link ', $stdoutIw);
$stdoutIwAllLinesGlued = implode(' ', $stdoutIw);
$stdoutIwWRepSpaces = preg_replace('/\s\s+/', ' ', $stdoutIwAllLinesGlued);