libremesh / lime-packages

LibreMesh packages configuring OpenWrt for wireless mesh networking
https://libremesh.org/
GNU Affero General Public License v3.0
277 stars 96 forks source link

The detection of 5ghz radio is failing in the Mesh Potato #218

Closed nicopace closed 6 years ago

nicopace commented 7 years ago

snippet from https://github.com/libremesh/lime-packages/blob/develop/packages/lime-system/files/usr/lib/lua/lime/wireless.lua#L34 :

function wireless.is5Ghz(radio)
    local uci = libuci:cursor()
    local hwmode = uci:get("wireless", radio, "hwmode") or "11ng"
    if hwmode:find("a") then
        return true
    end
    return false
end
root@LiMe-166183:~# uci show wireless.radio1.hwmode
wireless.radio1.hwmode='11g'
root@LiMe-166183:~# uci show wireless.radio0.hwmode
uci: Entry not found
root@LiMe-166183:~# iw list
Wiphy phy1
    max # scan SSIDs: 4
    max scan IEs length: 2257 bytes
    max # sched scan SSIDs: 0
    max # match sets: 0
    max # scan plans: 1
    max scan plan interval: -1
    max scan plan iterations: 0
    Retry short limit: 7
    Retry long limit: 4
    Coverage class: 23 (up to 10350m)
    Device supports AP-side u-APSD.
    Device supports T-DLS.
    Available Antennas: TX 0x1 RX 0x1
    Configured Antennas: TX 0x1 RX 0x1
    Supported interface modes:
         * IBSS
         * managed
         * AP
         * AP/VLAN
         * monitor
         * mesh point
         * P2P-client
         * P2P-GO
         * outside context of a BSS
    Band 1:
        Capabilities: 0x116e
            HT20/HT40
            SM Power Save disabled
            RX HT20 SGI
            RX HT40 SGI
            RX STBC 1-stream
            Max AMSDU length: 3839 bytes
            DSSS/CCK HT40
        Maximum RX AMPDU length 65535 bytes (exponent: 0x003)
        Minimum RX AMPDU time spacing: 8 usec (0x06)
        HT TX/RX MCS rate indexes supported: 0-7
        Frequencies:
            * 2412 MHz [1] (18.0 dBm)
            * 2417 MHz [2] (18.0 dBm)
            * 2422 MHz [3] (18.0 dBm)
            * 2427 MHz [4] (18.0 dBm)
            * 2432 MHz [5] (18.0 dBm)
            * 2437 MHz [6] (18.0 dBm)
            * 2442 MHz [7] (18.0 dBm)
            * 2447 MHz [8] (18.0 dBm)
            * 2452 MHz [9] (18.0 dBm)
            * 2457 MHz [10] (18.0 dBm)
            * 2462 MHz [11] (18.0 dBm)
            * 2467 MHz [12] (disabled)
            * 2472 MHz [13] (disabled)
            * 2484 MHz [14] (disabled)
    valid interface combinations:
         * #{ managed } <= 2048, #{ AP, mesh point } <= 8, #{ P2P-client, P2P-GO } <= 1, #{ IBSS } <= 1,
           total <= 2048, #channels <= 1, STA/AP BI must match, radar detect widths: { 20 MHz (no HT), 20 MHz, 40 MHz }

    HT Capability overrides:
         * MCS: ff ff ff ff ff ff ff ff ff ff
         * maximum A-MSDU length
         * supported channel width
         * short GI for 40 MHz
         * max A-MPDU length exponent
         * min MPDU start spacing
