Turning the wifi off through the Menu Bar is equivalent to:
networksetup -setairportpower en0 off
... and so, the same as turning it off in network settings.
I cannot speak to the low levels, but networksetup
is an Apple addition, whereas ifconfig
is standard not just for BSD, but for Linux as well. (Though the two utilties are ultimately distinct, not just in their implementation but API)
If I had to guess, and I will guess since Apple's internals aren't exactly transparent (please, someone correct me if you're able), networksetup
is meant to control the actual hardware, the Wi-Fi device, whereas ifconfig
is a purely OS-level utility. Much like you can quit your video-chat app, vs put a piece of tape over the camera.
A few things I can verify:
- To function, both the interface, say,
en0
, must be UP (so, ifconfig en0 up
), as well as airportpower
being ON (so, networksetup -setairportpower en0 on
).
- Both
down
ing an iface
, and turning airportpower off
, will render the Menu Bar symbol as a hollow outline.
- BUT, if both DOWN/off, if you bring airportpower
on
, if ifconfig ... up
has not been run after running ifconfig ... down
, then the symbol will not be hollow, and macOS will scan frantically for networks, but be unable to: (1) connect to a network (2) bring UP the iface0
(3) change the routing table
So, that wifi symbol seems to be the result of a state-change, not actual state. In that, the actual state of whether or not Wi-Fi is being shown as able to connect isn't connected to the visual indicator. But the interface, even when DOWN, does seem to somehow scan in a way, in that if you turn back on
the airportpower
, the "status:" given by ifconfig
will swap rapidly back & forth between active
and inactive
, even if the actual interface is not UP.
So, there is inconsistency. But it's that way because there would be no reason to turn the second one off after doing so the first. And because Apple's desires & ideal API differ from those of BSD.