Motivation:
The configuration of 802.11ac access points requires correct configuration of VHT capabilities for the cards in use. Wrong flags in the vht_capab flag variable in /run/hostapd/wlanX.conf files will prevent access points from working. Several flags in that variable have to be synced to other settings within this file.
Bug:
- Observed behavior:
- the flag [VHT160-80PLUS80] is always set within the vht_capab flag variable.
- This flag has to be synced to the variable vht_oper_chwidth.
- From https://w1.fi/cgit/hostap/plain/hostapd/hostapd.conf:
[...] # supported_chan_width: [VHT160] [VHT160-80PLUS80] # Indicates supported Channel widths # 0 = 160 MHz & 80+80 channel widths are not supported (default) # 1 = 160 MHz channel width is supported # 2 = 160 MHz & 80+80 channel widths are supported # 3 = reserved [...] # 0 = 20 or 40 MHz operating Channel width # 1 = 80 MHz channel width # 2 = 160 MHz channel width # 3 = 80+80 MHz channel width #vht_oper_chwidth=1 [...]
- Expected behavior:
- Neither [VHT160] nor [VHT160-80PLUS80] must be set if channel-set-width 0 or channel-set-width 1 is defined in config.boot.
- Only [VHT160] must be set if channel-set-width 2 is defined in config.boot.
- Only [VHT160-80PLUS80] must be set if channel-set-width 3 is defined in config.boot.
Test setup:
Real-World setup:
A PC-Engines APU2 with 2x Compex WLE600VX which support 80MHz channel width, but neither 160MHz nor 80+80MHz.
VHT Capabilities as taken from /config/config.boot -- WiFi interface was configured for 80MHz channel width (channel-set-width 1):
vht { antenna-count 2 antenna-pattern-fixed center-channel-freq { freq-1 42 } channel-set-width 1 ldpc link-adaptation both max-mpdu 11454 max-mpdu-exp 3 short-gi 80 stbc { rx 1 tx } }
Virtual Machine setup:
To verify the correct generation of hostapd config files, you may run simulated WiFi interfaces as follows:
- Set up a VyOS within a VM.
- Add a file /etc/modprobe.d/mac80211_hwsim.conf containing the line options mac80211_hwsim radios=2 which will cause 2 WiFi interfaces to appear when the module mac80211_hwsim is loaded.
- Auto-load the module mac80211_hwsim by adding it to /etc/modules.
- Reboot.
You are now set to test the correct generation of hostapd config files within /run/hostapd/wlanX.conf.