Wiphy phy0
    max # scan SSIDs: 4
    max scan IEs length: 2257 bytes
    max # sched scan SSIDs: 0
    max # match sets: 0
    max # scan plans: 1
    max scan plan interval: -1
    max scan plan iterations: 0
    Retry short long limit: 2
    Coverage class: 0 (up to 0m)
    Available Antennas: TX 0 RX 0
    Supported interface modes:
         * IBSS
         * managed
         * AP
         * AP/VLAN
         * monitor
         * mesh point
    Band 1:
        Capabilities: 0x2fe
            HT20/HT40
            SM Power Save disabled
            RX Greenfield
            RX HT20 SGI
            RX HT40 SGI
            TX STBC
            RX STBC 2-streams
            Max AMSDU length: 3839 bytes
            No DSSS/CCK HT40
        Maximum RX AMPDU length 65535 bytes (exponent: 0x003)
        Minimum RX AMPDU time spacing: 2 usec (0x04)
        HT TX/RX MCS rate indexes supported: 0-15, 32
        Frequencies:
            * 2412 MHz [1] (30.0 dBm)
            * 2417 MHz [2] (30.0 dBm)
            * 2422 MHz [3] (30.0 dBm)
            * 2427 MHz [4] (30.0 dBm)
            * 2432 MHz [5] (30.0 dBm)
            * 2437 MHz [6] (30.0 dBm)
            * 2442 MHz [7] (30.0 dBm)
            * 2447 MHz [8] (30.0 dBm)
            * 2452 MHz [9] (30.0 dBm)
            * 2457 MHz [10] (30.0 dBm)
            * 2462 MHz [11] (30.0 dBm)
            * 2467 MHz [12] (disabled)
            * 2472 MHz [13] (disabled)
            * 2484 MHz [14] (disabled)
    Band 2:
        Capabilities: 0x2fe
            HT20/HT40
            SM Power Save disabled
            RX Greenfield
            RX HT20 SGI
            RX HT40 SGI
            TX STBC
            RX STBC 2-streams
            Max AMSDU length: 3839 bytes
            No DSSS/CCK HT40
        Maximum RX AMPDU length 65535 bytes (exponent: 0x003)
        Minimum RX AMPDU time spacing: 2 usec (0x04)
        HT TX/RX MCS rate indexes supported: 0-15, 32
        Frequencies:
            * 5180 MHz [36] (23.0 dBm)
            * 5190 MHz [38] (23.0 dBm)
            * 5200 MHz [40] (23.0 dBm)
            * 5210 MHz [42] (23.0 dBm)
            * 5220 MHz [44] (23.0 dBm)
            * 5230 MHz [46] (23.0 dBm)
            * 5240 MHz [48] (23.0 dBm)
            * 5250 MHz [50] (disabled)
            * 5260 MHz [52] (23.0 dBm) (radar detection)
            * 5270 MHz [54] (23.0 dBm) (radar detection)
            * 5280 MHz [56] (23.0 dBm) (radar detection)
            * 5290 MHz [58] (23.0 dBm) (radar detection)
            * 5300 MHz [60] (23.0 dBm) (radar detection)
            * 5310 MHz [62] (23.0 dBm) (radar detection)
            * 5320 MHz [64] (23.0 dBm) (radar detection)
            * 5500 MHz [100] (23.0 dBm) (radar detection)
            * 5510 MHz [102] (23.0 dBm) (radar detection)
            * 5520 MHz [104] (23.0 dBm) (radar detection)
            * 5530 MHz [106] (23.0 dBm) (radar detection)
            * 5540 MHz [108] (23.0 dBm) (radar detection)
            * 5550 MHz [110] (23.0 dBm) (radar detection)
            * 5560 MHz [112] (23.0 dBm) (radar detection)
            * 5570 MHz [114] (23.0 dBm) (radar detection)
            * 5580 MHz [116] (23.0 dBm) (radar detection)
            * 5590 MHz [118] (23.0 dBm) (radar detection)
            * 5600 MHz [120] (23.0 dBm) (radar detection)
            * 5610 MHz [122] (23.0 dBm) (radar detection)
            * 5620 MHz [124] (23.0 dBm) (radar detection)
            * 5630 MHz [126] (23.0 dBm) (radar detection)
            * 5640 MHz [128] (23.0 dBm) (radar detection)
            * 5650 MHz [130] (23.0 dBm) (radar detection)
            * 5660 MHz [132] (23.0 dBm) (radar detection)
            * 5670 MHz [134] (23.0 dBm) (radar detection)
            * 5680 MHz [136] (23.0 dBm) (radar detection)
            * 5690 MHz [138] (23.0 dBm) (radar detection)
            * 5700 MHz [140] (23.0 dBm) (radar detection)
            * 5745 MHz [149] (30.0 dBm)
            * 5755 MHz [151] (30.0 dBm)
            * 5765 MHz [153] (30.0 dBm)
            * 5775 MHz [155] (30.0 dBm)
            * 5785 MHz [157] (30.0 dBm)
            * 5795 MHz [159] (30.0 dBm)
            * 5805 MHz [161] (30.0 dBm)
            * 5825 MHz [165] (30.0 dBm)
            * 4920 MHz [184] (disabled)
            * 4940 MHz [188] (disabled)
            * 4960 MHz [192] (disabled)
            * 4980 MHz [196] (disabled)
    valid interface combinations:
         * #{ managed, AP, mesh point } <= 8,
           total <= 8, #channels <= 1
    HT Capability overrides:
         * MCS: ff ff ff ff ff ff ff ff ff ff
         * maximum A-MSDU length
         * supported channel width
         * short GI for 40 MHz
         * max A-MPDU length exponent
         * min MPDU start spacing
p4u commented 7 years ago

I think this is because this code is not aware that a single radio can be dual band. LEDE configures it by default at 2.4GHz, but 5GHz are also possible and libremesh is not aware of that.

Instead of using /etc/config/wireless, it would be better to use the lua module "iwinfo" which gives all information related to radios.

Also, we should agree on some heuristics. A proposal:

  1. if single band, no discussion... but if dual band:
  2. if only 1 radio, set it to 2.4Ghz
  3. if more than 1 radio 2.1 if it is the only 2.4 radio, set it to 2.4Ghz 2.2 if it is the only 5GHz radio, set it to 5GHz 2.3 if not previous radios set to 2.4GHz, set it to 2.4GHz else 5GHz