mirror of
https://github.com/vincentmli/bpfire.git
synced 2026-04-09 18:45:54 +02:00
Implement wireless client on RED.
http://wishlist.ipfire.org/wish/wireless-client-on-red Conflicts: doc/language_issues.de doc/language_issues.en doc/language_issues.es doc/language_issues.fr doc/language_issues.pl doc/language_issues.ru src/misc-progs/Makefile
This commit is contained in:
committed by
Stefan Schantl
parent
139e30d135
commit
61027579bb
@@ -980,4 +980,27 @@ sub GetIcmpDescription ($) {
|
||||
'Experimental');
|
||||
if ($index>41) {return 'unknown'} else {return @icmp_description[$index]};
|
||||
}
|
||||
|
||||
sub RedIsWireless() {
|
||||
# This function checks if a network device is a wireless device.
|
||||
|
||||
my %settings = ();
|
||||
&readhash("${General::swroot}/ethernet/settings", \%settings);
|
||||
|
||||
# Find the name of the network device.
|
||||
my $device = $settings{'RED_DEV'};
|
||||
|
||||
# Exit, if no device is configured.
|
||||
return 0 if ($device eq "");
|
||||
|
||||
# Return 1 if the device is a wireless one.
|
||||
my $path = "/sys/class/net/$device/wireless";
|
||||
if (-d $path) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
# Otherwise return zero.
|
||||
return 0;
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
@@ -157,6 +157,10 @@ sub genmenu {
|
||||
if ( $ethsettings{'CONFIG_TYPE'} =~ /^(1|2|3|4)$/ && $ethsettings{'RED_TYPE'} eq 'STATIC' ) {
|
||||
$menu->{'03.network'}{'subMenu'}->{'70.aliases'}{'enabled'} = 1;
|
||||
}
|
||||
|
||||
if (&General::RedIsWireless()) {
|
||||
$menu->{'01.system'}{'subMenu'}->{'21.wlan'}{'enabled'} = 1;
|
||||
}
|
||||
}
|
||||
|
||||
sub showhttpheaders
|
||||
|
||||
@@ -10,6 +10,12 @@
|
||||
'title' => "$Lang::tr{'alt dialup'}",
|
||||
'enabled' => 1,
|
||||
};
|
||||
$subsystem->{'21.wlan'} = {
|
||||
'caption' => $Lang::tr{'wlan client'},
|
||||
'uri' => '/cgi-bin/wirelessclient.cgi',
|
||||
'title' => "$Lang::tr{'wlan client'}",
|
||||
'enabled' => 0,
|
||||
};
|
||||
$subsystem->{'30.ssh'} = {
|
||||
'caption' => $Lang::tr{'ssh access'},
|
||||
'uri' => '/cgi-bin/remote.cgi',
|
||||
|
||||
@@ -130,6 +130,7 @@ etc/rc.d/init.d/upnpd
|
||||
#etc/rc.d/init.d/vsftpd
|
||||
#etc/rc.d/init.d/watchdog
|
||||
#etc/rc.d/init.d/winbind
|
||||
etc/rc.d/init.d/wlanclient
|
||||
#etc/rc.d/init.d/xinetd
|
||||
#etc/rc.d/rc0.d
|
||||
#etc/rc.d/rc0.d/K01imspetor
|
||||
|
||||
@@ -133,6 +133,7 @@ etc/rc.d/init.d/upnpd
|
||||
#etc/rc.d/init.d/vsftpd
|
||||
#etc/rc.d/init.d/watchdog
|
||||
#etc/rc.d/init.d/winbind
|
||||
etc/rc.d/init.d/wlanclient
|
||||
#etc/rc.d/init.d/xinetd
|
||||
#etc/rc.d/rc0.d
|
||||
#etc/rc.d/rc0.d/K01imspetor
|
||||
|
||||
@@ -35,5 +35,6 @@ usr/local/bin/timectrl
|
||||
usr/local/bin/updxlratorctrl
|
||||
usr/local/bin/upnpctrl
|
||||
usr/local/bin/urlfilterctrl
|
||||
usr/local/bin/wirelessclient
|
||||
usr/local/bin/wirelessctrl
|
||||
#usr/local/bin/wlanapctrl
|
||||
|
||||
@@ -429,7 +429,6 @@ WARNING: translation string unused: transparent on
|
||||
WARNING: translation string unused: umount
|
||||
WARNING: translation string unused: umount removable media before to unplug
|
||||
WARNING: translation string unused: unencrypted
|
||||
WARNING: translation string unused: unknown
|
||||
WARNING: translation string unused: update transcript
|
||||
WARNING: translation string unused: updates
|
||||
WARNING: translation string unused: updates is old1
|
||||
|
||||
@@ -460,7 +460,6 @@ WARNING: translation string unused: transparent on
|
||||
WARNING: translation string unused: umount
|
||||
WARNING: translation string unused: umount removable media before to unplug
|
||||
WARNING: translation string unused: unencrypted
|
||||
WARNING: translation string unused: unknown
|
||||
WARNING: translation string unused: update transcript
|
||||
WARNING: translation string unused: updates
|
||||
WARNING: translation string unused: updates is old1
|
||||
|
||||
@@ -456,7 +456,6 @@ WARNING: translation string unused: transparent on
|
||||
WARNING: translation string unused: umount
|
||||
WARNING: translation string unused: umount removable media before to unplug
|
||||
WARNING: translation string unused: unencrypted
|
||||
WARNING: translation string unused: unknown
|
||||
WARNING: translation string unused: update transcript
|
||||
WARNING: translation string unused: updates
|
||||
WARNING: translation string unused: updates is old1
|
||||
@@ -488,7 +487,10 @@ WARNING: translation string unused: use dov
|
||||
WARNING: translation string unused: use ibod
|
||||
WARNING: translation string unused: view log
|
||||
WARNING: translation string unused: vpn aggrmode
|
||||
<<<<<<< HEAD
|
||||
WARNING: translation string unused: vpn incompatible use of defaultroute
|
||||
=======
|
||||
>>>>>>> 1b23ab3... Implement wireless client on RED.
|
||||
WARNING: translation string unused: vpn mtu invalid
|
||||
WARNING: translation string unused: vpn on blue
|
||||
WARNING: translation string unused: vpn on green
|
||||
@@ -621,4 +623,34 @@ WARNING: untranslated string: system information
|
||||
WARNING: untranslated string: uptime load average
|
||||
WARNING: untranslated string: visit us at
|
||||
WARNING: untranslated string: vpn keyexchange
|
||||
WARNING: untranslated string: wlan client
|
||||
WARNING: untranslated string: wlan client advanced settings
|
||||
WARNING: untranslated string: wlan client and
|
||||
WARNING: untranslated string: wlan client bssid
|
||||
WARNING: untranslated string: wlan client ccmp
|
||||
WARNING: untranslated string: wlan client configuration
|
||||
WARNING: untranslated string: wlan client disconnected
|
||||
WARNING: untranslated string: wlan client duplicate ssid
|
||||
WARNING: untranslated string: wlan client edit entry
|
||||
WARNING: untranslated string: wlan client encryption
|
||||
WARNING: untranslated string: wlan client encryption none
|
||||
WARNING: untranslated string: wlan client encryption wep
|
||||
WARNING: untranslated string: wlan client encryption wpa
|
||||
WARNING: untranslated string: wlan client encryption wpa2
|
||||
WARNING: untranslated string: wlan client group cipher
|
||||
WARNING: untranslated string: wlan client group key algorithm
|
||||
WARNING: untranslated string: wlan client invalid key length
|
||||
WARNING: untranslated string: wlan client new entry
|
||||
WARNING: untranslated string: wlan client new network
|
||||
WARNING: untranslated string: wlan client pairwise cipher
|
||||
WARNING: untranslated string: wlan client pairwise key algorithm
|
||||
WARNING: untranslated string: wlan client pairwise key group key
|
||||
WARNING: untranslated string: wlan client psk
|
||||
WARNING: untranslated string: wlan client ssid
|
||||
WARNING: untranslated string: wlan client tkip
|
||||
WARNING: untranslated string: wlan client wpa mode
|
||||
WARNING: untranslated string: wlan client wpa mode all
|
||||
WARNING: untranslated string: wlan client wpa mode ccmp ccmp
|
||||
WARNING: untranslated string: wlan client wpa mode ccmp tkip
|
||||
WARNING: untranslated string: wlan client wpa mode tkip tkip
|
||||
WARNING: untranslated string: wlanap country
|
||||
|
||||
@@ -455,7 +455,6 @@ WARNING: translation string unused: transparent on
|
||||
WARNING: translation string unused: umount
|
||||
WARNING: translation string unused: umount removable media before to unplug
|
||||
WARNING: translation string unused: unencrypted
|
||||
WARNING: translation string unused: unknown
|
||||
WARNING: translation string unused: update transcript
|
||||
WARNING: translation string unused: updates
|
||||
WARNING: translation string unused: updates is old1
|
||||
@@ -609,6 +608,36 @@ WARNING: untranslated string: urlfilter file ext block
|
||||
WARNING: untranslated string: urlfilter mode block
|
||||
WARNING: untranslated string: visit us at
|
||||
WARNING: untranslated string: vpn keyexchange
|
||||
WARNING: untranslated string: wlan client
|
||||
WARNING: untranslated string: wlan client advanced settings
|
||||
WARNING: untranslated string: wlan client and
|
||||
WARNING: untranslated string: wlan client bssid
|
||||
WARNING: untranslated string: wlan client ccmp
|
||||
WARNING: untranslated string: wlan client configuration
|
||||
WARNING: untranslated string: wlan client disconnected
|
||||
WARNING: untranslated string: wlan client duplicate ssid
|
||||
WARNING: untranslated string: wlan client edit entry
|
||||
WARNING: untranslated string: wlan client encryption
|
||||
WARNING: untranslated string: wlan client encryption none
|
||||
WARNING: untranslated string: wlan client encryption wep
|
||||
WARNING: untranslated string: wlan client encryption wpa
|
||||
WARNING: untranslated string: wlan client encryption wpa2
|
||||
WARNING: untranslated string: wlan client group cipher
|
||||
WARNING: untranslated string: wlan client group key algorithm
|
||||
WARNING: untranslated string: wlan client invalid key length
|
||||
WARNING: untranslated string: wlan client new entry
|
||||
WARNING: untranslated string: wlan client new network
|
||||
WARNING: untranslated string: wlan client pairwise cipher
|
||||
WARNING: untranslated string: wlan client pairwise key algorithm
|
||||
WARNING: untranslated string: wlan client pairwise key group key
|
||||
WARNING: untranslated string: wlan client psk
|
||||
WARNING: untranslated string: wlan client ssid
|
||||
WARNING: untranslated string: wlan client tkip
|
||||
WARNING: untranslated string: wlan client wpa mode
|
||||
WARNING: untranslated string: wlan client wpa mode all
|
||||
WARNING: untranslated string: wlan client wpa mode ccmp ccmp
|
||||
WARNING: untranslated string: wlan client wpa mode ccmp tkip
|
||||
WARNING: untranslated string: wlan client wpa mode tkip tkip
|
||||
WARNING: untranslated string: wlanap access point
|
||||
WARNING: untranslated string: wlanap channel
|
||||
WARNING: untranslated string: wlanap country
|
||||
|
||||
@@ -456,7 +456,6 @@ WARNING: translation string unused: transparent on
|
||||
WARNING: translation string unused: umount
|
||||
WARNING: translation string unused: umount removable media before to unplug
|
||||
WARNING: translation string unused: unencrypted
|
||||
WARNING: translation string unused: unknown
|
||||
WARNING: translation string unused: update transcript
|
||||
WARNING: translation string unused: updates
|
||||
WARNING: translation string unused: updates is old1
|
||||
@@ -488,7 +487,10 @@ WARNING: translation string unused: use dov
|
||||
WARNING: translation string unused: use ibod
|
||||
WARNING: translation string unused: view log
|
||||
WARNING: translation string unused: vpn aggrmode
|
||||
<<<<<<< HEAD
|
||||
WARNING: translation string unused: vpn incompatible use of defaultroute
|
||||
=======
|
||||
>>>>>>> 1b23ab3... Implement wireless client on RED.
|
||||
WARNING: translation string unused: vpn mtu invalid
|
||||
WARNING: translation string unused: vpn on blue
|
||||
WARNING: translation string unused: vpn on green
|
||||
@@ -621,4 +623,34 @@ WARNING: untranslated string: system information
|
||||
WARNING: untranslated string: uptime load average
|
||||
WARNING: untranslated string: visit us at
|
||||
WARNING: untranslated string: vpn keyexchange
|
||||
WARNING: untranslated string: wlan client
|
||||
WARNING: untranslated string: wlan client advanced settings
|
||||
WARNING: untranslated string: wlan client and
|
||||
WARNING: untranslated string: wlan client bssid
|
||||
WARNING: untranslated string: wlan client ccmp
|
||||
WARNING: untranslated string: wlan client configuration
|
||||
WARNING: untranslated string: wlan client disconnected
|
||||
WARNING: untranslated string: wlan client duplicate ssid
|
||||
WARNING: untranslated string: wlan client edit entry
|
||||
WARNING: untranslated string: wlan client encryption
|
||||
WARNING: untranslated string: wlan client encryption none
|
||||
WARNING: untranslated string: wlan client encryption wep
|
||||
WARNING: untranslated string: wlan client encryption wpa
|
||||
WARNING: untranslated string: wlan client encryption wpa2
|
||||
WARNING: untranslated string: wlan client group cipher
|
||||
WARNING: untranslated string: wlan client group key algorithm
|
||||
WARNING: untranslated string: wlan client invalid key length
|
||||
WARNING: untranslated string: wlan client new entry
|
||||
WARNING: untranslated string: wlan client new network
|
||||
WARNING: untranslated string: wlan client pairwise cipher
|
||||
WARNING: untranslated string: wlan client pairwise key algorithm
|
||||
WARNING: untranslated string: wlan client pairwise key group key
|
||||
WARNING: untranslated string: wlan client psk
|
||||
WARNING: untranslated string: wlan client ssid
|
||||
WARNING: untranslated string: wlan client tkip
|
||||
WARNING: untranslated string: wlan client wpa mode
|
||||
WARNING: untranslated string: wlan client wpa mode all
|
||||
WARNING: untranslated string: wlan client wpa mode ccmp ccmp
|
||||
WARNING: untranslated string: wlan client wpa mode ccmp tkip
|
||||
WARNING: untranslated string: wlan client wpa mode tkip tkip
|
||||
WARNING: untranslated string: wlanap country
|
||||
|
||||
@@ -449,7 +449,6 @@ WARNING: translation string unused: transparent on
|
||||
WARNING: translation string unused: umount
|
||||
WARNING: translation string unused: umount removable media before to unplug
|
||||
WARNING: translation string unused: unencrypted
|
||||
WARNING: translation string unused: unknown
|
||||
WARNING: translation string unused: update transcript
|
||||
WARNING: translation string unused: updates
|
||||
WARNING: translation string unused: updates is old1
|
||||
@@ -481,7 +480,10 @@ WARNING: translation string unused: use dov
|
||||
WARNING: translation string unused: use ibod
|
||||
WARNING: translation string unused: view log
|
||||
WARNING: translation string unused: vpn aggrmode
|
||||
<<<<<<< HEAD
|
||||
WARNING: translation string unused: vpn incompatible use of defaultroute
|
||||
=======
|
||||
>>>>>>> 1b23ab3... Implement wireless client on RED.
|
||||
WARNING: translation string unused: vpn mtu invalid
|
||||
WARNING: translation string unused: vpn on blue
|
||||
WARNING: translation string unused: vpn on green
|
||||
@@ -585,4 +587,34 @@ WARNING: untranslated string: static routes
|
||||
WARNING: untranslated string: uptime load average
|
||||
WARNING: untranslated string: visit us at
|
||||
WARNING: untranslated string: vpn keyexchange
|
||||
WARNING: untranslated string: wlan client
|
||||
WARNING: untranslated string: wlan client advanced settings
|
||||
WARNING: untranslated string: wlan client and
|
||||
WARNING: untranslated string: wlan client bssid
|
||||
WARNING: untranslated string: wlan client ccmp
|
||||
WARNING: untranslated string: wlan client configuration
|
||||
WARNING: untranslated string: wlan client disconnected
|
||||
WARNING: untranslated string: wlan client duplicate ssid
|
||||
WARNING: untranslated string: wlan client edit entry
|
||||
WARNING: untranslated string: wlan client encryption
|
||||
WARNING: untranslated string: wlan client encryption none
|
||||
WARNING: untranslated string: wlan client encryption wep
|
||||
WARNING: untranslated string: wlan client encryption wpa
|
||||
WARNING: untranslated string: wlan client encryption wpa2
|
||||
WARNING: untranslated string: wlan client group cipher
|
||||
WARNING: untranslated string: wlan client group key algorithm
|
||||
WARNING: untranslated string: wlan client invalid key length
|
||||
WARNING: untranslated string: wlan client new entry
|
||||
WARNING: untranslated string: wlan client new network
|
||||
WARNING: untranslated string: wlan client pairwise cipher
|
||||
WARNING: untranslated string: wlan client pairwise key algorithm
|
||||
WARNING: untranslated string: wlan client pairwise key group key
|
||||
WARNING: untranslated string: wlan client psk
|
||||
WARNING: untranslated string: wlan client ssid
|
||||
WARNING: untranslated string: wlan client tkip
|
||||
WARNING: untranslated string: wlan client wpa mode
|
||||
WARNING: untranslated string: wlan client wpa mode all
|
||||
WARNING: untranslated string: wlan client wpa mode ccmp ccmp
|
||||
WARNING: untranslated string: wlan client wpa mode ccmp tkip
|
||||
WARNING: untranslated string: wlan client wpa mode tkip tkip
|
||||
WARNING: untranslated string: wlanap country
|
||||
|
||||
@@ -120,6 +120,7 @@
|
||||
< vpn keyexchange
|
||||
< wlanap access point
|
||||
< wlanap channel
|
||||
< wlanap country
|
||||
< wlanap debugging
|
||||
< wlanap del interface
|
||||
< wlanap encryption
|
||||
@@ -138,6 +139,36 @@
|
||||
< wlanap wlan services
|
||||
< wlanap wlan settings
|
||||
< wlanap wlan status
|
||||
< wlan client
|
||||
< wlan client advanced settings
|
||||
< wlan client and
|
||||
< wlan client bssid
|
||||
< wlan client ccmp
|
||||
< wlan client configuration
|
||||
< wlan client disconnected
|
||||
< wlan client duplicate ssid
|
||||
< wlan client edit entry
|
||||
< wlan client encryption
|
||||
< wlan client encryption none
|
||||
< wlan client encryption wep
|
||||
< wlan client encryption wpa
|
||||
< wlan client encryption wpa2
|
||||
< wlan client group cipher
|
||||
< wlan client group key algorithm
|
||||
< wlan client invalid key length
|
||||
< wlan client new entry
|
||||
< wlan client new network
|
||||
< wlan client pairwise cipher
|
||||
< wlan client pairwise key algorithm
|
||||
< wlan client pairwise key group key
|
||||
< wlan client psk
|
||||
< wlan client ssid
|
||||
< wlan client tkip
|
||||
< wlan client wpa mode
|
||||
< wlan client wpa mode all
|
||||
< wlan client wpa mode ccmp ccmp
|
||||
< wlan client wpa mode ccmp tkip
|
||||
< wlan client wpa mode tkip tkip
|
||||
############################################################################
|
||||
# Checking install/setup translations for language: es #
|
||||
############################################################################
|
||||
@@ -264,6 +295,37 @@
|
||||
< uptime load average
|
||||
< visit us at
|
||||
< vpn keyexchange
|
||||
< wlanap country
|
||||
< wlan client
|
||||
< wlan client advanced settings
|
||||
< wlan client and
|
||||
< wlan client bssid
|
||||
< wlan client ccmp
|
||||
< wlan client configuration
|
||||
< wlan client disconnected
|
||||
< wlan client duplicate ssid
|
||||
< wlan client edit entry
|
||||
< wlan client encryption
|
||||
< wlan client encryption none
|
||||
< wlan client encryption wep
|
||||
< wlan client encryption wpa
|
||||
< wlan client encryption wpa2
|
||||
< wlan client group cipher
|
||||
< wlan client group key algorithm
|
||||
< wlan client invalid key length
|
||||
< wlan client new entry
|
||||
< wlan client new network
|
||||
< wlan client pairwise cipher
|
||||
< wlan client pairwise key algorithm
|
||||
< wlan client pairwise key group key
|
||||
< wlan client psk
|
||||
< wlan client ssid
|
||||
< wlan client tkip
|
||||
< wlan client wpa mode
|
||||
< wlan client wpa mode all
|
||||
< wlan client wpa mode ccmp ccmp
|
||||
< wlan client wpa mode ccmp tkip
|
||||
< wlan client wpa mode tkip tkip
|
||||
############################################################################
|
||||
# Checking install/setup translations for language: pl #
|
||||
############################################################################
|
||||
@@ -365,6 +427,37 @@
|
||||
< uptime load average
|
||||
< visit us at
|
||||
< vpn keyexchange
|
||||
< wlanap country
|
||||
< wlan client
|
||||
< wlan client advanced settings
|
||||
< wlan client and
|
||||
< wlan client bssid
|
||||
< wlan client ccmp
|
||||
< wlan client configuration
|
||||
< wlan client disconnected
|
||||
< wlan client duplicate ssid
|
||||
< wlan client edit entry
|
||||
< wlan client encryption
|
||||
< wlan client encryption none
|
||||
< wlan client encryption wep
|
||||
< wlan client encryption wpa
|
||||
< wlan client encryption wpa2
|
||||
< wlan client group cipher
|
||||
< wlan client group key algorithm
|
||||
< wlan client invalid key length
|
||||
< wlan client new entry
|
||||
< wlan client new network
|
||||
< wlan client pairwise cipher
|
||||
< wlan client pairwise key algorithm
|
||||
< wlan client pairwise key group key
|
||||
< wlan client psk
|
||||
< wlan client ssid
|
||||
< wlan client tkip
|
||||
< wlan client wpa mode
|
||||
< wlan client wpa mode all
|
||||
< wlan client wpa mode ccmp ccmp
|
||||
< wlan client wpa mode ccmp tkip
|
||||
< wlan client wpa mode tkip tkip
|
||||
############################################################################
|
||||
# Checking install/setup translations for language: ru #
|
||||
############################################################################
|
||||
@@ -472,4 +565,35 @@
|
||||
< visit us at
|
||||
< vpn keyexchange
|
||||
< week-graph
|
||||
< wlanap country
|
||||
< wlan client
|
||||
< wlan client advanced settings
|
||||
< wlan client and
|
||||
< wlan client bssid
|
||||
< wlan client ccmp
|
||||
< wlan client configuration
|
||||
< wlan client disconnected
|
||||
< wlan client duplicate ssid
|
||||
< wlan client edit entry
|
||||
< wlan client encryption
|
||||
< wlan client encryption none
|
||||
< wlan client encryption wep
|
||||
< wlan client encryption wpa
|
||||
< wlan client encryption wpa2
|
||||
< wlan client group cipher
|
||||
< wlan client group key algorithm
|
||||
< wlan client invalid key length
|
||||
< wlan client new entry
|
||||
< wlan client new network
|
||||
< wlan client pairwise cipher
|
||||
< wlan client pairwise key algorithm
|
||||
< wlan client pairwise key group key
|
||||
< wlan client psk
|
||||
< wlan client ssid
|
||||
< wlan client tkip
|
||||
< wlan client wpa mode
|
||||
< wlan client wpa mode all
|
||||
< wlan client wpa mode ccmp ccmp
|
||||
< wlan client wpa mode ccmp tkip
|
||||
< wlan client wpa mode tkip tkip
|
||||
< year-graph
|
||||
|
||||
703
html/cgi-bin/wirelessclient.cgi
Executable file
703
html/cgi-bin/wirelessclient.cgi
Executable file
@@ -0,0 +1,703 @@
|
||||
#!/usr/bin/perl
|
||||
###############################################################################
|
||||
# #
|
||||
# IPFire.org - A linux based firewall #
|
||||
# Copyright (C) 2012 IPFire Team <info@ipfire.org> #
|
||||
# #
|
||||
# This program is free software: you can redistribute it and/or modify #
|
||||
# it under the terms of the GNU General Public License as published by #
|
||||
# the Free Software Foundation, either version 3 of the License, or #
|
||||
# (at your option) any later version. #
|
||||
# #
|
||||
# This program is distributed in the hope that it will be useful, #
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
|
||||
# GNU General Public License for more details. #
|
||||
# #
|
||||
# You should have received a copy of the GNU General Public License #
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>. #
|
||||
# #
|
||||
###############################################################################
|
||||
|
||||
# DEVICE,ENABLED,MODE,WPA_MODE,SSID,PSK,PRIO
|
||||
# wlan0,on,WPA2,,Use This One Mum,ThisIsTheKey,2
|
||||
|
||||
use strict;
|
||||
|
||||
# enable only the following on debugging purpose
|
||||
use warnings;
|
||||
use CGI::Carp 'fatalsToBrowser';
|
||||
|
||||
require '/var/ipfire/general-functions.pl';
|
||||
require "${General::swroot}/lang.pl";
|
||||
require "${General::swroot}/header.pl";
|
||||
|
||||
#workaround to suppress a warning when a variable is used only once
|
||||
my @dummy = ( ${Header::colouryellow} );
|
||||
undef (@dummy);
|
||||
|
||||
# Files used
|
||||
my $setting = "${General::swroot}/main/settings";
|
||||
our $datafile = "${General::swroot}/ethernet/wireless";
|
||||
|
||||
my %color = ();
|
||||
my %mainsettings = ();
|
||||
&General::readhash("${General::swroot}/main/settings", \%mainsettings);
|
||||
&General::readhash("/srv/web/ipfire/html/themes/".$mainsettings{'THEME'}."/include/colors.txt", \%color);
|
||||
|
||||
our %settings = ();
|
||||
our %netsettings = ();
|
||||
|
||||
$settings{'ID'} = '';
|
||||
$settings{'INTERFACE'} = '';
|
||||
$settings{'ENABLED'} = '';
|
||||
$settings{'ENCRYPTION'} = '';
|
||||
$settings{'WPA_MODE'} = '';
|
||||
$settings{'SSID'} = '';
|
||||
$settings{'PSK'} = '';
|
||||
$settings{'PRIO'} = '';
|
||||
|
||||
$settings{'ACTION'} = ''; # add/edit/remove
|
||||
$settings{'ID'} = ''; # point record for ACTION
|
||||
|
||||
my $errormessage = '';
|
||||
my $warnmessage = '';
|
||||
|
||||
&Header::showhttpheaders();
|
||||
|
||||
#Get GUI values
|
||||
&Header::getcgihash(\%settings);
|
||||
|
||||
# Load multiline data
|
||||
our @configs = ();
|
||||
if (open(FILE, "$datafile")) {
|
||||
@configs = <FILE>;
|
||||
close (FILE);
|
||||
}
|
||||
|
||||
&General::readhash("${General::swroot}/main/settings", \%settings);
|
||||
&General::readhash("${General::swroot}/ethernet/settings", \%netsettings);
|
||||
|
||||
# Toggle enable/disable field.
|
||||
if ($settings{'ACTION'} eq $Lang::tr{'toggle enable disable'}) {
|
||||
my @update;
|
||||
|
||||
foreach my $line (@configs) {
|
||||
chomp($line);
|
||||
my @config = split(/\,/, $line);
|
||||
|
||||
# Update the entry with the matching ID.
|
||||
if ($config[0] eq $settings{'ID'}) {
|
||||
# Toggle enabled/disabled status.
|
||||
|
||||
if ($config[2] eq 'on') {
|
||||
$config[2] = 'off';
|
||||
} else {
|
||||
$config[2] = 'on';
|
||||
}
|
||||
|
||||
$line = join(',', @config);
|
||||
}
|
||||
|
||||
push(@update, $line."\n");
|
||||
}
|
||||
|
||||
# Save updated configuration settings.
|
||||
open(FILE, ">$datafile") or die 'wlan client datafile error';
|
||||
print FILE @update;
|
||||
close(FILE);
|
||||
|
||||
@configs = @update;
|
||||
|
||||
# Update configuration files.
|
||||
&BuildConfiguration();
|
||||
|
||||
# Reset ACTION.
|
||||
$settings{'ACTION'} = '';
|
||||
}
|
||||
|
||||
if ($settings{'ACTION'} eq $Lang::tr{'add'}) {
|
||||
# Validate input data.
|
||||
$errormessage = ValidateInput("add");
|
||||
|
||||
unless ($errormessage) {
|
||||
# Search for the next free id.
|
||||
my $next_id = NextID();
|
||||
|
||||
my @config = ($next_id);
|
||||
push(@config, $settings{'INTERFACE'});
|
||||
push(@config, $settings{'ENABLED'});
|
||||
push(@config, $settings{'ENCRYPTION'});
|
||||
push(@config, $settings{'WPA_MODE'});
|
||||
push(@config, $settings{'SSID'});
|
||||
push(@config, $settings{'PSK'});
|
||||
push(@config, $settings{'PRIO'});
|
||||
|
||||
# Add the new configuration and write all the stuff to the configuration file.
|
||||
my $line = join(',', @config) . "\n";
|
||||
push(@configs, $line);
|
||||
|
||||
# Save updated configuration settings.
|
||||
open(FILE, ">$datafile") or die 'wlan client datafile error';
|
||||
print FILE @configs;
|
||||
close(FILE);
|
||||
|
||||
# Update configuration files.
|
||||
&BuildConfiguration();
|
||||
|
||||
# Reset ACTION.
|
||||
$settings{'ACTION'} = '';
|
||||
}
|
||||
}
|
||||
|
||||
if ($settings{'ACTION'} eq $Lang::tr{'edit'}) {
|
||||
foreach my $line (@configs) {
|
||||
chomp($line);
|
||||
my @config = split(/\,/, $line);
|
||||
|
||||
if ($config[0] eq $settings{'ID'}) {
|
||||
$settings{'ID'} = $config[0];
|
||||
$settings{'INTERFACE'} = $config[1];
|
||||
$settings{'ENABLED'} = $config[2];
|
||||
$settings{'ENCRYPTION'} = $config[3];
|
||||
$settings{'WPA_MODE'} = $config[4];
|
||||
$settings{'SSID'} = $config[5];
|
||||
$settings{'PSK'} = $config[6];
|
||||
$settings{'PRIO'} = $config[7];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($settings{'ACTION'} eq $Lang::tr{'update'}) {
|
||||
$errormessage = ValidateInput("update");
|
||||
|
||||
unless ($errormessage) {
|
||||
my @update;
|
||||
foreach my $line (@configs) {
|
||||
chomp($line);
|
||||
my @config = split(/\,/, $line);
|
||||
|
||||
# Update the entry with the matching ID.
|
||||
if ($config[0] eq $settings{'ID'}) {
|
||||
# Update all configuration settings.
|
||||
# ID and INTERFACE cannot be changed.
|
||||
$config[2] = $settings{'ENABLED'};
|
||||
$config[3] = $settings{'ENCRYPTION'};
|
||||
$config[4] = $settings{'WPA_MODE'};
|
||||
$config[5] = $settings{'SSID'};
|
||||
$config[6] = $settings{'PSK'};
|
||||
$config[7] = $settings{'PRIO'};
|
||||
|
||||
$line = join(',', @config);
|
||||
}
|
||||
|
||||
push(@update, $line."\n");
|
||||
}
|
||||
|
||||
# Save updated configuration settings.
|
||||
open(FILE, ">$datafile") or die 'wlan client datafile error';
|
||||
print FILE @update;
|
||||
close(FILE);
|
||||
|
||||
@configs = @update;
|
||||
|
||||
# Update configuration files.
|
||||
&BuildConfiguration();
|
||||
|
||||
# Reset ACTION.
|
||||
$settings{'ACTION'} = '';
|
||||
}
|
||||
}
|
||||
|
||||
if ($settings{'ACTION'} eq $Lang::tr{'remove'}) {
|
||||
my @update;
|
||||
|
||||
foreach my $line (@configs) {
|
||||
chomp($line);
|
||||
my @config = split(/\,/, $line);
|
||||
|
||||
# Skip the to be removed entry.
|
||||
if ($config[0] eq $settings{'ID'}) {
|
||||
next;
|
||||
}
|
||||
|
||||
push(@update, $line."\n");
|
||||
}
|
||||
|
||||
# Save updated configuration settings.
|
||||
open(FILE, ">$datafile") or die 'wlan client datafile error';
|
||||
print FILE @update;
|
||||
close(FILE);
|
||||
|
||||
@configs = @update;
|
||||
|
||||
# Update configuration files.
|
||||
&BuildConfiguration();
|
||||
|
||||
# Reset ACTION.
|
||||
$settings{'ACTION'} = '';
|
||||
}
|
||||
|
||||
if ($settings{'ACTION'} eq '') { # First launch from GUI
|
||||
&showMainBox();
|
||||
} else {
|
||||
# Action has been set, so show the edit box.
|
||||
&showEditBox();
|
||||
}
|
||||
|
||||
sub showMainBox() {
|
||||
&Header::openpage($Lang::tr{'wlan client configuration'}, 1, '');
|
||||
&Header::openbigbox('100%', 'left', '', $errormessage);
|
||||
|
||||
&Header::openbox('100%', 'left', $Lang::tr{'wlan client configuration'});
|
||||
|
||||
print <<END;
|
||||
<form method='POST' action='$ENV{'SCRIPT_NAME'}' style='text-align: center;'>
|
||||
<input type='submit' name='ACTION' value='$Lang::tr{'wlan client new network'}' />
|
||||
</form>
|
||||
|
||||
<br><hr><br>
|
||||
|
||||
<table width="100%">
|
||||
<tr>
|
||||
<th align='center'>$Lang::tr{'wlan client ssid'}</th>
|
||||
<th align='center'>$Lang::tr{'wlan client encryption'}</th>
|
||||
<th align='center'>$Lang::tr{'priority'}</th>
|
||||
</tr>
|
||||
END
|
||||
|
||||
#
|
||||
# Print each line of @configs list
|
||||
#
|
||||
|
||||
my $key = 0;
|
||||
foreach my $line (@configs) {
|
||||
# Skip commented lines.
|
||||
my $firstchar = substr($line, 0, 1);
|
||||
next if ($firstchar eq "#");
|
||||
|
||||
chomp($line);
|
||||
my @config = split(/\,/,$line);
|
||||
|
||||
#Choose icon for checkbox
|
||||
my $gif = '';
|
||||
my $gdesc = '';
|
||||
if ($config[2] eq 'on' ) {
|
||||
$gif = 'on.gif';
|
||||
$gdesc = $Lang::tr{'click to disable'};
|
||||
} else {
|
||||
$gif = 'off.gif';
|
||||
$gdesc = $Lang::tr{'click to enable'};
|
||||
}
|
||||
|
||||
# Colorize each line
|
||||
if ($key % 2) {
|
||||
print "<tr bgcolor='$color{'color22'}'>";
|
||||
} else {
|
||||
print "<tr bgcolor='$color{'color20'}'>";
|
||||
}
|
||||
|
||||
my $encryption_mode = $Lang::tr{'unknown'};
|
||||
if ($config[3] eq "NONE") {
|
||||
$encryption_mode = $Lang::tr{'wlan client encryption none'};
|
||||
} elsif ($config[3] eq "WEP") {
|
||||
$encryption_mode = $Lang::tr{'wlan client encryption wep'};
|
||||
} elsif ($config[3] eq "WPA") {
|
||||
$encryption_mode = $Lang::tr{'wlan client encryption wpa'};
|
||||
} elsif ($config[3] eq "WPA2") {
|
||||
$encryption_mode = $Lang::tr{'wlan client encryption wpa2'};
|
||||
}
|
||||
|
||||
if (($config[3] eq "WPA") || ($config[3] eq "WPA2")) {
|
||||
my $wpa_pairwise = "$Lang::tr{'wlan client ccmp'} $Lang::tr{'wlan client and'} $Lang::tr{'wlan client tkip'}";
|
||||
my $wpa_group = "$Lang::tr{'wlan client ccmp'} $Lang::tr{'wlan client and'} $Lang::tr{'wlan client tkip'}";
|
||||
|
||||
if ($config[4] eq "CCMP-CCMP") {
|
||||
$wpa_pairwise = $Lang::tr{'wlan client ccmp'};
|
||||
$wpa_group = $Lang::tr{'wlan client ccmp'};
|
||||
} elsif ($config[4] eq "CCMP-TKIP") {
|
||||
$wpa_pairwise = $Lang::tr{'wlan client ccmp'};
|
||||
$wpa_group = $Lang::tr{'wlan client tkip'};
|
||||
} elsif ($config[4] eq "TKIP-TKIP") {
|
||||
$wpa_pairwise = $Lang::tr{'wlan client tkip'};
|
||||
$wpa_group = $Lang::tr{'wlan client tkip'};
|
||||
}
|
||||
|
||||
$encryption_mode .= "<hr>";
|
||||
$encryption_mode .= "<strong>$Lang::tr{'wlan client pairwise key algorithm'}</strong>: ";
|
||||
$encryption_mode .= $wpa_pairwise;
|
||||
$encryption_mode .= "<br>";
|
||||
$encryption_mode .= "<strong>$Lang::tr{'wlan client group key algorithm'}</strong>: ";
|
||||
$encryption_mode .= $wpa_group;
|
||||
}
|
||||
|
||||
print <<END;
|
||||
<td align='center'>$config[5]</td>
|
||||
<td align='center'>$encryption_mode</td>
|
||||
<td align='center'>$config[7]</td>
|
||||
<td align='center' width='5%'>
|
||||
<form method='post' action='$ENV{'SCRIPT_NAME'}'>
|
||||
<input type='hidden' name='ACTION' value='$Lang::tr{'toggle enable disable'}' />
|
||||
<input type='image' name='$Lang::tr{'toggle enable disable'}' src='/images/$gif' alt='$gdesc' title='$gdesc' />
|
||||
<input type='hidden' name='ID' value='$config[0]' />
|
||||
</form>
|
||||
</td>
|
||||
<td align='center' width='5%'>
|
||||
<form method='post' action='$ENV{'SCRIPT_NAME'}'>
|
||||
<input type='hidden' name='ACTION' value='$Lang::tr{'edit'}' />
|
||||
<input type='image' name='$Lang::tr{'edit'}' src='/images/edit.gif' alt='$Lang::tr{'edit'}' title='$Lang::tr{'edit'}' />
|
||||
<input type='hidden' name='ID' value='$config[0]' />
|
||||
</form>
|
||||
</td>
|
||||
<td align='center' width='5%'>
|
||||
<form method='post' action='$ENV{'SCRIPT_NAME'}'>
|
||||
<input type='hidden' name='ACTION' value='$Lang::tr{'remove'}' />
|
||||
<input type='image' name='$Lang::tr{'remove'}' src='/images/delete.gif' alt='$Lang::tr{'remove'}' title='$Lang::tr{'remove'}' />
|
||||
<input type='hidden' name='ID' value='$config[0]' />
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
END
|
||||
$key++;
|
||||
}
|
||||
print "</table>";
|
||||
|
||||
# If table contains entries, print 'Key to action icons'
|
||||
if ($key) {
|
||||
print <<END;
|
||||
<table>
|
||||
<tr>
|
||||
<td class='boldbase'> <b>$Lang::tr{'legend'}: </b></td>
|
||||
<td><img src='/images/on.gif' alt='$Lang::tr{'click to disable'}' /></td>
|
||||
<td class='base'>$Lang::tr{'click to disable'}</td>
|
||||
<td> </td>
|
||||
<td><img src='/images/off.gif' alt='$Lang::tr{'click to enable'}' /></td>
|
||||
<td class='base'>$Lang::tr{'click to enable'}</td>
|
||||
<td> </td>
|
||||
<td><img src='/images/edit.gif' alt='$Lang::tr{'edit'}' /></td>
|
||||
<td class='base'>$Lang::tr{'edit'}</td>
|
||||
<td> </td>
|
||||
<td><img src='/images/delete.gif' alt='$Lang::tr{'remove'}' /></td>
|
||||
<td class='base'>$Lang::tr{'remove'}</td>
|
||||
</tr>
|
||||
</table>
|
||||
END
|
||||
}
|
||||
|
||||
&Header::closebox();
|
||||
|
||||
# Show status box.
|
||||
&ShowStatus();
|
||||
|
||||
&Header::closebigbox();
|
||||
&Header::closepage();
|
||||
}
|
||||
|
||||
sub showEditBox() {
|
||||
&Header::openpage($Lang::tr{'wlan client configuration'}, 1, '');
|
||||
&Header::openbigbox('100%', 'left', '', $errormessage);
|
||||
|
||||
if ($errormessage) {
|
||||
&Header::openbox('100%', 'left', $Lang::tr{'error messages'});
|
||||
print "<font class='base'>$errormessage </font>";
|
||||
&Header::closebox();
|
||||
}
|
||||
|
||||
my $buttontext = $Lang::tr{'add'};
|
||||
if ($settings{'ID'} ne '') {
|
||||
$buttontext = $Lang::tr{'update'};
|
||||
&Header::openbox('100%', 'left', $Lang::tr{'wlan client edit entry'});
|
||||
} else {
|
||||
&Header::openbox('100%', 'left', $Lang::tr{'wlan client new entry'});
|
||||
$settings{'ENABLED'} = 'on';
|
||||
}
|
||||
my $action = $buttontext;
|
||||
|
||||
my %checked = ();
|
||||
$checked{'ENABLED'} = ($settings{'ENABLED'} ne 'on' ) ? '' : "checked='checked'";
|
||||
|
||||
my %selected = ();
|
||||
$selected{'ENCRYPTION'} = ();
|
||||
$selected{'ENCRYPTION'}{'NONE'} = '';
|
||||
$selected{'ENCRYPTION'}{'WPA2'} = '';
|
||||
$selected{'ENCRYPTION'}{'WPA'} = '';
|
||||
$selected{'ENCRYPTION'}{'WEP'} = '';
|
||||
$selected{'ENCRYPTION'}{$settings{'ENCRYPTION'}} = "selected='selected'";
|
||||
|
||||
$selected{'WPA_MODE'} = ();
|
||||
$selected{'WPA_MODE'}{''} = '';
|
||||
$selected{'WPA_MODE'}{'CCMP-CCMP'} = '';
|
||||
$selected{'WPA_MODE'}{'CCMP-TKIP'} = '';
|
||||
$selected{'WPA_MODE'}{'TKIP-TKIP'} = '';
|
||||
$selected{'WPA_MODE'}{$settings{'WPA_MODE'}} = "selected='selected'";
|
||||
|
||||
$selected{'PRIO'} = ();
|
||||
$selected{'PRIO'}{'0'} = '';
|
||||
$selected{'PRIO'}{'1'} = '';
|
||||
$selected{'PRIO'}{'2'} = '';
|
||||
$selected{'PRIO'}{'3'} = '';
|
||||
$selected{'PRIO'}{'4'} = '';
|
||||
$selected{'PRIO'}{$settings{'PRIO'}} = "selected='selected'";
|
||||
|
||||
print <<END;
|
||||
<form method='POST' action='$ENV{'SCRIPT_NAME'}'>
|
||||
<input type='hidden' name='ID' value='$settings{'ID'}'>
|
||||
|
||||
<table width='100%'>
|
||||
<tr>
|
||||
<td class='base' width='20%'>$Lang::tr{'wlan client ssid'}:</td>
|
||||
<td width='40%'><input type='text' name='SSID' value='$settings{'SSID'}' size='25'/></td>
|
||||
<td class='base' width='10%'>$Lang::tr{'enabled'}</td>
|
||||
<td width='30%'><input type='checkbox' name='ENABLED' $checked{'ENABLED'} /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class='base' width='20%'>$Lang::tr{'wlan client encryption'}:</td>
|
||||
<td width='40%'>
|
||||
<select name='ENCRYPTION'>
|
||||
<option value="NONE" $selected{'ENCRYPTION'}{'NONE'}>$Lang::tr{'wlan client encryption none'}</option>
|
||||
<option value="WPA2" $selected{'ENCRYPTION'}{'WPA2'}>$Lang::tr{'wlan client encryption wpa2'}</option>
|
||||
<option value="WPA" $selected{'ENCRYPTION'}{'WPA'}>$Lang::tr{'wlan client encryption wpa'}</option>
|
||||
<option value="WEP" $selected{'ENCRYPTION'}{'WEP'}>$Lang::tr{'wlan client encryption wep'}</option>
|
||||
</select>
|
||||
</td>
|
||||
<td colspan="2" width='40%'></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class='base' width='20%'>$Lang::tr{'wlan client psk'}: </td>
|
||||
<td width='40%'><input type='password' name='PSK' value='$settings{'PSK'}' size='25'/></td>
|
||||
<td colspan="2" width='40%'></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<br>
|
||||
<hr>
|
||||
|
||||
<strong>
|
||||
$Lang::tr{'wlan client advanced settings'}:
|
||||
</strong>
|
||||
|
||||
<table width='100%'>
|
||||
<tr>
|
||||
<td class='base' width='20%'>
|
||||
$Lang::tr{'wlan client wpa mode'}:
|
||||
</td>
|
||||
<td width='40%'>
|
||||
<select name='WPA_MODE'>
|
||||
<option value="" $selected{'WPA_MODE'}{''}>$Lang::tr{'wlan client wpa mode all'}</option>
|
||||
<option value="CCMP-CCMP" $selected{'WPA_MODE'}{'CCMP-CCMP'}>$Lang::tr{'wlan client wpa mode ccmp ccmp'}</option>
|
||||
<option value="CCMP-TKIP" $selected{'WPA_MODE'}{'CCMP-TKIP'}>$Lang::tr{'wlan client wpa mode ccmp tkip'}</option>
|
||||
<option value="TKIP-TKIP" $selected{'WPA_MODE'}{'TKIP-TKIP'}>$Lang::tr{'wlan client wpa mode tkip tkip'}</option>
|
||||
</select>
|
||||
</td>
|
||||
<td colspan="2" width='40%'>
|
||||
<em>($Lang::tr{'wlan client pairwise key group key'})</em>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class='base' width='20%'>
|
||||
$Lang::tr{'priority'}:
|
||||
</td>
|
||||
<td width='40%'>
|
||||
<select name='PRIO'>
|
||||
<option value="0" $selected{'PRIO'}{'0'}>0</option>
|
||||
<option value="1" $selected{'PRIO'}{'1'}>1</option>
|
||||
<option value="2" $selected{'PRIO'}{'2'}>2</option>
|
||||
<option value="3" $selected{'PRIO'}{'3'}>3</option>
|
||||
<option value="4" $selected{'PRIO'}{'4'}>4</option>
|
||||
</select>
|
||||
</td>
|
||||
<td colspan="2" width='40%'></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<br>
|
||||
<hr>
|
||||
|
||||
<table width='100%'>
|
||||
<tr>
|
||||
<td width='50%' align='center'>
|
||||
<input type='hidden' name='ACTION' value='$action' />
|
||||
<input type='submit' name='SUBMIT' value='$buttontext' />
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
END
|
||||
&Header::closebox();
|
||||
|
||||
&Header::closebigbox();
|
||||
&Header::closepage();
|
||||
}
|
||||
|
||||
sub ShowStatus() {
|
||||
my $device = $netsettings{'RED_DEV'};
|
||||
|
||||
# Exit if no device is configured.
|
||||
return if ($device eq "");
|
||||
|
||||
# Exit if wpa_supplicant is not running on this interface.
|
||||
#return if (! -e "/var/run/wpa_supplicant/$device");
|
||||
|
||||
open(FILE, "/usr/local/bin/wirelessclient status |");
|
||||
|
||||
my %status = ();
|
||||
while (<FILE>) {
|
||||
chomp($_);
|
||||
|
||||
my ($key, $value) = split("=", $_);
|
||||
$status{$key} = $value;
|
||||
}
|
||||
|
||||
close(FILE);
|
||||
|
||||
# End here, if no there is no input.
|
||||
return if (!keys %status);
|
||||
|
||||
&Header::openbox('100%', 'left', $Lang::tr{'status'});
|
||||
|
||||
if ($status{'ssid'} eq "") {
|
||||
print "<p>$Lang::tr{'wlan client disconnected'}</p>";
|
||||
|
||||
} else {
|
||||
print <<END;
|
||||
<table width='100%'>
|
||||
<tr>
|
||||
<td width='20%'>
|
||||
$Lang::tr{'wlan client ssid'}
|
||||
</td>
|
||||
<td width='80%'>
|
||||
$status{'ssid'}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width='20%'>
|
||||
$Lang::tr{'wlan client bssid'}
|
||||
</td>
|
||||
<td width='80%'>
|
||||
$status{'bssid'}
|
||||
</td>
|
||||
</tr>
|
||||
END
|
||||
|
||||
if (($status{'pairwise_cipher'} ne "NONE") || ($status{'group_cipher'} ne "NONE")) {
|
||||
print <<END;
|
||||
<tr>
|
||||
<td colspan='2'>
|
||||
<strong>$Lang::tr{'wlan client encryption wpa'}</strong>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width='20%'>
|
||||
$Lang::tr{'wlan client pairwise cipher'}
|
||||
</td>
|
||||
<td width='80%'>
|
||||
$status{'pairwise_cipher'}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width='20%'>
|
||||
$Lang::tr{'wlan client group cipher'}
|
||||
</td>
|
||||
<td width='80%'>
|
||||
$status{'group_cipher'}
|
||||
</td>
|
||||
</tr>
|
||||
END
|
||||
}
|
||||
|
||||
print "</table>";
|
||||
}
|
||||
|
||||
&Header::closebox();
|
||||
}
|
||||
|
||||
sub BuildConfiguration() {
|
||||
system("/usr/local/bin/wirelessclient restart");
|
||||
}
|
||||
|
||||
sub NextID() {
|
||||
my $highest_id = 0;
|
||||
foreach my $line (@configs) {
|
||||
# Skip commented lines.
|
||||
my $firstchar = substr($line, 0, 1);
|
||||
next if ($firstchar eq "#");
|
||||
|
||||
my @config = split(/\,/, $line);
|
||||
if ($config[0] > $highest_id) {
|
||||
$highest_id = $config[0];
|
||||
}
|
||||
}
|
||||
|
||||
return $highest_id + 1;
|
||||
}
|
||||
|
||||
sub DuplicateSSID($) {
|
||||
my $ssid = shift;
|
||||
|
||||
foreach my $line (@configs) {
|
||||
# Skip commented lines.
|
||||
my $firstchar = substr($line, 0, 1);
|
||||
next if ($firstchar eq "#");
|
||||
|
||||
my @config = split(/\,/, $line);
|
||||
if ($config[5] eq $ssid) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
sub ValidKeyLength($$) {
|
||||
my $algo = shift;
|
||||
my $key = shift;
|
||||
|
||||
my $key_length = length($key);
|
||||
|
||||
if ($algo eq "WEP") {
|
||||
# Key must be 13 or 26 characters.
|
||||
if (($key_length == 13) || ($key_length == 26)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
|
||||
} elsif (($algo eq "WPA2") || ($algo eq "WPA")) {
|
||||
# Key must be between 8 and 63 chars.
|
||||
if (($key_length >= 8) && ($key_length <= 63)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
# Say okay for all other algorithms.
|
||||
return 0;
|
||||
}
|
||||
|
||||
sub ValidateInput($) {
|
||||
my $mode = shift;
|
||||
|
||||
# Check for duplicate SSIDs.
|
||||
if (($mode eq "add") && (DuplicateSSID($settings{'SSID'}))) {
|
||||
return "$Lang::tr{'wlan client duplicate ssid'}: $settings{'SSID'}";
|
||||
|
||||
# Check for invalid key length.
|
||||
} elsif (ValidKeyLength($settings{'ENCRYPTION'}, $settings{'PSK'})) {
|
||||
return "$Lang::tr{'wlan client invalid key length'}";
|
||||
|
||||
}
|
||||
|
||||
# Reset WPA mode, if WPA(2) is not selected.
|
||||
if (($settings{'ENCRYPTION'} ne "WPA") && ($settings{'ENCRYPTION'} ne "WPA2")) {
|
||||
$settings{'WPA_MODE'} = '';
|
||||
}
|
||||
|
||||
if ($settings{'ENABLED'} ne "") {
|
||||
$settings{'ENABLED'} = 'on';
|
||||
} else {
|
||||
$settings{'ENABLED'} = 'off';
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -2212,8 +2212,39 @@
|
||||
'wireless config added' => 'Wireless-Konfiguration hinzugefügt',
|
||||
'wireless config changed' => 'Wireless-Konfiguration geändert',
|
||||
'wireless configuration' => 'Wireless-Konfiguration',
|
||||
'wlan client' => 'WLAN-Client',
|
||||
'wlan client advanced settings' => 'Erweiterte Einstellungen',
|
||||
'wlan client and' => 'und',
|
||||
'wlan client bssid' => 'BSSID',
|
||||
'wlan client ccmp' => 'CCMP',
|
||||
'wlan client configuration' => 'WLAN-Client-Konfiguration',
|
||||
'wlan client disconnected' => 'Nicht verbunden',
|
||||
'wlan client duplicate ssid' => 'Doppelte SSID',
|
||||
'wlan client edit entry' => 'Verbindung bearbeiten',
|
||||
'wlan client encryption' => 'Verschlüsselung',
|
||||
'wlan client encryption none' => 'Keine',
|
||||
'wlan client encryption wep' => 'WEP',
|
||||
'wlan client encryption wpa' => 'WPA',
|
||||
'wlan client encryption wpa2' => 'WPA2',
|
||||
'wlan client group cipher' => 'Gruppenchiffre',
|
||||
'wlan client group key algorithm' => 'GKA',
|
||||
'wlan client invalid key length' => 'Ungültige Schlüssellänge.',
|
||||
'wlan client new entry' => 'Neue WLAN-Client-Konfiguration erstellen',
|
||||
'wlan client new network' => 'Neues Netzwerk',
|
||||
'wlan client pairwise cipher' => 'Paarweise Chiffre',
|
||||
'wlan client pairwise key algorithm' => 'PKA',
|
||||
'wlan client pairwise key group key' => 'Paarweise-/Gruppenschlüssel',
|
||||
'wlan client psk' => 'Schlüssel',
|
||||
'wlan client ssid' => 'SSID',
|
||||
'wlan client tkip' => 'TKIP',
|
||||
'wlan client wpa mode' => 'WPA-Modus',
|
||||
'wlan client wpa mode all' => 'Automatisch',
|
||||
'wlan client wpa mode ccmp ccmp' => 'CCMP-CCMP',
|
||||
'wlan client wpa mode ccmp tkip' => 'CCMP-TKIP',
|
||||
'wlan client wpa mode tkip tkip' => 'TKIP-TKIP',
|
||||
'wlanap access point' => 'Access Point',
|
||||
'wlanap channel' => 'Kanal',
|
||||
'wlanap country' => 'Ländercode',
|
||||
'wlanap debugging' => 'Debugging',
|
||||
'wlanap del interface' => 'Ausgewähltes Interface zurücksetzen?',
|
||||
'wlanap encryption' => 'Verschlüsselung',
|
||||
|
||||
@@ -2246,6 +2246,36 @@
|
||||
'wireless config added' => 'Wireless config added',
|
||||
'wireless config changed' => 'Wireless config changed',
|
||||
'wireless configuration' => 'Wireless Configuration',
|
||||
'wlan client' => 'Wireless client',
|
||||
'wlan client advanced settings' => 'Advanced settings',
|
||||
'wlan client and' => 'and',
|
||||
'wlan client bssid' => 'BSSID',
|
||||
'wlan client ccmp' => 'CCMP',
|
||||
'wlan client configuration' => 'Wireless Client Configuration',
|
||||
'wlan client disconnected' => 'Disconnected',
|
||||
'wlan client duplicate ssid' => 'Duplicate SSID',
|
||||
'wlan client edit entry' => 'Edit wireless client configuration',
|
||||
'wlan client encryption' => 'Encryption',
|
||||
'wlan client encryption none' => 'None',
|
||||
'wlan client encryption wep' => 'WEP',
|
||||
'wlan client encryption wpa' => 'WPA',
|
||||
'wlan client encryption wpa2' => 'WPA2',
|
||||
'wlan client group cipher' => 'Group cipher',
|
||||
'wlan client group key algorithm' => 'GKA',
|
||||
'wlan client invalid key length' => 'Invalid key length.',
|
||||
'wlan client new entry' => 'Create new wireless client configuration',
|
||||
'wlan client new network' => 'New network',
|
||||
'wlan client pairwise cipher' => 'Pairwise cipher',
|
||||
'wlan client pairwise key algorithm' => 'PKA',
|
||||
'wlan client pairwise key group key' => 'Pairwise key/group key',
|
||||
'wlan client psk' => 'Pre-shared key',
|
||||
'wlan client ssid' => 'SSID',
|
||||
'wlan client tkip' => 'TKIP',
|
||||
'wlan client wpa mode' => 'WPA mode',
|
||||
'wlan client wpa mode all' => 'Auto',
|
||||
'wlan client wpa mode ccmp ccmp' => 'CCMP-CCMP',
|
||||
'wlan client wpa mode ccmp tkip' => 'CCMP-TKIP',
|
||||
'wlan client wpa mode tkip tkip' => 'TKIP-TKIP',
|
||||
'wlanap access point' => 'Access Point',
|
||||
'wlanap channel' => 'Channel',
|
||||
'wlanap country' => 'Country Code',
|
||||
|
||||
276
src/initscripts/init.d/wlanclient
Executable file
276
src/initscripts/init.d/wlanclient
Executable file
@@ -0,0 +1,276 @@
|
||||
#!/bin/sh
|
||||
########################################################################
|
||||
# Begin $rc_base/init.d/wlan_client
|
||||
#
|
||||
# Description : Wireless client initscript
|
||||
#
|
||||
########################################################################
|
||||
|
||||
. /etc/sysconfig/rc
|
||||
. ${rc_functions}
|
||||
|
||||
eval $(/usr/local/bin/readhash /var/ipfire/ethernet/settings)
|
||||
|
||||
WIRELESS_CONFIG="/var/ipfire/ethernet/wireless"
|
||||
|
||||
function device_is_wireless() {
|
||||
local device=${1}
|
||||
|
||||
if [ -d "/sys/class/net/${device}/wireless" ]; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
return 1
|
||||
}
|
||||
|
||||
function wpa_supplicant_make_config() {
|
||||
local device=${1}
|
||||
local config=${2}
|
||||
shift 2
|
||||
|
||||
# Check if device is wireless.
|
||||
local wireless="false"
|
||||
if device_is_wireless ${device}; then
|
||||
wireless="true"
|
||||
fi
|
||||
|
||||
# Write a configuration file header.
|
||||
(
|
||||
echo "#"
|
||||
echo "# THIS FILE IS AUTOMATICALLY GENERATED AND"
|
||||
echo "# ANY CUSTOM CHANGES WILL BE OVERWRITTEN!"
|
||||
echo "#"
|
||||
echo
|
||||
echo "ctrl_interface=/var/run/wpa_supplicant"
|
||||
echo
|
||||
) > ${config}
|
||||
|
||||
local items=0
|
||||
|
||||
local line
|
||||
while IFS="," read -ra line; do
|
||||
# Skip commented lines.
|
||||
[ "${line:0:1}" = "#" ] && continue
|
||||
|
||||
# Skip disabled entries.
|
||||
[ "${line[2]}" = "on" ] || continue
|
||||
|
||||
wpa_supplicant_config_line \
|
||||
${device} ${config} \
|
||||
--wireless="${wireless}" \
|
||||
--mode="${line[3]}" \
|
||||
--wpa-mode="${line[4]}" \
|
||||
--ssid="${line[5]}" \
|
||||
--psk="${line[6]}" \
|
||||
--priority="${line[7]}"
|
||||
|
||||
items=$(( ${items} + 1 ))
|
||||
|
||||
done < ${WIRELESS_CONFIG}
|
||||
|
||||
# Return exit code 2, when there are no entries in the
|
||||
# configuration file.
|
||||
if [ "${items}" = "0" ]; then
|
||||
return 2
|
||||
fi
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
function wpa_supplicant_config_line() {
|
||||
local device=${1}
|
||||
local config=${2}
|
||||
shift 2
|
||||
|
||||
local auth_alg
|
||||
local proto
|
||||
local key_mgmt
|
||||
local pairwise
|
||||
local group
|
||||
local mode
|
||||
local priority
|
||||
local psk
|
||||
local ssid
|
||||
local wep_tx_keyidx
|
||||
local wep_key0
|
||||
local wireless="true"
|
||||
local wpa_mode
|
||||
|
||||
while [ $# -gt 0 ]; do
|
||||
case "${1}" in
|
||||
--mode=*)
|
||||
mode=${1#--mode=}
|
||||
;;
|
||||
--priority=*)
|
||||
priority=${1#--priority=}
|
||||
;;
|
||||
--psk=*)
|
||||
psk=${1#--psk=}
|
||||
;;
|
||||
--ssid=*)
|
||||
ssid=${1#--ssid=}
|
||||
;;
|
||||
--wireless=*)
|
||||
wireless=${1#--wireless=}
|
||||
;;
|
||||
--wpa-mode=*)
|
||||
wpa_mode=${1#--wpa-mode=}
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
case "${mode}" in
|
||||
WPA2)
|
||||
auth_alg="OPEN"
|
||||
proto="RSN"
|
||||
key_mgmt="WPA-PSK"
|
||||
;;
|
||||
WPA)
|
||||
auth_alg="OPEN"
|
||||
proto="WPA"
|
||||
key_mgmt="WPA-PSK"
|
||||
;;
|
||||
WEP)
|
||||
auth_alg="SHARED"
|
||||
key_mgmt="NONE"
|
||||
|
||||
wep_tx_keyidx=0
|
||||
wep_key0=${psk}
|
||||
psk=""
|
||||
;;
|
||||
NONE)
|
||||
auth_alg="OPEN"
|
||||
key_mgmt="NONE"
|
||||
;;
|
||||
*)
|
||||
# Unsupported mode.
|
||||
return 1
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ "${mode}" = "WPA" -o "${mode}" = "WPA2" ]; then
|
||||
case "${wpa_mode}" in
|
||||
CCMP-CCMP)
|
||||
pairwise="CCMP"
|
||||
group="CCMP"
|
||||
;;
|
||||
CCMP-TKIP)
|
||||
pairwise="CCMP"
|
||||
group="TKIP"
|
||||
;;
|
||||
TKIP-TKIP)
|
||||
pairwise="TKIP"
|
||||
group="TKIP"
|
||||
;;
|
||||
*)
|
||||
pairwise="CCMP TKIP"
|
||||
group="CCMP TKIP"
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
(
|
||||
echo "network={"
|
||||
|
||||
if [ -n "${ssid}" ]; then
|
||||
echo " ssid=\"${ssid}\""
|
||||
fi
|
||||
if [ "${wireless}" = "true" ]; then
|
||||
echo " scan_ssid=1"
|
||||
fi
|
||||
if [ -n "${auth_alg}" ]; then
|
||||
echo " auth_alg=${auth_alg}"
|
||||
fi
|
||||
if [ -n "${key_mgmt}" ]; then
|
||||
echo " key_mgmt=${key_mgmt}"
|
||||
fi
|
||||
if [ -n "${psk}" ]; then
|
||||
echo " psk=\"${psk}\""
|
||||
fi
|
||||
if [ -n "${wep_tx_keyidx}" ]; then
|
||||
echo " wep_tx_keyidx=${wep_tx_keyidx}"
|
||||
fi
|
||||
if [ -n "${wep_key0}" ]; then
|
||||
echo " wep_key0=\"${wep_key0}\""
|
||||
fi
|
||||
if [ -n "${proto}" ]; then
|
||||
echo " proto=${proto}"
|
||||
fi
|
||||
if [ -n "${pairwise}" -a -n "${group}" ]; then
|
||||
echo " pairwise=${pairwise}"
|
||||
echo " group=${group}"
|
||||
fi
|
||||
if [ -n "${priority}" ]; then
|
||||
echo " priority=${priority}"
|
||||
fi
|
||||
|
||||
echo "}"
|
||||
echo
|
||||
) >> ${config}
|
||||
}
|
||||
|
||||
function wpa_supplicant_start() {
|
||||
local device=${1}
|
||||
local config="/etc/wpa_supplicant.conf"
|
||||
|
||||
# Write configuration file.
|
||||
wpa_supplicant_make_config ${device} ${config}
|
||||
[ $? -eq 0 ] || return 0
|
||||
|
||||
# Build wpa_supplicant command line.
|
||||
local wpa_suppl_cmd="wpa_supplicant -B -qqq -i${device} -c${config}"
|
||||
|
||||
if device_is_wireless ${device}; then
|
||||
wpa_suppl_cmd="${wpa_suppl_cmd} -Dwext"
|
||||
else
|
||||
wpa_suppl_cmd="${wpa_suppl_cmd} -Dwired"
|
||||
fi
|
||||
|
||||
# Run the shiz.
|
||||
boot_mesg "Starting wireless client on ${RED_DEV}..."
|
||||
loadproc ${wpa_suppl_cmd}
|
||||
|
||||
# Run wpa_cli to handle reconnection events.
|
||||
boot_mesg "Starting wireless event handler on ${RED_DEV}..."
|
||||
wpa_cli -B -a /etc/rc.d/init.d/networking/wpa_supplicant.exe
|
||||
}
|
||||
|
||||
function wpa_supplicant_stop() {
|
||||
boot_mesg "Stopping wireless event handler on ${RED_DEV}..."
|
||||
killproc wpa_cli
|
||||
|
||||
boot_mesg "Stopping wireless client on ${RED_DEV}..."
|
||||
killproc wpa_supplicant
|
||||
}
|
||||
|
||||
case "${1}" in
|
||||
start)
|
||||
if [ -n "${RED_DEV}" ] && device_is_wireless ${RED_DEV}; then
|
||||
wpa_supplicant_start ${RED_DEV}
|
||||
fi
|
||||
;;
|
||||
|
||||
stop)
|
||||
if [ -n "${RED_DEV}" ] && device_is_wireless ${RED_DEV}; then
|
||||
wpa_supplicant_stop
|
||||
fi
|
||||
;;
|
||||
|
||||
restart)
|
||||
${0} stop
|
||||
sleep 1
|
||||
${0} start
|
||||
;;
|
||||
|
||||
status)
|
||||
statusproc wpa_supplicant
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "Usage: ${0} {start|stop|restart|status}"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
# End $rc_base/init.d/wlan_client
|
||||
@@ -33,7 +33,8 @@ SUID_PROGS = setdmzholes setportfw setxtaccess \
|
||||
redctrl syslogdctrl extrahdctrl sambactrl upnpctrl tripwirectrl \
|
||||
smartctrl clamavctrl addonctrl pakfire mpfirectrl wlanapctrl \
|
||||
setaliases urlfilterctrl updxlratorctrl fireinfoctrl rebuildroutes \
|
||||
getconntracktable
|
||||
getconntracktable wirelessclient
|
||||
SUID_UPDX = updxsetperms
|
||||
|
||||
install : all
|
||||
install -m 755 $(PROGS) /usr/local/bin
|
||||
@@ -157,3 +158,6 @@ rebuildroutes: rebuildroutes.c setuid.o ../install+setup/libsmooth/varval.o
|
||||
|
||||
getconntracktable: getconntracktable.c setuid.o ../install+setup/libsmooth/varval.o
|
||||
$(COMPILE) -I../install+setup/libsmooth/ getconntracktable.c setuid.o ../install+setup/libsmooth/varval.o -o $@
|
||||
|
||||
wirelessclient: wirelessclient.c setuid.o ../install+setup/libsmooth/varval.o
|
||||
$(COMPILE) -I../install+setup/libsmooth/ wirelessclient.c setuid.o ../install+setup/libsmooth/varval.o -o $@
|
||||
|
||||
26
src/misc-progs/wirelessclient.c
Normal file
26
src/misc-progs/wirelessclient.c
Normal file
@@ -0,0 +1,26 @@
|
||||
/* IPFire helper program - wirelessclient
|
||||
*
|
||||
* This program is distributed under the terms of the GNU General Public
|
||||
* Licence. See the file COPYING for details.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "setuid.h"
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
if (!(initsetuid()))
|
||||
exit(1);
|
||||
|
||||
if (strcmp(argv[1], "restart") == 0) {
|
||||
safe_system("/etc/rc.d/init.d/wlanclient restart >/dev/null 2>&1");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (strcmp(argv[1], "status") == 0) {
|
||||
safe_system("/usr/sbin/wpa_cli status verbose");
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user