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:
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.
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:
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:
https://github.com/openwisp/openwrt-openwisp-monitoring/blob/8e49082ce7ded3f2ec7e10beedf8c6305f21239f/openwisp-monitoring/files/sbin/netjson-monitoring.lua#L85-L106
We should check whether the channel information is present (
iwinfo.channel
isnil
) and if it's not present we should not add thewireless
key to thenetjson_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 notnil
.We will need to add a test for this in
test_wifi.lua
.