mirror of
https://github.com/billz/raspap-webgui.git
synced 2023-10-10 13:37:24 +02:00
Removed some band-aid fixes of incorrect client/ap interface identification function.
This commit is contained in:
parent
ed09f9b9da
commit
12b69590da
@ -131,6 +131,8 @@ function SaveHostAPDConfig($wpa_array, $enc_types, $modes, $interfaces, $status)
|
|||||||
$good_input = false;
|
$good_input = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$arrHostapdConf = parse_ini_file('/etc/raspap/hostapd.ini');
|
||||||
|
|
||||||
// Check for Bridged AP mode checkbox
|
// Check for Bridged AP mode checkbox
|
||||||
$bridgedEnable = 0;
|
$bridgedEnable = 0;
|
||||||
if ($arrHostapdConf['BridgedEnable'] == 0) {
|
if ($arrHostapdConf['BridgedEnable'] == 0) {
|
||||||
|
@ -146,12 +146,12 @@ function getWifiInterface()
|
|||||||
$iface = $_SESSION['ap_interface'] = isset($arrHostapdConf['WifiInterface']) ? $arrHostapdConf['WifiInterface'] : RASPI_WIFI_AP_INTERFACE;
|
$iface = $_SESSION['ap_interface'] = isset($arrHostapdConf['WifiInterface']) ? $arrHostapdConf['WifiInterface'] : RASPI_WIFI_AP_INTERFACE;
|
||||||
// check for 2nd wifi interface -> wifi client on different interface
|
// check for 2nd wifi interface -> wifi client on different interface
|
||||||
exec("iw dev | awk '$1==\"Interface\" && $2!=\"$iface\" {print $2}'",$iface2);
|
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
|
// 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
|
// crossed over (wifi_client_interface vs 'ap_interface'), because the second interface (uap0) is
|
||||||
// created by raspap and used as the access point.
|
// 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['wifi_client_interface'] = $iface;
|
||||||
$_SESSION['ap_interface'] = $client_iface;
|
$_SESSION['ap_interface'] = $client_iface;
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
$arrHostapdConf = parse_ini_file(RASPI_CONFIG.'/hostapd.ini');
|
|
||||||
if ($arrHostapdConf['WifiAPEnable'] == 1) {
|
|
||||||
$client_interface = 'uap0';
|
|
||||||
} else {
|
|
||||||
$client_interface = $_SESSION['wifi_client_interface'];
|
$client_interface = $_SESSION['wifi_client_interface'];
|
||||||
}
|
|
||||||
exec('ip a show '.$client_interface, $stdoutIp);
|
exec('ip a show '.$client_interface, $stdoutIp);
|
||||||
$stdoutIpAllLinesGlued = implode(" ", $stdoutIp);
|
$stdoutIpAllLinesGlued = implode(" ", $stdoutIp);
|
||||||
$stdoutIpWRepeatedSpaces = preg_replace('/\s\s+/', ' ', $stdoutIpAllLinesGlued);
|
$stdoutIpWRepeatedSpaces = preg_replace('/\s\s+/', ' ', $stdoutIpAllLinesGlued);
|
||||||
|
@ -1,10 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
$arrHostapdConf = parse_ini_file(RASPI_CONFIG.'/hostapd.ini');
|
$arrHostapdConf = parse_ini_file(RASPI_CONFIG.'/hostapd.ini');
|
||||||
if ($arrHostapdConf['WifiAPEnable'] == 1) {
|
|
||||||
$client_interface = 'uap0';
|
|
||||||
} else {
|
|
||||||
$client_interface = $_SESSION['wifi_client_interface'];
|
$client_interface = $_SESSION['wifi_client_interface'];
|
||||||
}
|
|
||||||
$ap_iface = $_SESSION['ap_interface'];
|
$ap_iface = $_SESSION['ap_interface'];
|
||||||
$MACPattern = '"([[:xdigit:]]{2}:){5}[[:xdigit:]]{2}"';
|
$MACPattern = '"([[:xdigit:]]{2}:){5}[[:xdigit:]]{2}"';
|
||||||
if ($arrHostapdConf['BridgedEnable'] == 1) {
|
if ($arrHostapdConf['BridgedEnable'] == 1) {
|
||||||
|
Loading…
Reference in New Issue
Block a user