From 3451efe132d76bde6fa56c5b4bddf7c536ef5c29 Mon Sep 17 00:00:00 2001 From: Bill Zimmerman Date: Thu, 29 Apr 2021 23:58:46 +0200 Subject: [PATCH] Create reinitializeWPA() --- includes/wifi_functions.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/includes/wifi_functions.php b/includes/wifi_functions.php index 8296c57c..a241fa02 100755 --- a/includes/wifi_functions.php +++ b/includes/wifi_functions.php @@ -157,3 +157,18 @@ function getWifiInterface() } } +/* + * Reinitializes wpa_supplicant for the wifi client interface + * + * @param boolean $force + */ +function reinitializeWPA($force) +{ + if ($force == true) { + $cmd = escapeshellcmd("/bin/rm /var/run/wpa_supplicant/".$_SESSION['wifi_client_interface']); + $result = exec($cmd); + } + $cmd = escapeshellcmd("sudo /sbin/wpa_supplicant -B -Dnl80211 -Dwext c/etc/wpa_supplicant/wpa_supplicant.conf -i". $_SESSION['wifi_client_interface']); + $result = shell_exec($cmd); + return $result; +}