[PATCH] driver_wext.c: Make sure that interface is UP

Dan Williams dcbw
Thu Dec 10 10:03:22 PST 2009

On Thu, 2009-12-10 at 10:47 +0200, Mike van Niekerk wrote:
> The person that submitted this patch is my hero. I've been battling
> with Android to get reconnections working but it will fail after
> associating. This is the reason - Android's WiFi manager will ifdown
> the interface after disconnection. I could not find the error and even
> bugged the manufacturer for a defective wext driver.

That seems wrong for the android wifi manager...  at least it doesn't
match expected behavior Linux driver/supplicant interaction on Linux.
When the driver is down, the supplicant cannot expect anything of the
card, because the driver may put the card into low power mode or
anything else.  Scanning cannot be assumed to be available when the
interface is down for example, and in many cases the supplicant will
need to scan before even trying to associate.

Also, if the wifi manager is setting the device down, then it seems
appropriate that the wifi manager should also set the device back to up
when it wants the supplicant to connect again.  Keeping the operation
and it's reverse at the same layer makes the system more understandable,
less "magic", and more maintainable in the long run.  Stuff hacks into
wpa_supplicant for every odd behavior of every wifi manager isn't.


> Thanks a million. Seriously, you are awesome!
> On Tue, Dec 8, 2009 at 3:34 PM, Jouni Malinen <j at w1.fi> wrote:
>         On Mon, Dec 07, 2009 at 02:25:15PM -0800, Dmitry Shmidt wrote:
>         > You are right in general. But there are several scenarios
>         where it is
>         > just easier to control interface
>         > from the wpa_supplicant driver layer itself.
>         > For example, you've associated, connected and got IP by dhcp
>         client.
>         > You were disassociated, lost connection and network manager
>         turned off
>         > interface to prevent trying to access it.
>         > Then you are trying to reassociate and key exchange will
>         fail.
>         If a network manager turned off the interface, why would it
>         not turn it
>         on when the connection is supposed to be used? I would assume
>         there was
>         a reason for setting the interface down in this case and it
>         does not
>         sound like a good idea for wpa_supplicant to just turn it back
>         on.
>         > My point is that relying on network manager to keep
>         interface in
>         > proper state may cause wpa_supplicant to
>         > fail to complete association.
>         I would be fine with making wpa_supplicant not try to
>         associate if the
>         interface is set down while wpa_supplicant is running (and
>         then
>         re-enable wpa_supplicant when the interface is set up again).
>         --
>         Jouni Malinen                                            PGP
>         id EFC895FA
>         _______________________________________________
>         HostAP mailing list
>         HostAP at lists.shmoo.com
>         http://lists.shmoo.com/mailman/listinfo/hostap
> _______________________________________________
> HostAP mailing list
> HostAP at lists.shmoo.com
> http://lists.shmoo.com/mailman/listinfo/hostap

More information about the Hostap mailing list