[bug/change] Do not add wireless interface information if channel is not available
nemesifier opened this issue · 0 comments
This is an issue I have been observing for a few months.
If a device has some misconfigured wifi interfaces or radios, even though the WiFI interface is not completely brought up and hence not working, the system will report its presence with some important information like channel omitted, eg:
wlan1 ESSID: unknown
Access Point: 46:D1:FA:D2:29:7C
Mode: Client Channel: unknown (unknown)
Center Channel 1: unknown 2: unknown
Tx-Power: 20 dBm Link Quality: unknown/70
Signal: unknown Noise: -92 dBm
Bit Rate: unknown
Encryption: unknown
Type: nl80211 HW Mode(s): 802.11nacax
Hardware: 14C3:7915 14C3:7915 [MediaTek MT7915E]
TX power offset: none
Frequency offset: none
Supports VAPs: yes PHY name: phy1
The result is a JSON payload which will be rejected by OpenWISP Monitoring.
For this reason, I think we should change this block of code as follows:
We should check whether the channel information is present (iwinfo.channel
is nil
) and if it's not present we should not add the wireless
key to the netjson_interface
dictionary (lua table) nor look for wifi clients.
I think the whole block shown above could be moved to a separate utility function which is called only after we check that iwinfo.channel
is not nil
.
We will need to add a test for this in test_wifi.lua
.