From: Arne Fitzenreiter Date: Wed, 19 Mar 2014 18:00:47 +0000 (+0100) Subject: hostapd: change channellist and status for dfs channels. X-Git-Url: http://git.ipfire.org/?p=people%2Fteissler%2Fipfire-2.x.git;a=commitdiff_plain;h=0f0d6a5a7d4c8a8ac4c01b4f99c030a47cf56e41 hostapd: change channellist and status for dfs channels. --- diff --git a/html/cgi-bin/wlanap.cgi b/html/cgi-bin/wlanap.cgi index c544f7338..5b2490da0 100644 --- a/html/cgi-bin/wlanap.cgi +++ b/html/cgi-bin/wlanap.cgi @@ -258,7 +258,25 @@ if ( -d '/sys/class/net/mon.'.$wlanapsettings{'INTERFACE'} ) { $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; @@ -267,7 +285,8 @@ $_ =~ /(.*)Channel (\d+)(.*):/; $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 @@ -488,12 +507,12 @@ print < 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 < @@ -501,33 +520,37 @@ print <$Lang::tr{'wlanap wlan status'} 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"$chan:$freq"; - $count++; + print"
@status[$i]
"; + 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"
$status
"; + print"$nr"; $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 "@txpower_cmd[$i]@txpower_cmd[$i+1]@txpower_cmd[$i+2]"; + print "@txpower_cmd[$i]"; $count++; } print "
";