Skip to content

Commit 98c2a7c

Browse files
authored
Merge pull request #1627 from daniel-rose/bugfix/handle-open-wifi-correctly
fix: handle open wifi in `setKnownStationsWPA` correctly
2 parents a0d8f22 + 534b4df commit 98c2a7c

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

includes/wifi_functions.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,13 +269,17 @@ function setKnownStationsWPA($networks)
269269
if (!networkExists($ssid, $wpaCliNetworks)) {
270270
$ssid = escapeshellarg('"'.$network['ssid'].'"');
271271
$psk = escapeshellarg('"'.$network['passphrase'].'"');
272+
$protocol = $network['protocol'];
272273
$netid = trim(shell_exec("sudo wpa_cli -i $iface add_network"));
273274
if (isset($netid) && !isset($known[$netid])) {
274275
$commands = [
275276
"sudo wpa_cli -i $iface set_network $netid ssid $ssid",
276277
"sudo wpa_cli -i $iface set_network $netid psk $psk",
277278
"sudo wpa_cli -i $iface enable_network $netid"
278279
];
280+
if ($protocol === 'Open') {
281+
$commands[1] = "sudo wpa_cli -i $iface set_network $netid key_mgmt NONE";
282+
}
279283
foreach ($commands as $cmd) {
280284
exec($cmd);
281285
usleep(1000);

0 commit comments

Comments
 (0)