summaryrefslogtreecommitdiffstats
path: root/lib/network/monitor.pm
diff options
context:
space:
mode:
authorOlivier Blin <oblin@mandriva.com>2008-03-14 18:46:54 +0000
committerOlivier Blin <oblin@mandriva.com>2008-03-14 18:46:54 +0000
commit3cd02bcf87c1f5c2b8b7d3dafed472109bf0b9db (patch)
tree39ce118012c8f856a0b857d4d06bf505bc9d63f2 /lib/network/monitor.pm
parenta9e7173498881873576df600b3fe4aaf6b51dcad (diff)
downloaddrakx-net-3cd02bcf87c1f5c2b8b7d3dafed472109bf0b9db.tar
drakx-net-3cd02bcf87c1f5c2b8b7d3dafed472109bf0b9db.tar.gz
drakx-net-3cd02bcf87c1f5c2b8b7d3dafed472109bf0b9db.tar.bz2
drakx-net-3cd02bcf87c1f5c2b8b7d3dafed472109bf0b9db.tar.xz
drakx-net-3cd02bcf87c1f5c2b8b7d3dafed472109bf0b9db.zip
delay computing of wireless flags (for next commit)
Diffstat (limited to 'lib/network/monitor.pm')
-rw-r--r--lib/network/monitor.pm7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/network/monitor.pm b/lib/network/monitor.pm
index 151d6cb..972cf07 100644
--- a/lib/network/monitor.pm
+++ b/lib/network/monitor.pm
@@ -67,11 +67,14 @@ sub list_wireless {
$qual =~ s!/0+$!/255!; #- prism54 reports quality with division by zero
$qual =~ m!/! ? eval($qual)*100 : $qual;
};
+ my ($has_key, $has_wpa);
foreach (@list) {
if ((/^\s*$/ || /Cell/) && exists $net->{ap}) {
$net->{current} = to_bool($net->{ap} ? $net->{ap} eq $current_ap : $net->{essid} && $net->{essid} eq $current_essid);
+ $net->{flags} = $has_wpa ? '[WPA]' : $has_key ? '[WEP]' : '';
$networks{$net->{ap}} = $net;
$net = {};
+ $has_key = $has_wpa = undef;
}
/Address: (.*)/ and $net->{ap} = lc($1);
/ESSID:"(.*?)"/ and $net->{essid} = $1;
@@ -79,8 +82,8 @@ sub list_wireless {
$net->{mode} = 'Managed' if $net->{mode} eq 'Master';
$_ =~ $quality_match and $net->{signal_strength} = $eval_quality->($1);
m|Signal level:([0-9]+/[0-9]+)| && !$net->{signal_strength} and $net->{signal_strength} = eval($1)*100;
- /Extra:wpa_ie=|IE:.*WPA/ and $net->{flags} = '[WPA]';
- /key:(\S*)\s/ and $net->{flags} ||= $1 eq 'on' && '[WEP]';
+ /key:(\S*)\s/ && $1 eq 'on' and $has_key = 1;
+ /Extra:wpa_ie=|IE:.*WPA/ and $has_wpa = 1;
}
if ($current_ap && exists $networks{$current_ap}) {
foreach (`/sbin/iwconfig $o_intf 2>/dev/null`) {