It's also not as if this kind of problem is unique to Linux or NetworkManager, I experience very similar behavior on my MacOSX laptop when resuming from suspend, so this is a common problem with wireless. The stated solution probably won't speed up connection when changing location but keeping the same SSID as you will likely be connecting to a different AP on a different channel and it'll have to scan anyway.
Posted Mar 7, 2013 20:39 UTC (Thu) by johill (subscriber, #25196)
[Link]
Well, yes. Although you could scan the channels in the right order, i.e. the ones that you'd expect the same network (SSID) on first. Say your corporate installation -- it's probably only going to use a handful of channels (1,6,11,36,149 or so), so if you know from "experience" that (almost) all of the APs for the network are there, you can scan those first.
But ultimately you're right, in the general case you have to scan all channels and that simply takes a while. It shouldn't be more than a few seconds since you're not connected; here it takes ~3.5 seconds to scan all the channels my card supports, but I know that it can be (much) slower depending on the device.
flicker-free suspend/resume on Intel
Posted Mar 7, 2013 23:25 UTC (Thu) by dlang (✭ supporter ✭, #313)
[Link]
well, you should first check the channel you were last using, and then do the normal scan you would do if someone just gave the SSID and told you to connect to it.
flicker-free suspend/resume on Intel
Posted Mar 8, 2013 0:10 UTC (Fri) by johill (subscriber, #25196)
[Link]
Yeah, that's what I suggested first (and indeed Dan has now opened a bug for to implement it in NM), however it is possible to break it down further like I was trying to describe later:
1) scan the last channel
2) scan the known channels for the last SSID
3) scan all (remaining) channels
The intermediate step only makes sense if those known channels are a relatively small subset of all channels, but with typical installations they will be. In fact, for many networks like your home network 1) and 2) will be exactly the same because you only have a single AP, but for typical enterprise networks 2) will still be better than 3).
flicker-free suspend/resume on Intel
Posted Mar 8, 2013 0:56 UTC (Fri) by mgedmin (subscriber, #34497)
[Link]
Somewhat tangentially there's a very interesting article about DHCP tricks that MacOS X does to reconnect faster.
I'd love to see Network Manager pick up something from that.
Instead, currently when I suspend a laptop via ssh -t foo sudo pm-suspend, I get to enjoy a lapsed DHCP lease on resume, for a few hours. According to strace that's because dhcpd expiration timer (i.e. select() with a timeout) simply stops while the laptop is suspended. Connection still works, but the wifi router doesn't resolve the laptop's hostname until dhcpd finally wakes up.
flicker-free suspend/resume on Intel
Posted Mar 8, 2013 9:07 UTC (Fri) by johill (subscriber, #25196)
[Link]
This would be easier in connman as it has DHCP built into it rather than calling out to dhclient (running as a daemon)
flicker-free suspend/resume on Intel
Posted Mar 8, 2013 15:35 UTC (Fri) by njwhite (subscriber, #51848)
[Link]
Ah, I've run into this with wpa_supplicant on Debian. Have you found a solution to it? Is there a straightforward way to get dhclient to wake up when the computer resumes?
flicker-free suspend/resume on Intel
Posted Mar 14, 2013 0:46 UTC (Thu) by kevinm (guest, #69913)
[Link]
If CLOCK_MONOTONIC in Linux actually worked according to POSIX spec, then a timer based on this clock could be used to fix this problem.
(POSIX says that CLOCK_MONOTONIC measures time elapsed since "an unspecified point in the past", and further "This point does not change after system start-up time.". On Linux however, CLOCK_MONOTONIC stops while the system is suspended, which is clearly nonconforming).