Page MenuHomeVyOS Platform

vyos-1x: WiFi mode ieee80211ac should also activate ieee80211n
Closed, ResolvedPublicBUG

Description

When using WiFi APs in ieee80211ac, also mode ieee80211n is supported. However, when configuring

set interfaces wireless wlanX mode ac

the hostapd configuration only includes ieee80211ac but lacks ieee80211n.

This worked in VyOS 1.2 (self-built at 201808072059).

Details

Difficulty level
Unknown (require assessment)
Version
vyos-1x commit id: 551e41895953bb291fc10bdb9ba2a07e83310070
Why the issue appeared?
Will be filled on close
Is it a breaking change?
Unspecified (possibly destroys the router)
Issue type
Bug (incorrect behavior)

Event Timeline

c-po changed the task status from Open to In progress.Apr 4 2020, 10:20 AM
c-po claimed this task.

Hi @alainlamar how should the generated configuration look like?

Got any hints?

Aye, from what I see in my old wireless-hostap.pl, logic should go like this. Every "print" is output to the wlanX.cfg which serves as config input for hostapd.

# hostapd option: hw_mode=[a|b|g|ad]
# hostapd option: ieee80211n=[0|1] (on 2.4GHz PHYs)
# hostapd option: ieee80211h=[0|1] (on 5GHz PHYs)
# hostapd option: ieee80211ac=[0|1] (on 5GHz PHYs)
my $hw_mode = $config->returnValue('mode');
if ( $hw_mode eq 'n' ) {
    print "hw_mode=g\n";
    print "ieee80211n=1\n";
} elsif ( $hw_mode eq 'ac' ) {
    print "hw_mode=a\n";
    print "ieee80211h=1\n";
    print "ieee80211ac=1\n";
} else {
    print "hw_mode=$hw_mode\n";
}

Found it. My bad.

Here, we are within the code block in wireless-hostapd.pl that writes the vht_capab=[tick][trick][track] flags. If there are VHT flags configured but VHT is not a required station feature (that is, it is optional for clients), then and just then add capability for 5GHz mode n which produces a 5GHz AP talking mode ac and mode n - being compatible to older 5GHz NICs that cannot yet use mode ac. Otherwise, if require_vhtis set in VyOS config, decline mode n (use mode ac only) and make VHT capabilities a requirement to WiFi stations.

print "vht_capab=$vht_capab\n";
$config->setLevel("$level capabilities");
if ($config->exists('require-vht')) {
    my $require_vht = $config->returnValue("require-vht");
    if ($require_vht eq "true") {
        print "require_vht=1\n";
        print "ieee80211n=0\n";
    } else {
        print "ieee80211n=1\n";
    }
}

These are the VyOS 1.2 configuration commands for a mixed-mode 5GHz AP:

set interfaces wireless wlan1 bridge-group bridge 'br0'
set interfaces wireless wlan1 capabilities ht 40MHz-incapable 'false'
set interfaces wireless wlan1 capabilities ht auto-powersave 'true'
set interfaces wireless wlan1 capabilities ht channel-set-width 'ht20'
set interfaces wireless wlan1 capabilities ht channel-set-width 'ht40+'
set interfaces wireless wlan1 capabilities ht channel-set-width 'ht40-'
set interfaces wireless wlan1 capabilities ht delayed-block-ack 'false'
set interfaces wireless wlan1 capabilities ht dsss-cck-40 'true'
set interfaces wireless wlan1 capabilities ht greenfield 'false'
set interfaces wireless wlan1 capabilities ht ldpc 'true'
set interfaces wireless wlan1 capabilities ht lsig-protection 'false'
set interfaces wireless wlan1 capabilities ht max-amsdu '7935'
set interfaces wireless wlan1 capabilities ht short-gi '20'
set interfaces wireless wlan1 capabilities ht short-gi '40'
set interfaces wireless wlan1 capabilities ht stbc rx '1'
set interfaces wireless wlan1 capabilities ht stbc tx 'true'
set interfaces wireless wlan1 capabilities require-ht 'true'
set interfaces wireless wlan1 capabilities require-vht 'false'
set interfaces wireless wlan1 capabilities vht antenna-count '2'
set interfaces wireless wlan1 capabilities vht antenna-pattern-fixed 'true'
set interfaces wireless wlan1 capabilities vht center-channel-freq freq-1 '42'
set interfaces wireless wlan1 capabilities vht channel-set-width '1'
set interfaces wireless wlan1 capabilities vht ldpc 'true'
set interfaces wireless wlan1 capabilities vht link-adaptation 'both'
set interfaces wireless wlan1 capabilities vht max-mpdu '11454'
set interfaces wireless wlan1 capabilities vht max-mpdu-exp '3'
set interfaces wireless wlan1 capabilities vht short-gi '80'
set interfaces wireless wlan1 capabilities vht stbc rx '1'
set interfaces wireless wlan1 capabilities vht stbc tx 'true'
set interfaces wireless wlan1 capabilities vht tx-powersave 'false'
set interfaces wireless wlan1 capabilities vht vht-cf 'false'
set interfaces wireless wlan1 channel '36'
set interfaces wireless wlan1 debug 'disable'
set interfaces wireless wlan1 description '<redacted>'
set interfaces wireless wlan1 expunge-failing-stations 'false'
set interfaces wireless wlan1 hw-id '<redacted>'
set interfaces wireless wlan1 isolate-stations 'false'
set interfaces wireless wlan1 max-stations '16'
set interfaces wireless wlan1 mgmt-frame-protection 'disabled'
set interfaces wireless wlan1 mode 'ac'
set interfaces wireless wlan1 security wpa cipher 'CCMP'
set interfaces wireless wlan1 security wpa mode 'wpa2'
set interfaces wireless wlan1 security wpa passphrase '<redacted>'
set interfaces wireless wlan1 ssid '<redacted>'
set interfaces wireless wlan1 type 'access-point'

