OpenWrt DFS: Unterschied zwischen den Versionen

Aus Opennet
Wechseln zu: Navigation, Suche
(old content - Hinweis hinzugefügt)
(bisherigen Inhalt kurz zusammengefasst, mehr Überblick)
Zeile 1: Zeile 1:
''' THIS page is only for historical reasons. The content is old and not valid anymore.'''
+
== Aktueller Stand ==
 +
In OpenWrt ''Chaos Calmer'' ist es möglich, Outdoor-Kanäle auszuwählen. Beim Auftreten von DFS-relevanten Signalmustern findet ein Wechsel auf einen Indoor-Kanal statt. Ein Wechsel zurück auf einen Outdoor-Kanal findet aktuell nicht automatisch statt.
  
 +
Beim montäglichen Vereinstreffen in der [[Frieda23]] findet sich regelmäßig auch eine Kleingruppe für die Arbeit an der Verbesserung der DFS-Implementierung zusammen.
  
===Enable DFS for OpenWrt===
+
== Forschungsthemen ==
Aim is to enable DFS for 5 GHz wifi band. Until today we found no usable solution to integrate DFS support into OpenWrt. Without DFS there is no official 802.11a outdoor channels support.
+
* [[OpenWrt DFS/Ereignisstatistik]]: Statistik aufgefangener DFS-Signale
  
In the following we will log our approach to (try to) enable DFS.
+
== Vergangene Fortschritte ==
 +
=== Aktivierung von Outdoor-Kanälen (2014, ieee80211h=1) ===
 +
In OpenWrt ''Barrier Breaker'' war es nicht möglich, Outdoor-Kanäle zu aktivieren.
  
