]>
git.ipfire.org Git - ipfire-2.x.git/blob - html/cgi-bin/wirelessclient.cgi
2 ###############################################################################
4 # IPFire.org - A linux based firewall #
5 # Copyright (C) 2012 IPFire Team <info@ipfire.org> #
7 # This program is free software: you can redistribute it and/or modify #
8 # it under the terms of the GNU General Public License as published by #
9 # the Free Software Foundation, either version 3 of the License, or #
10 # (at your option) any later version. #
12 # This program is distributed in the hope that it will be useful, #
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of #
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
15 # GNU General Public License for more details. #
17 # You should have received a copy of the GNU General Public License #
18 # along with this program. If not, see <http://www.gnu.org/licenses/>. #
20 ###############################################################################
22 # DEVICE,ENABLED,MODE,WPA_MODE,SSID,PSK,PRIO,AUTH,ANONYMOUS,IDENTITY,PASSWORD
23 # wlan0,on,WPA2,,Use This One Mum,ThisIsTheKey,2,TTLS,anonymous,username,password
27 # enable only the following on debugging purpose
29 use CGI
::Carp
'fatalsToBrowser';
31 require '/var/ipfire/general-functions.pl';
32 require "${General::swroot}/lang.pl";
33 require "${General::swroot}/header.pl";
35 #workaround to suppress a warning when a variable is used only once
36 my @dummy = ( ${Header
::colouryellow
} );
40 my $setting = "${General::swroot}/main/settings";
41 our $datafile = "${General::swroot}/ethernet/wireless";
44 my %mainsettings = ();
45 &General
::readhash
("${General::swroot}/main/settings", \
%mainsettings);
46 &General
::readhash
("/srv/web/ipfire/html/themes/".$mainsettings{'THEME'}."/include/colors.txt", \
%color);
49 our %netsettings = ();
52 $settings{'INTERFACE'} = '';
53 $settings{'ENABLED'} = '';
54 $settings{'ENCRYPTION'} = '';
55 $settings{'WPA_MODE'} = '';
56 $settings{'SSID'} = '';
57 $settings{'PSK'} = '';
58 $settings{'PRIO'} = '';
60 $settings{'ACTION'} = ''; # add/edit/remove
61 $settings{'ID'} = ''; # point record for ACTION
63 my $errormessage = '';
66 &Header
::showhttpheaders
();
69 &Header
::getcgihash
(\
%settings);
73 if (open(FILE
, "$datafile")) {
78 &General
::readhash
("${General::swroot}/main/settings", \
%settings);
79 &General
::readhash
("${General::swroot}/ethernet/settings", \
%netsettings);
81 # Toggle enable/disable field.
82 if ($settings{'ACTION'} eq $Lang::tr
{'toggle enable disable'}) {
85 foreach my $line (@configs) {
87 my @config = split(/\,/, $line);
89 # Update the entry with the matching ID.
90 if ($config[0] eq $settings{'ID'}) {
91 # Toggle enabled/disabled status.
93 if ($config[2] eq 'on') {
99 $line = join(',', @config);
102 push(@update, $line."\n");
105 # Save updated configuration settings.
106 open(FILE
, ">$datafile") or die 'wlan client datafile error';
112 # Update configuration files.
113 &BuildConfiguration
();
116 $settings{'ACTION'} = '';
119 if ($settings{'ACTION'} eq $Lang::tr
{'add'}) {
120 # Validate input data.
121 $errormessage = ValidateInput
("add");
123 unless ($errormessage) {
124 # Search for the next free id.
125 my $next_id = NextID
();
127 my @config = ($next_id);
128 push(@config, $settings{'INTERFACE'});
129 push(@config, $settings{'ENABLED'});
130 push(@config, $settings{'ENCRYPTION'});
131 push(@config, $settings{'WPA_MODE'});
132 push(@config, $settings{'SSID'});
133 push(@config, $settings{'PSK'});
134 push(@config, $settings{'PRIO'});
135 push(@config, $settings{'AUTH'});
136 push(@config, $settings{'ANONYMOUS'});
137 push(@config, $settings{'IDENTITY'});
138 push(@config, $settings{'PASSWORD'});
140 # Add the new configuration and write all the stuff to the configuration file.
141 my $line = join(',', @config) . "\n";
142 push(@configs, $line);
144 # Save updated configuration settings.
145 open(FILE
, ">$datafile") or die 'wlan client datafile error';
149 # Update configuration files.
150 &BuildConfiguration
();
153 $settings{'ACTION'} = '';
157 if ($settings{'ACTION'} eq $Lang::tr
{'edit'}) {
158 foreach my $line (@configs) {
160 my @config = split(/\,/, $line);
162 if ($config[0] eq $settings{'ID'}) {
163 $settings{'ID'} = $config[0];
164 $settings{'INTERFACE'} = $config[1];
165 $settings{'ENABLED'} = $config[2];
166 $settings{'ENCRYPTION'} = $config[3];
167 $settings{'WPA_MODE'} = $config[4];
168 $settings{'SSID'} = $config[5];
169 $settings{'PSK'} = $config[6];
170 $settings{'PRIO'} = $config[7];
171 $settings{'AUTH'} = $config[8];
172 $settings{'ANONYMOUS'} = $config[9];
173 $settings{'IDENTITY'} = $config[10];
174 $settings{'PASSWORD'} = $config[11];
179 if ($settings{'ACTION'} eq $Lang::tr
{'update'}) {
180 $errormessage = ValidateInput
("update");
182 unless ($errormessage) {
184 foreach my $line (@configs) {
186 my @config = split(/\,/, $line);
188 # Update the entry with the matching ID.
189 if ($config[0] eq $settings{'ID'}) {
190 # Update all configuration settings.
191 # ID and INTERFACE cannot be changed.
192 $config[2] = $settings{'ENABLED'};
193 $config[3] = $settings{'ENCRYPTION'};
194 $config[4] = $settings{'WPA_MODE'};
195 $config[5] = $settings{'SSID'};
196 $config[6] = $settings{'PSK'};
197 $config[7] = $settings{'PRIO'};
198 $config[8] = $settings{'AUTH'};
199 $config[9] = $settings{'ANONYMOUS'};
200 $config[10] = $settings{'IDENTITY'};
201 $config[11] = $settings{'PASSWORD'};
203 $line = join(',', @config);
206 push(@update, $line."\n");
209 # Save updated configuration settings.
210 open(FILE
, ">$datafile") or die 'wlan client datafile error';
216 # Update configuration files.
217 &BuildConfiguration
();
220 $settings{'ACTION'} = '';
224 if ($settings{'ACTION'} eq $Lang::tr
{'remove'}) {
227 foreach my $line (@configs) {
229 my @config = split(/\,/, $line);
231 # Skip the to be removed entry.
232 if ($config[0] eq $settings{'ID'}) {
236 push(@update, $line."\n");
239 # Save updated configuration settings.
240 open(FILE
, ">$datafile") or die 'wlan client datafile error';
246 # Update configuration files.
247 &BuildConfiguration
();
250 $settings{'ACTION'} = '';
253 if ($settings{'ACTION'} eq '') { # First launch from GUI
256 # Action has been set, so show the edit box.
261 &Header
::openpage
($Lang::tr
{'wlan client configuration'}, 1, '');
262 &Header
::openbigbox
('100%', 'left', '', $errormessage);
264 &Header
::openbox
('100%', 'left', $Lang::tr
{'wlan client configuration'});
267 <form method='POST' action='$ENV{'SCRIPT_NAME'}' style='text-align: center;'>
268 <input type='submit' name='ACTION' value='$Lang::tr{'wlan client new network'}' />
273 <table width="100%" class='tbl'>
275 <th align='center'>$Lang::tr{'wlan client ssid'}</th>
276 <th align='center'>$Lang::tr{'wlan client encryption'}</th>
277 <th align='center'>$Lang::tr{'priority'}</th>
285 # Print each line of @configs list
290 foreach my $line (@configs) {
291 # Skip commented lines.
292 my $firstchar = substr($line, 0, 1);
293 next if ($firstchar eq "#");
296 my @config = split(/\,/,$line);
298 #Choose icon for checkbox
301 if ($config[2] eq 'on' ) {
303 $gdesc = $Lang::tr
{'click to disable'};
306 $gdesc = $Lang::tr
{'click to enable'};
312 $col="bgcolor='$color{'color20'}'";
315 $col="bgcolor='$color{'color22'}'";
318 my $encryption_mode = $Lang::tr
{'unknown'};
319 if ($config[3] eq "NONE") {
320 $encryption_mode = $Lang::tr
{'wlan client encryption none'};
321 } elsif ($config[3] eq "WEP") {
322 $encryption_mode = $Lang::tr
{'wlan client encryption wep'};
323 } elsif ($config[3] eq "WPA") {
324 $encryption_mode = $Lang::tr
{'wlan client encryption wpa'};
325 } elsif ($config[3] eq "WPA2") {
326 $encryption_mode = $Lang::tr
{'wlan client encryption wpa2'};
327 } elsif ($config[3] eq "WPA3") {
328 $encryption_mode = $Lang::tr
{'wlan client encryption wpa3'};
329 } elsif ($config[3] eq "EAP") {
330 $encryption_mode = $Lang::tr
{'wlan client encryption eap'};
333 if ($config[3] eq "EAP") {
334 if ($config[8] eq "PEAP") {
335 $encryption_mode .= " ($Lang::tr{'wlan client auth peap'})";
336 } elsif ($config[8] eq "TTLS") {
337 $encryption_mode .= " ($Lang::tr{'wlan client auth ttls'})";
339 $encryption_mode .= " ($Lang::tr{'wlan client auth auto'})";
342 $encryption_mode .= "<hr>";
345 $encryption_mode .= "<strong>$Lang::tr{'wlan client identity'}</strong>: ";
346 $encryption_mode .= $config[10];
351 $encryption_mode .= "<br>";
352 $encryption_mode .= "<strong>$Lang::tr{'wlan client anonymous identity'}</strong>: ";
353 $encryption_mode .= $config[9];
356 } elsif (($config[3] eq "WPA") || ($config[3] eq "WPA2")) {
357 my $wpa_pairwise = "$Lang::tr{'wlan client ccmp'} $Lang::tr{'wlan client and'} $Lang::tr{'wlan client tkip'}";
358 my $wpa_group = "$Lang::tr{'wlan client ccmp'} $Lang::tr{'wlan client and'} $Lang::tr{'wlan client tkip'}";
360 if ($config[4] eq "CCMP-CCMP") {
361 $wpa_pairwise = $Lang::tr
{'wlan client ccmp'};
362 $wpa_group = $Lang::tr
{'wlan client ccmp'};
363 } elsif ($config[4] eq "CCMP-TKIP") {
364 $wpa_pairwise = $Lang::tr
{'wlan client ccmp'};
365 $wpa_group = $Lang::tr
{'wlan client tkip'};
366 } elsif ($config[4] eq "TKIP-TKIP") {
367 $wpa_pairwise = $Lang::tr
{'wlan client tkip'};
368 $wpa_group = $Lang::tr
{'wlan client tkip'};
371 $encryption_mode .= "<hr>";
372 $encryption_mode .= "<strong>$Lang::tr{'wlan client pairwise key algorithm'}</strong>: ";
373 $encryption_mode .= $wpa_pairwise;
374 $encryption_mode .= "<br>";
375 $encryption_mode .= "<strong>$Lang::tr{'wlan client group key algorithm'}</strong>: ";
376 $encryption_mode .= $wpa_group;
380 <td align='center' $col>$config[5]</td>
381 <td align='center' $col>$encryption_mode</td>
382 <td align='center' $col>$config[7]</td>
383 <td align='center' width='5%' $col>
384 <form method='post' action='$ENV{'SCRIPT_NAME'}'>
385 <input type='hidden' name='ACTION' value='$Lang::tr{'toggle enable disable'}' />
386 <input type='image' name='$Lang::tr{'toggle enable disable'}' src='/images/$gif' alt='$gdesc' title='$gdesc' />
387 <input type='hidden' name='ID' value='$config[0]' />
390 <td align='center' width='5%' $col>
391 <form method='post' action='$ENV{'SCRIPT_NAME'}'>
392 <input type='hidden' name='ACTION' value='$Lang::tr{'edit'}' />
393 <input type='image' name='$Lang::tr{'edit'}' src='/images/edit.gif' alt='$Lang::tr{'edit'}' title='$Lang::tr{'edit'}' />
394 <input type='hidden' name='ID' value='$config[0]' />
397 <td align='center' width='5%' $col>
398 <form method='post' action='$ENV{'SCRIPT_NAME'}'>
399 <input type='hidden' name='ACTION' value='$Lang::tr{'remove'}' />
400 <input type='image' name='$Lang::tr{'remove'}' src='/images/delete.gif' alt='$Lang::tr{'remove'}' title='$Lang::tr{'remove'}' />
401 <input type='hidden' name='ID' value='$config[0]' />
410 # If table contains entries, print 'Key to action icons'
415 <td class='boldbase'> <b>$Lang::tr{'legend'}: </b></td>
416 <td><img src='/images/on.gif' alt='$Lang::tr{'click to disable'}' /></td>
417 <td class='base'>$Lang::tr{'click to disable'}</td>
418 <td> </td>
419 <td><img src='/images/off.gif' alt='$Lang::tr{'click to enable'}' /></td>
420 <td class='base'>$Lang::tr{'click to enable'}</td>
421 <td> </td>
422 <td><img src='/images/edit.gif' alt='$Lang::tr{'edit'}' /></td>
423 <td class='base'>$Lang::tr{'edit'}</td>
424 <td> </td>
425 <td><img src='/images/delete.gif' alt='$Lang::tr{'remove'}' /></td>
426 <td class='base'>$Lang::tr{'remove'}</td>
437 &Header
::closebigbox
();
438 &Header
::closepage
();
442 &Header
::openpage
($Lang::tr
{'wlan client configuration'}, 1, '');
443 &Header
::openbigbox
('100%', 'left', '', $errormessage);
446 &Header
::openbox
('100%', 'left', $Lang::tr
{'error messages'});
447 print "<font class='base'>$errormessage </font>";
451 my $buttontext = $Lang::tr
{'add'};
452 if ($settings{'ID'} ne '') {
453 $buttontext = $Lang::tr
{'update'};
454 &Header
::openbox
('100%', 'left', $Lang::tr
{'wlan client edit entry'});
456 &Header
::openbox
('100%', 'left', $Lang::tr
{'wlan client new entry'});
457 $settings{'ENABLED'} = 'on';
459 my $action = $buttontext;
462 $checked{'ENABLED'} = ($settings{'ENABLED'} ne 'on' ) ?
'' : "checked='checked'";
465 $selected{'ENCRYPTION'} = ();
466 $selected{'ENCRYPTION'}{'NONE'} = '';
467 $selected{'ENCRYPTION'}{'WPA3'} = '';
468 $selected{'ENCRYPTION'}{'WPA2'} = '';
469 $selected{'ENCRYPTION'}{'WPA'} = '';
470 $selected{'ENCRYPTION'}{'WEP'} = '';
471 $selected{'ENCRYPTION'}{$settings{'ENCRYPTION'}} = "selected='selected'";
473 $selected{'WPA_MODE'} = ();
474 $selected{'WPA_MODE'}{''} = '';
475 $selected{'WPA_MODE'}{'CCMP-CCMP'} = '';
476 $selected{'WPA_MODE'}{'CCMP-TKIP'} = '';
477 $selected{'WPA_MODE'}{'TKIP-TKIP'} = '';
478 $selected{'WPA_MODE'}{$settings{'WPA_MODE'}} = "selected='selected'";
480 $selected{'AUTH'} = ();
481 $selected{'AUTH'}{''} = '';
482 $selected{'AUTH'}{'PEAP'} = '';
483 $selected{'AUTH'}{'TTLS'} = '';
484 $selected{'AUTH'}{$settings{'AUTH'}} = "selected='selected'";
486 $selected{'PRIO'} = ();
487 $selected{'PRIO'}{'0'} = '';
488 $selected{'PRIO'}{'1'} = '';
489 $selected{'PRIO'}{'2'} = '';
490 $selected{'PRIO'}{'3'} = '';
491 $selected{'PRIO'}{'4'} = '';
492 $selected{'PRIO'}{$settings{'PRIO'}} = "selected='selected'";
495 <form method='POST' action='$ENV{'SCRIPT_NAME'}'>
496 <input type='hidden' name='ID' value='$settings{'ID'}'>
500 <td class='base' width='20%'>$Lang::tr{'wlan client ssid'}:</td>
501 <td width='40%'><input type='text' name='SSID' value="$settings{'SSID'}" size='25'/></td>
502 <td class='base' width='10%'>$Lang::tr{'enabled'}</td>
503 <td width='30%'><input type='checkbox' name='ENABLED' $checked{'ENABLED'} /></td>
506 <td class='base' width='20%'>$Lang::tr{'wlan client encryption'}:</td>
508 <select name='ENCRYPTION'>
509 <option value="NONE" $selected{'ENCRYPTION'}{'NONE'}>$Lang::tr{'wlan client encryption none'}</option>
510 <option value="EAP" $selected{'ENCRYPTION'}{'EAP'}>$Lang::tr{'wlan client encryption eap'}</option>
511 <option value="WPA3" $selected{'ENCRYPTION'}{'WPA3'}>$Lang::tr{'wlan client encryption wpa3'}</option>
512 <option value="WPA2" $selected{'ENCRYPTION'}{'WPA2'}>$Lang::tr{'wlan client encryption wpa2'}</option>
513 <option value="WPA" $selected{'ENCRYPTION'}{'WPA'}>$Lang::tr{'wlan client encryption wpa'}</option>
514 <option value="WEP" $selected{'ENCRYPTION'}{'WEP'}>$Lang::tr{'wlan client encryption wep'}</option>
517 <td colspan="2" width='40%'></td>
520 <td class='base' width='20%'>$Lang::tr{'wlan client psk'}: </td>
521 <td width='40%'><input type='password' name='PSK' value="$settings{'PSK'}" size='25'/></td>
522 <td colspan="2" width='40%'></td>
530 $Lang::tr{'wlan client authentication settings'}:
535 <td class='base' width='20%'>
536 $Lang::tr{'wlan client eap authentication method'}:
540 <option value="" $selected{'AUTH'}{''}>$Lang::tr{'wlan client auth auto'}</option>
541 <option value="PEAP" $selected{'AUTH'}{'PEAP'}>$Lang::tr{'wlan client auth peap'}</option>
542 <option value="TTLS" $selected{'AUTH'}{'TTLS'}>$Lang::tr{'wlan client auth ttls'}</option>
545 <td colspan="2" width='40%'></td>
548 <td class='base' width='20%'>
549 $Lang::tr{'wlan client anonymous identity'}:
552 <input type="text" name="ANONYMOUS" value="$settings{"ANONYMOUS"}" size="25" />
554 <td colspan="2" width='40%'></td>
557 <td class='base' width='20%'>
558 $Lang::tr{'wlan client identity'}:
561 <input type="text" name="IDENTITY" value="$settings{"IDENTITY"}" size="25" />
563 <td colspan="2" width='40%'></td>
566 <td class='base' width='20%'>
567 $Lang::tr{'wlan client password'}:
570 <input type="password" name="PASSWORD" value="$settings{"PASSWORD"}" size="25" />
572 <td colspan="2" width='40%'></td>
581 $Lang::tr{'wlan client advanced settings'}:
586 <td class='base' width='20%'>
587 $Lang::tr{'wlan client wpa mode'}:
590 <select name='WPA_MODE'>
591 <option value="" $selected{'WPA_MODE'}{''}>$Lang::tr{'wlan client wpa mode all'}</option>
592 <option value="CCMP-CCMP" $selected{'WPA_MODE'}{'CCMP-CCMP'}>$Lang::tr{'wlan client wpa mode ccmp ccmp'}</option>
593 <option value="CCMP-TKIP" $selected{'WPA_MODE'}{'CCMP-TKIP'}>$Lang::tr{'wlan client wpa mode ccmp tkip'}</option>
594 <option value="TKIP-TKIP" $selected{'WPA_MODE'}{'TKIP-TKIP'}>$Lang::tr{'wlan client wpa mode tkip tkip'}</option>
597 <td colspan="2" width='40%'>
598 <em>($Lang::tr{'wlan client pairwise key group key'})</em>
602 <td class='base' width='20%'>
603 $Lang::tr{'priority'}:
607 <option value="0" $selected{'PRIO'}{'0'}>0 ($Lang::tr{'least preferred'})</option>
608 <option value="1" $selected{'PRIO'}{'1'}>1</option>
609 <option value="2" $selected{'PRIO'}{'2'}>2</option>
610 <option value="3" $selected{'PRIO'}{'3'}>3</option>
611 <option value="4" $selected{'PRIO'}{'4'}>4 ($Lang::tr{'most preferred'})</option>
614 <td colspan="2" width='40%'></td>
623 <td width='50%' align='center'>
624 <input type='hidden' name='ACTION' value='$action' />
625 <input type='submit' name='SUBMIT' value='$buttontext' />
633 &Header
::closebigbox
();
634 &Header
::closepage
();
638 my $device = $netsettings{'RED_DEV'};
640 # Exit if no device is configured.
641 return if ($device eq "");
643 # Exit if wpa_supplicant is not running on this interface.
644 #return if (! -e "/var/run/wpa_supplicant/$device");
646 open(FILE
, "/usr/local/bin/wirelessclient status |");
652 my ($key, $value) = split("=", $_);
653 $status{$key} = $value;
658 # End here, if no there is no input.
659 return if (!keys %status);
661 &Header
::openbox
('100%', 'left', $Lang::tr
{'status'});
663 if ($status{'ssid'} eq "") {
664 print "<p>$Lang::tr{'wlan client disconnected'}</p>";
671 $Lang::tr{'wlan client ssid'}
679 $Lang::tr{'wlan client bssid'}
687 if ($status{'pmf'} eq "1") {
691 $Lang::tr{'wlan client management frame protection'}
700 if ($status{'EAP state'}) {
701 my $selected_method = $status{'selectedMethod'};
702 $selected_method =~ s/\d+ \((.*)\)/$1/e;
707 <strong>$Lang::tr{'wlan client encryption eap'}</strong>
712 $Lang::tr{'wlan client eap state'}
720 $Lang::tr{'wlan client method'}
728 $Lang::tr{'wlan client tls version'}
731 $status{'eap_tls_version'}
736 $Lang::tr{'wlan client tls cipher'}
739 $status{'EAP TLS cipher'}
744 $Lang::tr{'wlan client eap phase2 method'}
747 $status{"${selected_method}v0 Phase2 method"}
753 if (($status{'pairwise_cipher'} ne "NONE") || ($status{'group_cipher'} ne "NONE")) {
754 if ($status{'key_mgmt'} eq "SAE") {
758 <strong>$Lang::tr{'wlan client encryption wpa3'}</strong>
766 <strong>$Lang::tr{'wlan client encryption wpa'}</strong>
775 $Lang::tr{'wlan client pairwise cipher'}
778 $status{'pairwise_cipher'}
783 $Lang::tr{'wlan client group cipher'}
786 $status{'group_cipher'}
798 sub BuildConfiguration
() {
799 system("/usr/local/bin/wirelessclient restart");
804 foreach my $line (@configs) {
805 # Skip commented lines.
806 my $firstchar = substr($line, 0, 1);
807 next if ($firstchar eq "#");
809 my @config = split(/\,/, $line);
810 if ($config[0] > $highest_id) {
811 $highest_id = $config[0];
815 return $highest_id + 1;
818 sub DuplicateSSID
($) {
821 foreach my $line (@configs) {
822 # Skip commented lines.
823 my $firstchar = substr($line, 0, 1);
824 next if ($firstchar eq "#");
826 my @config = split(/\,/, $line);
827 if ($config[5] eq $ssid) {
835 sub ValidKeyLength
($$) {
839 my $key_length = length($key);
841 if ($algo eq "WEP") {
842 # Key must be 13 or 26 characters.
843 if (($key_length == 13) || ($key_length == 26)) {
849 } elsif (($algo eq "WPA2") || ($algo eq "WPA")) {
850 # Key must be between 8 and 63 chars.
851 if (($key_length >= 8) && ($key_length <= 63)) {
858 # Say okay for all other algorithms.
862 sub ValidateInput
($) {
865 # Check for duplicate SSIDs.
866 if (($mode eq "add") && (DuplicateSSID
($settings{'SSID'}))) {
867 return "$Lang::tr{'wlan client duplicate ssid'}: $settings{'SSID'}";
869 # Check for invalid key length.
870 } elsif (ValidKeyLength
($settings{'ENCRYPTION'}, $settings{'PSK'})) {
871 return "$Lang::tr{'wlan client invalid key length'}";
874 # Reset WPA mode, if WPA(2) is not selected.
875 if (($settings{'ENCRYPTION'} ne "WPA") && ($settings{'ENCRYPTION'} ne "WPA2")) {
876 $settings{'WPA_MODE'} = '';
879 if ($settings{'ENABLED'} ne "") {
880 $settings{'ENABLED'} = 'on';
882 $settings{'ENABLED'} = 'off';