|
|
Subscribe / Log in / New account

Haunted by ancient history

Haunted by ancient history

Posted Jan 8, 2015 18:54 UTC (Thu) by dlang (guest, #313)
In reply to: Haunted by ancient history by johill
Parent article: Haunted by ancient history

If iw can't do things that are possible with iwconfig, then it isn't a replcement, period, full stop.

Those things may not make sense to you in the way that you think everyone should do things, but you are not omniscient, so you don't know everyone's use case.

with your example, if people are successfully using iwconfig, it may not matter that the cook has to throw out a bunch of eggs, they aren't the cooks eggs, they are the sysadmin's eggs (in other words, it's the sysadmin's cpu cycles and power that's wasted). It's fine to write a blog post or explanation in a man page saying that this is an inefficient way to do things, and they should specify the entire order at once, but you shouldn't prevent the sysadmin from doing whatever they want.

There are very good reasons for not specifying a channel, and are probably very good reasons to not specify the BSSID as well.


to post comments

Haunted by ancient history

Posted Jan 8, 2015 20:02 UTC (Thu) by johill (subscriber, #25196) [Link] (16 responses)

Absolutely there are good reasons to never specify the channel or frequency - but these are things people can do (in a saner way) with the new tools as well.

Really my original thought was that nobody would even be using any of the command line tools (even the new one - iw!) to connect to a wireless network. Talking about use cases for this - I can't imagine why for example (apart from testing) you'd want your wireless connection to not be re-established when it drops for whatever reason (perhaps the AP being confused), this is really quite common.
I really did think that everybody would be using wpa_supplicant for connections these days since that gives you automatic reconnections, roaming, encryption, etc.

wpa_supplicant has for a long time supported and by default used nl80211, so if people had started using it as I expected then none of this mess would have happened.

Who knew though, apparently some people don't care about any of this. Clearly there are plenty of people who haven't moved to using wpa_supplicant and are - I find that hard to believe - happy with their system. Or maybe they aren't, but can't even be bothered to file bugs (not that I'd actually look at bugs filed with wext, apart from maybe telling them to move to wpa_supplicant.)

Anyway, the change has been reverted, and we'll simply keep the wireless extensions code indefinitely. I'm certainly not going to support it though.

Haunted by ancient history

Posted Jan 8, 2015 20:38 UTC (Thu) by dlang (guest, #313) [Link] (12 responses)

not all uses of wifi are clients connecting to wpa servers

I use the iw* commands quite a bit when I'm looking at what's around, doing a site survey to layout new APs, etc.

I haven't tried the iw command (I had never heard of it before this problem showed up)

If you can specify a wildcard for channel/frequency with iw, then you should be able to emulate the iwconfig commands that didn't specify them.

What else is possible with the iw* commands that isn't possible with iw?

Haunted by ancient history

Posted Jan 8, 2015 21:35 UTC (Thu) by johill (subscriber, #25196) [Link] (11 responses)

> If you can specify a wildcard for channel/frequency with iw, then you should be able to emulate the iwconfig commands that didn't specify them.

No, you didn't quite understand my cooking analogy I think. iwconfig requires that the kernel keep track of the previously configured settings, and allows you to modify them later. With nl80211, the kernel will forget everything it did when it disconnects.

Say you have a network on channel 11 (2462 MHz) called "my-network".

With iwconfig you can now say

iwconfig wlan0 essid "my-network"
(it connects to your network)
iwconfig wlan0 freq 2412
(it disconnects, and fails to reconnect since there's no network on channel 1)
iwconfig wlan0 freq 2462
(it connects again to the original network)

with iw/nl80211 you don't have this option.

You can say
iw wlan0 connect "my-network"
(and it will connect)

or
iw wlan0 connect "my-network" 2412
(and it will fail to connect)

or
iw wlan0 connect "my-network" 2462
(and it will connect again)

But the kernel will not remember [1], upon disconnection, that you had previously wanted some SSID. To emulate it completely, you'd thus have to store state somewhere (filesystem? shared memory? ...?) which gets complex really quickly.

This is really intentional though - having the kernel keep state means that the kernel needs to guess when it should start doing something. This is like my cooking analogy, there's no way for the kernel to know when it should start cooking. [2]

As far as site survey is concerned (iwlist scan) - there's another interesting quirk here: if you have too many APs in the environment, iwlist/wext will stop working and report only errors and no networks at all. This is an inherent design flaw that comes from having to fit the entire list of APs into a single buffer that's limited to 64KiB, and no way to fetch the list incrementally (like nl80211 which uses netlink dump functionality). People have run into this in big deployments (usually when there's also a lot of data in the beacons which eats up the buffer quickly.)

I don't believe that there's much that is possible with iwconfig/iwlist that you cannot do with iw at all, other than some esoteric settings like modifying sensitivity that no modern hardware supports anyway. I certainly haven't used iw* in many years.

[1] and that's really intentional, if the kernel were to remember some data you get into the strange situations where to switch from one network to the other the kernel might try to connect to the old network on the new channel, or the new network on the old channel, or similar. With open networks this really isn't a problem, but with encrypted or potentially rogue networks you really don't want to even attempt to connect to a new network with half of the old configuration. Forcing userspace to commit the entire needed configuration at once easily side-steps that issue and made the whole mechanism far easier to extend to new spec updates as well.

[2] Jean actually invented SIOCSIWCOMMIT for this purpose, which in theory would have allowed you to set all the parameters and then commit them all together. However, that came too late - since it wasn't designed into the API from the beginning there was no way for the kernel to require it since that would also have broken older userspace.

Haunted by ancient history

Posted Jan 8, 2015 22:17 UTC (Thu) by cesarb (subscriber, #6266) [Link] (1 responses)

> I don't believe that there's much that is possible with iwconfig/iwlist that you cannot do with iw at all, other than some esoteric settings like modifying sensitivity that no modern hardware supports anyway. I certainly haven't used iw* in many years.

I recently found something that you cannot do with iw at all. I was curious to know the transmission power of my network card.

$ iwlist wlp3s0 txpower
wlp3s0 unknown transmit-power information.

Current Tx-Power=15 dBm (31 mW)

I couldn't find a way to do that with iw. This is most annoying in the openwrt router I have, since it doesn't have iwlist installed by default (and it makes no sense to install it for just this single use); I have to use the web interface (which does show the current txpower).

This is made more annoying by the fact that iw *does* know how to set the txpower; why doesn't it have a way to get it?

dev <devname> set txpower <auto|fixed|limit> [<tx power in mBm>]
Specify transmit power level and setting type.

Haunted by ancient history

Posted Jan 8, 2015 22:46 UTC (Thu) by johill (subscriber, #25196) [Link]

Not sure - from a brief look the API doesn't seem to have this, for whatever reason. Certainly not intentional.

Haunted by ancient history

Posted Jan 8, 2015 22:32 UTC (Thu) by dlang (guest, #313) [Link] (6 responses)

well, if the kernel keeps track of the data for iwconfig, you should be able to use that same mechanism to allow iw to work.

Yes, it's a permanent wart, but if it lets you get rid of the rest of the support in a decade or so (after the new version of iw gets out to all the distros, it's better than keeping everything around.

And just declaring that you aren't going to support the old version isn't really a solution, if tools are depending on it, any change that is made that accidentally breaks the old version is going to require that that change get reverted (or the old code modified to work with the new change)

changing topics, is there a way to configure an interface not to use slow speeds? I'd like to configure some equipment so that if the only way it can talk to another device is at speeds <11Mb, refuse to connect to it, but I haven't been able to find a way to do this on my WNDR3800 router.

Haunted by ancient history

Posted Jan 8, 2015 22:51 UTC (Thu) by johill (subscriber, #25196) [Link] (5 responses)

Well, no, it only keeps track of the data for wext. There's currently not even a way in the API of nl80211 to transport just such single values.

I don't believe that it's better to mess up the nl80211 APIs with such stateful problems than keeping the old wext support around - at least the latter can easily be disabled and if it is people can determine relatively quickly why things broke (we never ship wext to our customers, for example, and will not support it).

If we added stateful problematic API to nl80211 we'd have the worst of both worlds, because we'd have to support the mess with all the unclear semantics of when to start connecting in the new API. That's really not worth it at all, even if it would allow us to get rid of all the other ugly wext code (and believe me - there's a lot, down to 32/64 userspace compat code that always builds two messages for the same thing because they differ etc.)

Regarding your other question, it is possible for the AP to require that the client be capable of certain bitrates - they're called "basic rates", you might have such a configuration. It's also possible to require HT or even VHT to be supported. I have no idea if typical APs have configuration options in their limited web UI for that though - if you were to run hostapd (say on OpenWRT) it'd be simple to set this in the configuration file.

Haunted by ancient history

Posted Jan 8, 2015 23:04 UTC (Thu) by dlang (guest, #313) [Link] (2 responses)

> Regarding your other question, it is possible for the AP to require that the client be capable of certain bitrates - they're called "basic rates", you might have such a configuration. It's also possible to require HT or even VHT to be supported. I have no idea if typical APs have configuration options in their limited web UI for that though - if you were to run hostapd (say on OpenWRT) it'd be simple to set this in the configuration file.

how would I set this with command line tools? (once I know that, I can go figure out how to set this in the distro config). I am using OpenWRT on these routers.

Haunted by ancient history

Posted Jan 9, 2015 13:36 UTC (Fri) by johill (subscriber, #25196) [Link] (1 responses)

You can't set it using command line tools - this is only advertised and enforced by hostapd. You have to set it in the hostapd configuration file (basic_rates= option). To require HT (11n), set require_ht=1, to require VHT (11ac) set require_vht=1.

One OpenWRT, you might be able to inject options, not sure off the top of my head.

Haunted by ancient history

Posted Jan 9, 2015 14:19 UTC (Fri) by cesarb (subscriber, #6266) [Link]

Take a look at http://wiki.openwrt.org/doc/uci/wireless. I'd guess it's the basic_rate and require_mode options.

Haunted by ancient history

Posted Jan 9, 2015 5:40 UTC (Fri) by alankila (guest, #47141) [Link] (1 responses)

One of the issues here is that *someone* has to remember the values set. It's either in user space of kernel space. If the kernel remembers it, then anyone can query the kernel APIs to figure out what the current wireless settings that have been told to hardware are. If it's in user space, I can imagine someone writing another dbus API for wireless connections, and adding a permanent daemon to keep track of the info.

Historical unix style favors the former, so the kernel services user processes by keeping track of important state for them, because the processes themselves are short-lived and can't do it. Modern unix style is about running everything imaginable in separate daemons. Anyway, someone can just go ahead and define the dbus API for wpa_supplicant or something, and then tell everyone to implement that.

Haunted by ancient history

Posted Jan 9, 2015 13:38 UTC (Fri) by johill (subscriber, #25196) [Link]

All of that already exists. If you're running wpa_supplicant, you can never have any of these problems [even with wext, since wpa_supplicant is smarter than the average user]

However, if you're not running wpa_supplicant, then it really only leaves the kernel to remember it, or the user to re-enter it every time. iwconfig/wext went with the former (and in turn got all the associated problems), iw/nl80211 went with the latter to avoid those problems.

Haunted by ancient history

Posted Jan 10, 2015 9:41 UTC (Sat) by riking (guest, #95706) [Link] (1 responses)

> As far as site survey is concerned (iwlist scan) - there's another interesting quirk here: if you have too many APs in the environment, iwlist/wext will stop working and report only errors and no networks at all. This is an inherent design flaw that comes from having to fit the entire list of APs into a single buffer that's limited to 64KiB, and no way to fetch the list incrementally (like nl80211 which uses netlink dump functionality). People have run into this in big deployments (usually when there's also a lot of data in the beacons which eats up the buffer quickly.)

Just wondering here - have you considered turning iw into a argv[0]-switching binary, which calls the old APIs when it *absolutely needs to* (the separate SSID and frequency setting...) but otherwise uses the new APIs when it results in the same or a consistent output?
(consistent: displaying all the huge number of networks instead of crashing. $5 says nobody depends on iwlist crashing with too many networks.)

I routinely use plain 'iwconfig' and 'ipconfig' as debugging tools - "what's my network?". It seems like the diagnostics should be possible with just the new APIs.

Haunted by ancient history

Posted Jan 10, 2015 21:24 UTC (Sat) by johill (subscriber, #25196) [Link]

I have - but the cost is too high. There's very little cost in keeping this code indefinitely - it won't get any better and new drivers might not work properly with it, but it certainly won't get any worse.

Using the old API in the new tools is just going to get it wrong anyway - there are 20 or so API versions of wext after all that all need to be treated slightly differently (they didn't care all that much for backward compatibility when those were designed ....)

So no, this isn't going to happen.

You should probably just use "iw wlan0 scan" and "iw wlan0 link" instead. Doing anything beyond those two commands with the command line is mostly not going to do what you want it to anyway.

Haunted by ancient history

Posted Jan 15, 2015 9:45 UTC (Thu) by Wol (subscriber, #4433) [Link] (2 responses)

> not be re-established when it drops for whatever reason

You mean, like, when the user deliberately kills it???

Okay, this is my windows laptop, but I routinely kill the wifi when I plug my laptop into a network cable, it increases my bandwidth by about three orders of magnitude!

Cheers,
Wol

Haunted by ancient history

Posted Jan 15, 2015 16:31 UTC (Thu) by tialaramex (subscriber, #21167) [Link] (1 responses)

But the right way to do that is to switch off your WiFi. On my laptops I usually do this by moving the physical switch provided for this purpose. On other devices (which lack a switch) you can tell software "I don't want WiFi any more" independently of the wireless code trying to connect to a specific AP.

Also, the Right Thing™ (and I'm a little surprised the Windows laptop doesn't do this of its own accord unless you've missed part of the story) is that you'd leave the WiFi up in your scenario, and the IP stack will choose the Cat5 (or whatever) for all new connections while continuing to handle old connections seamlessly on the WiFi.

Almost twenty years ago we demonstrated running VoIP through this scenario (moving from a wireless to a wired network) with Mobile IPv6. That has yet to become a commonplace application, but it was taken as read that if you began a _new_ call it would move to the better connection with no additional technology, our work was on handling an _in progress_ call correctly.

Haunted by ancient history

Posted Jan 20, 2015 13:09 UTC (Tue) by nye (subscriber, #51576) [Link]

>Also, the Right Thing™ (and I'm a little surprised the Windows laptop doesn't do this of its own accord unless you've missed part of the story) is that you'd leave the WiFi up in your scenario, and the IP stack will choose the Cat5 (or whatever) for all new connections while continuing to handle old connections seamlessly on the WiFi

Modern versions of Windows definitely do this; I'm not sure whether older versions do, but I'd expect so since this is a simple case of setting the metric to prefer wired over wireless connections, which I find it hard to believe has ever not been the default.

There are probably other factors at work here.


Copyright © 2025, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds