Wifi config from CLI; what is the difference between 'Wireless is disabled' and 'Wireless is not associated'?

Hi, I would like to understand how to control wifi interfaces using the command line. From the docs and scripts, it seemed that using wifi up or wifi down would be the correct command, but these don't seem to take effect if the wireless interface is disabled. After enabling the wifi interface with:
uci set wireless.radio0.disabled=0
uci commit
the interface appears to now be in a state where it can be set up with wifi up.
When the interface is disabled, it is listed among the interfaces in the output from the ip a command with a DOWN state:
wlan0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN qlen 1000
whereas when the interface is set down with wifi down, it is not listed at all. In Luci, the disabled interface is listed with 'Wireless is disabled', and the enabled but down interface with 'Wireless is not associated'.

What do these states mean with respect to the interface's activity: is it correct that when disabled, an interface does not receive power and is completely off, while when 'not associated' it is is broadcasting beacons or similar but not accepting connections? How does the user go about setting the interface so that it is disabled completely at boot and when not in use, but can be set up via the CLI as needed? The Luci interface seems quite intuitive, but the CLI commands not so much.

To rephrase that:

What is the difference between 'Wireless is disabled' and 'Wireless is not associated' in LuCI?

Thanks for any help.

Not associated means the radio should be up and ready for connections but there are no connected stations.

iw dev will show if an AP has been created and put on the air. If there is an entry for SSID it should be fully running. If channel and / or SSID are not shown there is a problem though it could just be waiting out the DFS radar signal check.

Now I'm really confused: after running wifi down, the enabled radio shows 'Wireless is not associated'. I would have thought that the radio cannot be connected to, but you say that 'Wireless is not associated' means that it can be connected to. After running wifi down, the iw dev commands does not show any interface for that radio either. So doesn't wifi down mean that the interface is not transmitting?
When the radio is up but there are no clients connected, it shows:
BSSID: aa:aa:aa:aa:aa | Encryption: WPA2 PSK (CCMP). Is it possible that the LuCI message 'Wireless is not associated' should actually read something like 'Interface down' or similar?

LuCI will display Wireless is disabled if option disabled 1 is set in the wireless configuration, Wireless is not associated in all other cases.

Since multiple wireless networks might share the same radio, it is better to check the state of the phy to see whether the wifi radio is powered down or not.

LuCI in master/19.07 displays this in the overview as shown below:

After wifi up the state will transition to that:

So you can read "Wireless is not associated" as "wireless is enabled in configuration but inactive or wireless is configured in client mode and unable to connect to the master network"

1 Like