diff --git a/includes/configure_client.php b/includes/configure_client.php
index 1bfc1576..30e048ac 100755
--- a/includes/configure_client.php
+++ b/includes/configure_client.php
@@ -19,6 +19,11 @@ function DisplayWPAConfig()
$result = 0;
exec('sudo wpa_cli -i ' . $_SESSION['wifi_client_interface'] . ' select_network '.strval($_POST['connect']));
$status->addMessage('New network selected', 'success');
+ } elseif (isset($_POST['wpa_reinit'])) {
+ $status->addMessage('Reinitializing wpa_supplicant', 'info', false);
+ $force_remove = true;
+ $result = reinitializeWPA($force_remove);
+ $status->addMessage($result, 'info');
} elseif (isset($_POST['client_settings'])) {
$tmp_networks = $networks;
if ($wpa_file = fopen('/tmp/wifidata', 'w')) {
diff --git a/includes/wifi_functions.php b/includes/wifi_functions.php
index 8296c57c..066a19ca 100755
--- a/includes/wifi_functions.php
+++ b/includes/wifi_functions.php
@@ -157,3 +157,20 @@ function getWifiInterface()
}
}
+/*
+ * Reinitializes wpa_supplicant for the wireless client interface
+ * The 'force' parameter deletes the socket in /var/run/wpa_supplicant/
+ *
+ * @param boolean $force
+ */
+function reinitializeWPA($force)
+{
+ if ($force == true) {
+ $cmd = escapeshellcmd("sudo /bin/rm /var/run/wpa_supplicant/".$_SESSION['wifi_client_interface']);
+ $result = exec($cmd);
+ }
+ $cmd = escapeshellcmd("sudo /sbin/wpa_supplicant -B -Dnl80211 -c/etc/wpa_supplicant/wpa_supplicant.conf -i". $_SESSION['wifi_client_interface']);
+ $result = shell_exec($cmd);
+ return $result;
+}
+
diff --git a/installers/raspap.sudoers b/installers/raspap.sudoers
index 00e1d1c7..60759f3d 100644
--- a/installers/raspap.sudoers
+++ b/installers/raspap.sudoers
@@ -4,6 +4,8 @@ www-data ALL=(ALL) NOPASSWD:/bin/cat /etc/wpa_supplicant/wpa_supplicant.conf
www-data ALL=(ALL) NOPASSWD:/bin/cat /etc/wpa_supplicant/wpa_supplicant-wlan[0-9].conf
www-data ALL=(ALL) NOPASSWD:/bin/cp /tmp/wifidata /etc/wpa_supplicant/wpa_supplicant.conf
www-data ALL=(ALL) NOPASSWD:/bin/cp /tmp/wifidata /etc/wpa_supplicant/wpa_supplicant-wlan[0-9].conf
+www-data ALL=(ALL) NOPASSWD:/sbin/wpa_supplicant -B -Dnl80211 -c/etc/wpa_supplicant/wpa_supplicant.conf -iwlan[0-9]
+www-data ALL=(ALL) NOPASSWD:/bin/rm /var/run/wpa_supplicant/wlan[0-9]
www-data ALL=(ALL) NOPASSWD:/sbin/wpa_cli -i wlan[0-9] scan_results
www-data ALL=(ALL) NOPASSWD:/sbin/wpa_cli -i wlan[0-9] scan
www-data ALL=(ALL) NOPASSWD:/sbin/wpa_cli -i wlan[0-9] reconfigure
diff --git a/locale/en_US/LC_MESSAGES/messages.mo b/locale/en_US/LC_MESSAGES/messages.mo
index 34d53bd3..f8c8410d 100644
Binary files a/locale/en_US/LC_MESSAGES/messages.mo and b/locale/en_US/LC_MESSAGES/messages.mo differ
diff --git a/locale/en_US/LC_MESSAGES/messages.po b/locale/en_US/LC_MESSAGES/messages.po
index 8ce1cf38..fac66b24 100644
--- a/locale/en_US/LC_MESSAGES/messages.po
+++ b/locale/en_US/LC_MESSAGES/messages.po
@@ -150,6 +150,21 @@ msgstr "Not configured"
msgid "Note: WEP access points appear as 'Open'. RaspAP does not currently support connecting to WEP"
msgstr "Note: WEP access points appear as 'Open'. RaspAP does not currently support connecting to WEP"
+msgid "No Wifi stations found"
+msgstr "No Wifi stations found"
+
+msgid "Reinitializing wpa_supplicant"
+msgstr "Reinitializing wpa_supplicant"
+
+msgid "Click 'Rescan' to search for nearby Wifi stations."
+msgstr "Click 'Rescan' to search for nearby Wifi stations."
+
+msgid "Click 'Reinitialize' to force reinitialize wpa_supplicant
."
+msgstr "Click 'Reinitialize' to force reinitialize wpa_supplicant
."
+
+msgid "Reinitialize"
+msgstr "Reinitialize"
+
#: includes/dashboard.php
msgid "Interface Information"
msgstr "Interface Information"
diff --git a/templates/wifi_stations.php b/templates/wifi_stations.php
index 2a6872cc..f12c9f54 100755
--- a/templates/wifi_stations.php
+++ b/templates/wifi_stations.php
@@ -1,7 +1,16 @@
wpa_supplicant.") ?>
+ +