'''Compile trunk of OpenWrt'''
+
Die Ursache war der fehlende Eintrag ''ieee80211h=1'' in der ''hostapd.conf''. Das von uns eingereichte [https://dev.openwrt.org/ticket/14867 OpenWrt-Ticket] wurde wenige Monate später gelöst. Seit Chaos Calmer ist die Auswahl von Outdoor-Kanälen unter Beachtung von DFS-relevanten Signalen möglich.
 
+
On 2014-01-24 we made SVN checkout of OpenWrt trunk with rev. 39385. All compiled well.
+
 
+
'''1st Run'''
+
 
+
Thu Jan  1 00:08:10 1970 daemon.notice netifd: radio0 (933): Configuration file: /var/run/hostapd-phy0.conf
+
Thu Jan  1 00:08:10 1970 daemon.notice netifd: radio0 (933): wlan0: IEEE 802.11 Configured channel (112) not found from the channel list of current mode (2) IEEE 802.11a
+
Thu Jan  1 00:08:10 1970 daemon.notice netifd: radio0 (933): wlan0: IEEE 802.11 Hardware does not support configured channel
+
Thu Jan  1 00:08:10 1970 daemon.notice netifd: radio0 (933): Could not select hw_mode and channel. (-3)
+
Thu Jan  1 00:08:10 1970 daemon.notice netifd: radio0 (933): wlan0: Unable to setup interface.
+
Thu Jan  1 00:08:10 1970 daemon.notice netifd: radio0 (933): hostapd_free_hapd_data: Interface wlan0 wasn't started
+
Thu Jan  1 00:08:10 1970 daemon.notice netifd: radio0 (933): cat: can't open '/var/run/wifi-phy0.pid': No such file or directory
+
Thu Jan  1 00:08:10 1970 daemon.notice netifd: radio0 (933): Command failed: Invalid argument
+
Thu Jan  1 00:08:10 1970 daemon.notice netifd: radio0 (933): Device setup failed: HOSTAPD_START_FAILED
+
 
+
Message "not found from the channel list of current mode" origin:
+
/trunk/build_dir/target-mips_34kc_uClibc-0.9.33.2/hostapd-wpad-mini/hostapd-20131120/src/ap/hw_features.c:885
+
 
+
Three places in source code can generate this error. Now, find the exact place. Add more debug messages manually.
+
 
+
'''2nd Run'''
+
 
+
Again compiles and executed we get error
+
Thu Jan  1 00:00:49 1970 daemon.warn hostapd: wlan0: IEEE 802.11 debug oni: select_hw_mode
+
 
+
Therefore the reason for this error is
+
      ...
+
      case HOSTAPD_CHAN_INVALID:
+
        default:
+
          hostapd_notify_bad_chans(iface);
+
        return -3;
+
      ...
+
new method to search for
+
  hostapd_check_chans(iface)
+
 
+
In that method we have
+
      if (iface->conf->channel) {
+
                if (hostapd_is_usable_chans(iface))
+
                        return HOSTAPD_CHAN_VALID;
+
                else
+
                        return HOSTAPD_CHAN_INVALID;
+
        }
+
 
+
Search now for hostapd_is_usable_chans()
+
static int hostapd_is_usable_chans(struct hostapd_iface *iface)
+
{
+
        if (!hostapd_is_usable_chan(iface, iface->conf->channel, 1))
+
                return 0;
+
        if (!iface->conf->secondary_channel)
+
                return 1;
+
        return hostapd_is_usable_chan(iface, iface->conf->channel +
+
                                      iface->conf->secondary_channel * 4, 0);
+
}
+
There are two possible places to return zero.
+
 
+
Result of next test:
+
Thu Jan  1 00:00:19 1970 daemon.warn hostapd: wlan0: IEEE 802.11 debug oni: select_hw_mode
+
Thu Jan  1 00:00:19 1970 daemon.notice netifd: radio0 (697): debug oni: test1234
+
                  debug oni: if (!hostapd_is_usable_chan(iface, iface->conf->channel, 1))wlan0: IEEE 802.11 Configured channel (112) not found from the channel list of current mode (2) IEEE 802.11a
+
Thu Jan  1 00:00:19 1970 daemon.notice netifd: radio0 (697): wlan0: IEEE 802.11 debug oni: select_hw_mode
+
 
+
Is is the first if clause. Debug this one.
+
 
+
Result:
+
Thu Jan  1 00:00:18 1970 daemon.warn hostapd: wlan0: IEEE 802.11 debug oni: select_hw_mode
+
Thu Jan  1 00:00:18 1970 daemon.notice netifd: radio0 (689): debug oni: test1234debug oni: chan->chan is 36 and channel is 112
+
Thu Jan  1 00:00:18 1970 daemon.notice netifd: radio0 (689): debug oni: chan->chan is 40 and channel is 112
+
Thu Jan  1 00:00:18 1970 daemon.notice netifd: radio0 (689): debug oni: chan->chan is 44 and channel is 112
+
Thu Jan  1 00:00:18 1970 daemon.notice netifd: radio0 (689): debug oni: chan->chan is 48 and channel is 112
+
Thu Jan  1 00:00:18 1970 daemon.notice netifd: radio0 (689): debug oni: chan->chan is 52 and channel is 112
+
Thu Jan  1 00:00:18 1970 daemon.notice netifd: radio0 (689): debug oni: chan->chan is 56 and channel is 112
+
Thu Jan  1 00:00:18 1970 daemon.notice netifd: radio0 (689): debug oni: chan->chan is 60 and channel is 112
+
Thu Jan  1 00:00:18 1970 daemon.notice netifd: radio0 (689): debug oni: chan->chan is 64 and channel is 112
+
Thu Jan  1 00:00:18 1970 daemon.notice netifd: radio0 (689): debug oni: chan->chan is 100 and channel is 112
+
Thu Jan  1 00:00:18 1970 daemon.notice netifd: radio0 (689): debug oni: chan->chan is 104 and channel is 112
+
Thu Jan  1 00:00:18 1970 daemon.notice netifd: radio0 (689): debug oni: chan->chan is 108 and channel is 112
+
Thu Jan  1 00:00:18 1970 daemon.notice netifd: radio0 (689): debug oni: chan->chan is 116 and channel is 112
+
Thu Jan  1 00:00:18 1970 daemon.notice netifd: radio0 (689): debug oni: chan->chan is 120 and channel is 112
+
Thu Jan  1 00:00:18 1970 daemon.notice netifd: radio0 (689): debug oni: chan->chan is 124 and channel is 112
+
Thu Jan  1 00:00:18 1970 daemon.notice netifd: radio0 (689): debug oni: chan->chan is 128 and channel is 112
+
Thu Jan  1 00:00:18 1970 daemon.notice netifd: radio0 (689): debug oni: chan->chan is 132 and channel is 112
+
Thu Jan  1 00:00:18 1970 daemon.notice netifd: radio0 (689): debug oni: chan->chan is 136 and channel is 112
+
Thu Jan  1 00:00:18 1970 daemon.notice netifd: radio0 (689): debug oni: chan->chan is 140 and channel is 112
+
Thu Jan  1 00:00:18 1970 daemon.notice netifd: radio0 (689): debug oni: chan->chan is 149 and channel is 112
+
Thu Jan  1 00:00:18 1970 daemon.notice netifd: radio0 (689): debug oni: chan->chan is 153 and channel is 112
+
Thu Jan  1 00:00:18 1970 daemon.notice netifd: radio0 (689): debug oni: chan->chan is 157 and channel is 112
+
Thu Jan  1 00:00:18 1970 daemon.notice netifd: radio0 (689): debug oni: chan->chan is 161 and channel is 112
+
Thu Jan  1 00:00:18 1970 daemon.notice netifd: radio0 (689): debug oni: chan->chan is 165 and channel is 112
+
Thu Jan  1 00:00:18 1970 daemon.notice netifd: radio0 (689): debug oni: is_usable_chan now returns 0debug oni: if (!hostapd_is_usable_chan(iface, iface->conf->channel, 1))wlan0: IEEE 802.11 Configured channel (112) not found from the channel list of  current mode (2) IEEE 802.11a
+
Thu Jan  1 00:00:18 1970 daemon.notice netifd: radio0 (689): wlan0: IEEE 802.11 debug oni: select_hw_mode
+
 
+
netifd is searching for channel 112 but does not find it. We are changing the channel for futher tests to 108.
+
Thu Jan  1 00:00:19 1970 daemon.notice netifd: radio0 (696): debug oni: test1234debug oni: chan->chan is 36 and channel is 108
+
Thu Jan  1 00:00:19 1970 daemon.notice netifd: radio0 (696): debug oni: chan->chan is 40 and channel is 108
+
Thu Jan  1 00:00:19 1970 daemon.notice netifd: radio0 (696): debug oni: chan->chan is 44 and channel is 108
+
Thu Jan  1 00:00:19 1970 daemon.notice netifd: radio0 (696): debug oni: chan->chan is 48 and channel is 108
+
Thu Jan  1 00:00:19 1970 daemon.notice netifd: radio0 (696): debug oni: chan->chan is 52 and channel is 108
+
Thu Jan  1 00:00:19 1970 daemon.notice netifd: radio0 (696): debug oni: chan->chan is 56 and channel is 108
+
Thu Jan  1 00:00:19 1970 daemon.notice netifd: radio0 (696): debug oni: chan->chan is 60 and channel is 108
+
Thu Jan  1 00:00:19 1970 daemon.notice netifd: radio0 (696): debug oni: chan->chan is 64 and channel is 108
+
Thu Jan  1 00:00:19 1970 daemon.notice netifd: radio0 (696): debug oni: chan->chan is 100 and channel is 108
+
Thu Jan  1 00:00:19 1970 daemon.notice netifd: radio0 (696): debug oni: chan->chan is 104 and channel is 108
+
Thu Jan  1 00:00:19 1970 daemon.notice netifd: radio0 (696): debug oni: chan->chan is 132 and channel is 108
+
Thu Jan  1 00:00:19 1970 daemon.notice netifd: radio0 (696): debug oni: chan->chan is 136 and channel is 108
+
Thu Jan  1 00:00:19 1970 daemon.notice netifd: radio0 (696): debug oni: chan->chan is 140 and channel is 108
+
 
+
Again he is not finding the new channel 108. The question is now, where is the channel list created. It seems that there is an error.
+
Add more debugging.
+
 
+
Thu Jan  1 00:00:18 1970 daemon.notice netifd: radio0 (695): debug oni: test1234debug oni: chan->chan is 36 and channel is 104
+
Thu Jan  1 00:00:18 1970 daemon.notice netifd: radio0 (695): debug oni: chan->chan is 40 and channel is 104
+
Thu Jan  1 00:00:18 1970 daemon.notice netifd: radio0 (695): debug oni: chan->chan is 44 and channel is 104
+
Thu Jan  1 00:00:18 1970 daemon.notice netifd: radio0 (695): debug oni: chan->chan is 48 and channel is 104           
+
Thu Jan  1 00:00:18 1970 daemon.notice netifd: radio0 (695): debug oni: chan->chan is 52 and channel is 104     
+
Thu Jan  1 00:00:18 1970 daemon.notice netifd: radio0 (695): debug oni: chan->chan is 56 and channel is 104   
+
Thu Jan  1 00:00:18 1970 daemon.notice netifd: radio0 (695): debug oni: chan->chan is 60 and channel is 104
+
Thu Jan  1 00:00:18 1970 daemon.notice netifd: radio0 (695): debug oni: chan->chan is 64 and channel is 104
+
Thu Jan  1 00:00:18 1970 daemon.notice netifd: radio0 (695): debug oni: chan->chan is 100 and channel is 104   
+
Thu Jan  1 00:00:18 1970 daemon.notice netifd: radio0 (695): debug oni: found configured channel 104 in channel list BUT ignored.
+
Thu Jan  1 00:00:18 1970 daemon.notice netifd: radio0 (695): cat: can't open '/var/run/wifi-phy0.pid': No such file or directory
+
Thu Jan  1 00:00:18 1970 daemon.notice netifd: radio0 (695): Command failed: Invalid argument             
+
Thu Jan  1 00:00:18 1970 daemon.notice netifd: radio0 (695): Device setup failed: HOSTAPD_START_FAILED
+
 
+
Now we have the case that our configured channel was found. Yeah. BUT is is marked as DISABLED. WTF? Source code:
+
                if (!(chan->flag & HOSTAPD_CHAN_DISABLED))
+
                        return 1;
+
                else {
+
                        printf("debug oni: found configured channel %d in channel list BUT ignored.\n", channel);
+
                        printf("debug oni: channel disabled. chan->flag set AND CHAN_DISABLED\n");
+
                }
+
 
+
New question: Why is the channel marked as disabled.
+
 
+
Now we list all channels with flags:
+
Thu Jan  1 00:00:18 1970 daemon.notice netifd: radio0 (690): debug oni: test1234debug oni: channel 36 , chan->flag 0
+
Thu Jan  1 00:00:18 1970 daemon.notice netifd: radio0 (690): debug oni: channel 40 , chan->flag 0
+
Thu Jan  1 00:00:18 1970 daemon.notice netifd: radio0 (690): debug oni: channel 44 , chan->flag 0
+
Thu Jan  1 00:00:18 1970 daemon.notice netifd: radio0 (690): debug oni: channel 48 , chan->flag 0
+
Thu Jan  1 00:00:18 1970 daemon.notice netifd: radio0 (690): debug oni: channel 52 , chan->flag 1
+
Thu Jan  1 00:00:18 1970 daemon.notice netifd: radio0 (690): debug oni: channel 56 , chan->flag 1
+
Thu Jan  1 00:00:18 1970 daemon.notice netifd: radio0 (690): debug oni: channel 60 , chan->flag 1
+
Thu Jan  1 00:00:18 1970 daemon.notice netifd: radio0 (690): debug oni: channel 64 , chan->flag 1
+
Thu Jan  1 00:00:18 1970 daemon.notice netifd: radio0 (690): debug oni: channel 100 , chan->flag 1
+
Thu Jan  1 00:00:18 1970 daemon.notice netifd: radio0 (690): debug oni: channel 104 , chan->flag 1
+
Thu Jan  1 00:00:18 1970 daemon.notice netifd: radio0 (690): debug oni: channel 136 , chan->flag 1
+
Thu Jan  1 00:00:18 1970 daemon.notice netifd: radio0 (690): debug oni: channel 140 , chan->flag 1
+
Thu Jan  1 00:00:18 1970 daemon.notice netifd: radio0 (690): debug oni: channel 149 , chan->flag 0
+
Thu Jan  1 00:00:18 1970 daemon.notice netifd: radio0 (690): debug oni: channel 153 , chan->flag 0
+
Thu Jan  1 00:00:18 1970 daemon.notice netifd: radio0 (690): debug oni: channel 157 , chan->flag 0
+
Thu Jan  1 00:00:18 1970 daemon.notice netifd: radio0 (690): debug oni: channel 161 , chan->flag 0
+
Thu Jan  1 00:00:18 1970 daemon.notice netifd: radio0 (690): debug oni: channel 165 , chan->flag 0
+
Thu Jan  1 00:00:18 1970 daemon.notice netifd: radio0 (690): debug oni: chan->chan is 36 and channel is 104
+
Thu Jan  1 00:00:18 1970 daemon.notice netifd: radio0 (690): debug oni: chan->chan is 40 and channel is 104
+
Thu Jan  1 00:00:18 1970 daemon.notice netifd: radio0 (690): debug oni: chan->chan is 44 and channel is 104
+
Thu Jan  1 00:00:18 1970 daemon.notice netifd: radio0 (690): debug oni: chan->chan is 48 and channel is 104
+
Thu Jan  1 00:00:18 1970 daemon.notice netifd: radio0 (690): debug oni: chan->chan is 52 and channel is 104
+
Thu Jan  1 00:00:18 1970 daemon.notice netifd: radio0 (690): debug oni: chan->chan is 56 and channel is 104
+
Thu Jan  1 00:00:18 1970 daemon.notice netifd: radio0 (690): debug oni: chan->chan is 60 and channel is 104
+
Thu Jan  1 00:00:18 1970 daemon.notice netifd: radio0 (690): debug oni: chan->chan is 64 and channel is 104
+
Thu Jan  1 00:00:18 1970 daemon.notice netifd: radio0 (690): debug oni: chan->chan is 100 and channel is 104
+
Thu Jan  1 00:00:18 1970 daemon.notice netifd: radio0 (690): debug oni: found configured channel 104 in channel list BUT ignored.
+
Thu Jan  1 00:00:18 1970 daemon.notice netifd: radio0 (690): debug oni: channel disabled. chan->flag set AND CHAN_DISABLED
+
Thu Jan  1 00:00:18 1970 daemon.notice netifd: radio0 (690): debug oni: chan->chan is 108 and channel is 104
+
Thu Jan  1 00:00:18 1970 daemon.notice netifd: radio0 (690): Command failed: Invalid argument
+
Thu Jan  1 00:00:18 1970 daemon.notice netifd: radio0 (690): Device setup failed: HOSTAPD_START_FAILED
+
 
+
All outdoor channels are disabled. Find the place where this is done. Shouldn't that be fixed in hostapd with all the patches for DFS???
+
 
+
Active wpad (hostapd) intern debug messages with
+
option log_level 0
+
in wifi section in /etc/config/wireless
+
 
+
Now we see an earlier error message:
+
Thu Jan  1 00:00:19 1970 kern.info kernel: [   19.100000] br-lan: port 2(wlan0) entered forwarding state
+
Thu Jan  1 00:00:19 1970 daemon.warn hostapd: wlan0: IEEE 802.11 Configured channel (104) not found from the channel list of current mode (2) IEEE 802.11a
+
Thu Jan  1 00:00:19 1970 daemon.warn hostapd: wlan0: IEEE 802.11 Hardware does not support configured channel
+
Thu Jan  1 00:00:19 1970 daemon.warn hostapd: wlan0: IEEE 802.11 debug oni: select_hw_mode
+
 
+
Why is channel 104 not in list of 802.11a?
+
 
+
Source of this message can be found in hostapd_notify_bad_chans()
+
 
+
....What now???...
+
 
+
''It seems to be a crda/regdom problem!! I suppose that the channel list isn't read from the binary encoded regdomdb file, but directly from the EEPROM of the wireless NIC.. It might be that the Atheros SoC is hardcoded to a region which doesn't support DFS e.g. CN.. In the kernel configuration there is the possibility to set an option to instruct the atheros driver to read the regdom not from the EEPROM of the wireless NIC, but directly from the regdb file over crda and to override thus the table in the memory.. To edit kernel configuration in OpenWrt you can simply use "make kernel_menuconfig".. HTH --[[Benutzer:P424D0X|P424D0X]] ([[Benutzer Diskussion:P424D0X|Diskussion]]) 10:21, 25. Jan. 2014 (CET)''
+
 
+
 
+
 
+
'''Other way to find the problem'''
+
Todo
+
* Enable ALL debug messages. There are many debug messages which are not enabled by log_level.
+
* Why is there no channel 104 in dfs_is_chan_allowed() in dfs.c ?
+
 
+
 
+
 
+
====Solution====
+
...
+
 
+
after some longer debugging and testing
+
 
+
...
+
 
+
We finally solved the problem. Result:
+
Thu Jan  1 00:00:18 1970 kern.info kernel: [  18.850000] cfg80211: Calling CRDA for country: DE
+
Thu Jan  1 00:00:18 1970 kern.info kernel: [  18.850000] cfg80211: Regulatory domain changed to country: DE
+
Thu Jan  1 00:00:18 1970 kern.info kernel: [  18.860000] cfg80211:  DFS Master region ETSI
+
Thu Jan  1 00:00:18 1970 kern.info kernel: [  18.860000] cfg80211:  (start_freq - end_freq @ bandwidth), (max_antenna_gain, max_eirp)
+
Thu Jan  1 00:00:18 1970 kern.info kernel: [  18.870000] cfg80211:  (2400000 KHz - 2483000 KHz @ 40000 KHz), (N/A, 2000 mBm)
+
Thu Jan  1 00:00:18 1970 kern.info kernel: [  18.880000] cfg80211:  (5150000 KHz - 5250000 KHz @ 80000 KHz), (N/A, 2000 mBm)
+
Thu Jan  1 00:00:18 1970 kern.info kernel: [  18.890000] cfg80211:  (5250000 KHz - 5350000 KHz @ 80000 KHz), (N/A, 2000 mBm)
+
Thu Jan  1 00:00:18 1970 kern.info kernel: [  18.900000] cfg80211:  (5470000 KHz - 5725000 KHz @ 80000 KHz), (N/A, 2700 mBm)
+
Thu Jan  1 00:00:18 1970 kern.info kernel: [  18.900000] cfg80211:  (57240000 KHz - 65880000 KHz @ 2160000 KHz), (N/A, 4000 mBm)
+
Thu Jan  1 00:00:20 1970 kern.info kernel: [  20.580000] IPv6: ADDRCONF(NETDEV_UP): wlan0: link is not ready
+
Thu Jan  1 00:00:20 1970 kern.info kernel: [  20.590000] device wlan0 entered promiscuous mode
+
 
+
Reason for that was a missing configuration (ieee80211h=1) in hostapd.conf. There is no configuration possibility to enable it.
+
 
+
We created a ticket for OpenWRT which solves this problem, see https://dev.openwrt.org/ticket/14867
+
  
 
[[Category:Firmware]]
 
[[Category:Firmware]]
 
[[Category:WLAN Protokolle]]
 
[[Category:WLAN Protokolle]]

Version vom 24. Januar 2016, 23:37 Uhr

Inhaltsverzeichnis

Aktueller Stand

In OpenWrt Chaos Calmer ist es möglich, Outdoor-Kanäle auszuwählen. Beim Auftreten von DFS-relevanten Signalmustern findet ein Wechsel auf einen Indoor-Kanal statt. Ein Wechsel zurück auf einen Outdoor-Kanal findet aktuell nicht automatisch statt.

Beim montäglichen Vereinstreffen in der Frieda23 findet sich regelmäßig auch eine Kleingruppe für die Arbeit an der Verbesserung der DFS-Implementierung zusammen.

Forschungsthemen

Vergangene Fortschritte

Aktivierung von Outdoor-Kanälen (2014, ieee80211h=1)

In OpenWrt Barrier Breaker war es nicht möglich, Outdoor-Kanäle zu aktivieren.

Die Ursache war der fehlende Eintrag ieee80211h=1 in der hostapd.conf. Das von uns eingereichte OpenWrt-Ticket wurde wenige Monate später gelöst. Seit Chaos Calmer ist die Auswahl von Outdoor-Kanälen unter Beachtung von DFS-relevanten Signalen möglich.

Meine Werkzeuge
Namensräume

Varianten
Aktionen
Start
Opennet
Kommunikation
Karten
Werkzeuge