From 12b69590daf274c8bb72a5fd8f12b4c3325ff510 Mon Sep 17 00:00:00 2001 From: Mark Pointing Date: Tue, 15 Dec 2020 10:45:27 +0000 Subject: [PATCH] Removed some band-aid fixes of incorrect client/ap interface identification function. --- includes/hostapd.php | 2 ++ includes/wifi_functions.php | 4 ++-- templates/configure_client.php | 9 +++------ templates/dashboard.php | 8 +++----- 4 files changed, 10 insertions(+), 13 deletions(-) diff --git a/includes/hostapd.php b/includes/hostapd.php index 79b3ad02..9b698480 100755 --- a/includes/hostapd.php +++ b/includes/hostapd.php @@ -130,6 +130,8 @@ function SaveHostAPDConfig($wpa_array, $enc_types, $modes, $interfaces, $status) $status->addMessage('Attempting to set channel outside of permitted range', 'danger'); $good_input = false; } + + $arrHostapdConf = parse_ini_file('/etc/raspap/hostapd.ini'); // Check for Bridged AP mode checkbox $bridgedEnable = 0; diff --git a/includes/wifi_functions.php b/includes/wifi_functions.php index 040de215..5b994dae 100755 --- a/includes/wifi_functions.php +++ b/includes/wifi_functions.php @@ -146,12 +146,12 @@ function getWifiInterface() $iface = $_SESSION['ap_interface'] = isset($arrHostapdConf['WifiInterface']) ? $arrHostapdConf['WifiInterface'] : RASPI_WIFI_AP_INTERFACE; // check for 2nd wifi interface -> wifi client on different interface exec("iw dev | awk '$1==\"Interface\" && $2!=\"$iface\" {print $2}'",$iface2); - $client_iface = $_SESSION['wifi_client_interface'] = empty($iface2) ? $iface : trim($iface2[0]); + $client_iface = $_SESSION['wifi_client_interface'] = (empty($iface2) ? $iface : trim($iface2[0])); // specifically for rpi0W in AP-STA mode, the above check ends up with the interfaces // crossed over (wifi_client_interface vs 'ap_interface'), because the second interface (uap0) is // created by raspap and used as the access point. - if ($iface == "wlan0" && $client_iface = "uap0" && ($arrHostapdConf['WifiAPEnable'] ?? 0)){ + if ($client_iface == "uap0" && ($arrHostapdConf['WifiAPEnable'] ?? 0)){ $_SESSION['wifi_client_interface'] = $iface; $_SESSION['ap_interface'] = $client_iface; } diff --git a/templates/configure_client.php b/templates/configure_client.php index afb3aeb3..567d858a 100755 --- a/templates/configure_client.php +++ b/templates/configure_client.php @@ -1,10 +1,7 @@