mirror of
https://github.com/billz/raspap-webgui.git
synced 2025-03-01 10:31:47 +00:00
Add Session variable "wifi_client_interface"
This commit is contained in:
@@ -53,10 +53,10 @@ function nearbyWifiStations(&$networks, $cached = true)
|
||||
|
||||
$scan_results = cache(
|
||||
$cacheKey, function () {
|
||||
exec('sudo wpa_cli -i ' .$_SESSION['ap_interface']. ' scan');
|
||||
exec('sudo wpa_cli -i ' .$_SESSION['wifi_client_interface']. ' scan');
|
||||
sleep(3);
|
||||
|
||||
exec('sudo wpa_cli -i ' .$_SESSION['ap_interface']. ' scan_results', $stdout);
|
||||
exec('sudo wpa_cli -i ' .$_SESSION['wifi_client_interface']. ' scan_results', $stdout);
|
||||
array_shift($stdout);
|
||||
|
||||
return implode("\n", $stdout);
|
||||
@@ -107,7 +107,7 @@ function nearbyWifiStations(&$networks, $cached = true)
|
||||
|
||||
function connectedWifiStations(&$networks)
|
||||
{
|
||||
exec('iwconfig ' .$_SESSION['ap_interface'], $iwconfig_return);
|
||||
exec('iwconfig ' .$_SESSION['wifi_client_interface'], $iwconfig_return);
|
||||
foreach ($iwconfig_return as $line) {
|
||||
if (preg_match('/ESSID:\"([^"]+)\"/i', $line, $iwconfig_ssid)) {
|
||||
$networks[$iwconfig_ssid[1]]['connected'] = true;
|
||||
@@ -145,12 +145,12 @@ function getWifiInterface()
|
||||
if (empty($_SESSION['ap_interface'])) {
|
||||
$arrHostapdConf = parse_ini_file(RASPI_CONFIG.'/hostapd.ini');
|
||||
if (isset($arrHostapdConf['WifiInterface'])) {
|
||||
$iface = $arrHostapdConf['WifiInterface'];
|
||||
// check for 2nd wifi interface
|
||||
$iface = $_SESSION['ap_interface'] = $arrHostapdConf['WifiInterface'];
|
||||
// check for 2nd wifi interface -> wifi client on different interface
|
||||
exec("iw dev | awk '$1==\"Interface\" && $2!=\"$iface\" {print $2}'",$iface2);
|
||||
$_SESSION['ap_interface'] = empty($iface2) ? $iface : trim($iface2[0]);
|
||||
$_SESSION['wifi_client_interface'] = empty($iface2) ? $iface : trim($iface2[0]);
|
||||
} else { // fallback to default
|
||||
$_SESSION['ap_interface'] = RASPI_WIFI_AP_INTERFACE;
|
||||
$_SESSION['ap_interface'] = $_SESSION['wifi_client_interface'] = RASPI_WIFI_AP_INTERFACE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user