The resulting mixed-mode 5GHz AP config file on VyOS 1.2 looked as follows:

# Hostapd configuration for wlan1
device_name=<redacted>
interface=wlan1
driver=nl80211
bridge=br0
wds_sta=1
logger_syslog=-1
logger_syslog_level=1
logger_stdout=-1
logger_stdout_level=4
country_code=DE
ieee80211d=1
ssid=<redacted>
channel=36
hw_mode=a
ieee80211h=1
ieee80211ac=1
ieee80211w=0
ht_capab=[DSSS_CCK-40][LDPC][MAX-AMSDU-7935][HT20][HT40+][HT40-][SHORT-GI-20][SHORT-GI-40][TX-STBC][RX-STBC1]
wme_enabled=1
wmm_enabled=1
uapsd_advertisement_enabled=1
require_ht=1
vht_oper_chwidth=1
vht_oper_centr_freq_seg0_idx=42
vht_capab=[MAX-MPDU-11454][MAX-A-MPDU-LEN-EXP3][TX-STBC-2BY1][RX-STBC-1][VHT-LINK-ADAPT3][SHORT-GI-80][RXLDPC][RX-ANTENNA-PATTERN][TX-ANTENNA-PATTERN][BF-ANTENNA-2][SOUNDING-DIMENSION-2]
ieee80211n=1
macaddr_acl=0
max_num_sta=16
wpa=2
rsn_pairwise=CCMP
auth_algs=1
wpa_passphrase=<redacted>
wpa_key_mgmt=WPA-PSK
tx_queue_data3_aifs=7
tx_queue_data3_cwmin=15
tx_queue_data3_cwmax=1023
tx_queue_data3_burst=0
tx_queue_data2_aifs=3
tx_queue_data2_cwmin=15
tx_queue_data2_cwmax=63
tx_queue_data2_burst=0
tx_queue_data1_aifs=1
tx_queue_data1_cwmin=7
tx_queue_data1_cwmax=15
tx_queue_data1_burst=3.0
tx_queue_data0_aifs=1
tx_queue_data0_cwmin=3
tx_queue_data0_cwmax=7
tx_queue_data0_burst=1.5
wmm_ac_bk_cwmin=4
wmm_ac_bk_cwmax=10
wmm_ac_bk_aifs=7
wmm_ac_bk_txop_limit=0
wmm_ac_bk_acm=0
wmm_ac_be_aifs=3
wmm_ac_be_cwmin=4
wmm_ac_be_cwmax=10
wmm_ac_be_txop_limit=0
wmm_ac_be_acm=0
wmm_ac_vi_aifs=2
wmm_ac_vi_cwmin=3
wmm_ac_vi_cwmax=4
wmm_ac_vi_txop_limit=94
wmm_ac_vi_acm=0
wmm_ac_vo_aifs=2
wmm_ac_vo_cwmin=2
wmm_ac_vo_cwmax=3
wmm_ac_vo_txop_limit=47
wmm_ac_vo_acm=0

Pull request: https://github.com/vyos/vyos-1x/pull/330

@c-po: Would you plz double-check if my changes were correct? I find it difficult to blindly implement Jinja2 with no dry-test-bed at hand.

Looks good, you can actually emulate a wifi card: modprobe mac80211_hwsim

There is also a smoketest avcailable to be executed to test if the config can be "rendered at all" https://github.com/vyos/vyos-smoketest/blob/master/scripts/cli/test_interfaces_wireless.py

you can call it from any ISO: sudo /usr/libexec/vyos/tests/smoke/cli/test_interfaces_wireless.py

c-po added a subscriber: c-po.

I use http://jinja.quantprogramming.com/ to test templates. With it you
can test all possible combinations of input variables. (You need to test
all combinations if you're stripping whitespace, as some combination can
have a good format, another can have too much whitespace stripped)

Apr 11, 2020 7:08:11 PM alainlamar (Alain Lamar)
<[email protected]>:

alainlamar added a comment.

Pull request: https://github.com/vyos/vyos-1x/pull/330

@c-po: Would you plz double-check if my changes were correct? I find it

difficult to blindly implement Jinja2 with no dry-test-bed at hand.

TASK DETAIL
https://phabricator.vyos.net/T2213

EMAIL PREFERENCES
https://phabricator.vyos.net/settings/panel/emailpreferences/

To: c-po, alainlamar
Cc: pasik, Active contributors, Maintainers, alainlamar, teadur,

jack9603301, hard, pa4ka, jestabro, Alfa80, dongjunbo, hexes

Uh, that's nice easter eggs folks :-) Thank you both for your valuable hints! They'll be very handy!

erkin set Issue type to Bug (incorrect behavior).Aug 30 2021, 7:43 AM
erkin removed a subscriber: Active contributors.