$monwlaninterface = 'mon.'.$wlanapsettings{'INTERFACE'};
}
-my @channellist_cmd = `iwlist $monwlaninterface channel|tail -n +2 2>/dev/null`;
+my @channellist_cmd;
+my @channellist;
+
+if ( $wlanapsettings{'DRIVER'} eq 'NL80211' ){
+my $wiphy = `iw dev $wlanapsettings{'INTERFACE'} info | grep wiphy | cut -d" " -f2`;
+chomp $wiphy;
+
+@channellist_cmd = `iw phy phy$wiphy info | grep " MHz \\\[" | grep -v "(disabled)" | grep -v "no IBSS)" 2>/dev/null`;
+# get available channels
+
+my @temp;
+foreach (@channellist_cmd){
+$_ =~ /(.*) \[(\d+)(.*)\]/;
+$channel = $2;chomp $channel;
+if ( $channel =~ /\d+/ ){push(@temp,$channel);}
+}
+@channellist = @temp;
+} else {
+@channellist_cmd = `iwlist $monwlaninterface channel|tail -n +2 2>/dev/null`;
# get available channels
my @temp;
$channel = $2;chomp $channel;
if ( $channel =~ /\d+/ ){push(@temp,$channel);}
}
-my @channellist = @temp;
+@channellist = @temp;
+}
my @countrylist_cmd = `regdbdump /usr/lib/crda/regulatory.bin 2>/dev/null`;
# get available country codes
</table>
END
;
-
+my @status;
if ( $wlanapsettings{'DRIVER'} eq 'MADWIFI' ){
- $status = `wlanconfig $wlanapsettings{'INTERFACE'} list`;
+ @status = `wlanconfig $wlanapsettings{'INTERFACE'} list`;
}
if ( $wlanapsettings{'DRIVER'} eq 'NL80211' ){
- $status = `iw dev $wlanapsettings{'INTERFACE'} station dump`;
+ @status = `iw dev $wlanapsettings{'INTERFACE'} info && iw dev $wlanapsettings{'INTERFACE'} station dump`;
}
print <<END
<br />
<tr><th colspan='3' bgcolor='$color{'color20'}' align='left'><strong>$Lang::tr{'wlanap wlan status'}</strong></th></tr>
END
;
-foreach my $nr (@channellist_cmd){
- my ($chan,$freq) = split(':',$nr);
- if ($count % 2){
+
+for (my $i=0;$i<$#status;$i++){
+
+if (@status[$i]=~"^Station ") { $count++; }
+if ($count % 2){
$col="bgcolor='$color{'color20'}'";
}else{
$col="bgcolor='$color{'color22'}'";
}
- print"<tr><td $col>$chan</td><td $col>:</td><td $col>$freq</td></tr>";
- $count++;
+ print"<tr><td colspan='3' $col><pre>@status[$i]</pre></td></tr>";
+ if (! @status[$i]=~"^/t" ) { $count++; }
}
-if ($count % 2){
+ $count++;
+
+foreach my $nr (@channellist_cmd){
+ if ($count % 2){
$col="bgcolor='$color{'color20'}'";
}else{
$col="bgcolor='$color{'color22'}'";
}
-if ($status){
- print"<tr><td colspan='3' $col><pre>$status</pre></td></tr>";
+ print"<tr><td colspan='3' $col>$nr</td></tr>";
$count++;
}
-for (my $i=0;$i<$#txpower_cmd;$i=$i+4){
- next if (@txpower_cmd[$i] =~ /mon/i);
+
+for (my $i=0;$i<$#txpower_cmd;$i=$i+2){
if ($count % 2){
$col="bgcolor='$color{'color20'}'";
}else{
$col="bgcolor='$color{'color22'}'";
}
- print "<tr><td $col>@txpower_cmd[$i]</td><td $col>@txpower_cmd[$i+1]</td><td $col>@txpower_cmd[$i+2]</td></tr>";
+ print "<tr><td $col>@txpower_cmd[$i]</td></tr>";
$count++;
}
print "</table><br>";