summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorJani Välimaa <wally@mageia.org>2020-06-07 13:54:30 +0300
committerJani Välimaa <wally@mageia.org>2020-06-07 13:54:30 +0300
commit0643fb9c87c59c28bb78dd53f141f6b54327d8f5 (patch)
tree377a38cca7a2a7fb409b2ebbb343362b779d744f /lib
parent4ccbe0a9db6853a30a631388d2d82191a04ee8d4 (diff)
downloaddrakx-net-0643fb9c87c59c28bb78dd53f141f6b54327d8f5.tar
drakx-net-0643fb9c87c59c28bb78dd53f141f6b54327d8f5.tar.gz
drakx-net-0643fb9c87c59c28bb78dd53f141f6b54327d8f5.tar.bz2
drakx-net-0643fb9c87c59c28bb78dd53f141f6b54327d8f5.tar.xz
drakx-net-0643fb9c87c59c28bb78dd53f141f6b54327d8f5.zip
Add basic support for connecting to WPA2-PSK network with net_applet when networkmanager is used
We need to set KEY_MGMT and WPA_PSK in ifcfg file for networkmanager.
Diffstat (limited to 'lib')
-rw-r--r--lib/network/connection/wireless.pm3
-rw-r--r--lib/network/network.pm2
2 files changed, 5 insertions, 0 deletions
diff --git a/lib/network/connection/wireless.pm b/lib/network/connection/wireless.pm
index f6a28b7..4b74310 100644
--- a/lib/network/connection/wireless.pm
+++ b/lib/network/connection/wireless.pm
@@ -708,6 +708,9 @@ sub build_ifcfg_settings {
WIRELESS_ENC_KEY => convert_wep_key_for_iwconfig($self->{access}{network}{key}, $self->{access}{network}{force_ascii_key})),
if_(member($self->{access}{network}{encryption}, qw(open restricted)),
WIRELESS_ENC_MODE => $self->{access}{network}{encryption}),
+ if_($self->{access}{network}{encryption} eq 'wpa-psk',
+ KEY_MGMT => 'WPA-PSK',
+ WPA_PSK => $self->{access}{network}{key}),
if_($self->need_rt2x00_iwpriv,
#- use iwpriv for WPA with rt2400/rt2500 drivers, they don't plan to support wpa_supplicant
WIRELESS_IWPRIV => qq(set AuthMode=WPAPSK
diff --git a/lib/network/network.pm b/lib/network/network.pm
index ba1e022..9e157a4 100644
--- a/lib/network/network.pm
+++ b/lib/network/network.pm
@@ -190,6 +190,7 @@ sub write_interface_settings {
my ($intf, $file) = @_;
setVarsInSh($file, $intf, qw(DEVICE BOOTPROTO IPADDR NETMASK NETWORK BROADCAST GATEWAY ONBOOT HWADDR MACADDR METRIC MII_NOT_SUPPORTED TYPE USERCTL ATM_ADDR ATM_DEVICE ETHTOOL_OPTS VLAN MTU DNS1 DNS2 DOMAIN RESOLV_MODS LINK_DETECTION_DELAY),
qw(WIRELESS_MODE WIRELESS_ESSID WIRELESS_NWID WIRELESS_FREQ WIRELESS_SENS WIRELESS_RATE WIRELESS_ENC_KEY WIRELESS_ENC_MODE WIRELESS_RTS WIRELESS_FRAG WIRELESS_IWCONFIG WIRELESS_IWSPY WIRELESS_IWPRIV WIRELESS_WPA_DRIVER WIRELESS_WPA_REASSOCIATE CRDA_DOMAIN),
+ qw(KEY_MGMT WPA_PSK),
qw(DVB_ADAPTER_ID DVB_NETWORK_DEMUX DVB_NETWORK_PID),
qw(IPV6INIT IPV6TO4INIT),
qw(MRU REMIP PPPOPTIONS HARDFLOWCTL DEFABORT RETRYTIMEOUT PAPNAME LINESPEED MODEMPORT DEBUG ESCAPECHARS INITSTRING),
@@ -204,6 +205,7 @@ sub write_interface_settings {
);
substInFile { s/^DEVICE='(`.*`)'/DEVICE=$1/g } $file; #- remove quotes if DEVICE is the result of a command
chmod $intf->{WIRELESS_ENC_KEY} ? 0700 : 0755, $file; #- hide WEP key for non-root users
+ chmod $intf->{WPA_PSK} ? 0700 : 0755, $file; #- hide WPA key
log::explanations("written $intf->{DEVICE} interface configuration in $file");
}