Obtaining access point connectivity information at application level

Dan Williams dcbw at redhat.com
Wed Jun 14 17:17:18 EDT 2006


On Wed, 2006-06-14 at 15:00 -0500, Sriram Chadalavada wrote:
> Hi everyone,
>       We are trying to create a GUI application that reports status of
> a prism wireless card (station/client/managed mode)  on our embedded
> device that runs 2.4.26 kernel and hostap V2.6. We are using the older
> versions due to legacy issues. 
> 
> How can we obtain the following information from the hostap driver
> (ioctl calls??) :-
> 1. If the card has been taken out of range of an access point i.e.
> current linkstatus.

Use the wireless extensions SIOCGIWAP call, and check for a valid BSSID
address using standard ethernet address validation functions.  i.e., if
the BSSID returned there is not all 4s, all 1s, or all 0s, then you are
associated and connected to the AP.

> 2. If the card can 'see' an access point but cannot connect to it (due
> to authentication mismatch or wrong WEP key, for example) 

You can't do this.  You can tell whether or not the AP requires
encryption, and you can tell whether it's WPA or WEP, but you _cannot_
tell without trying to connect, whether your key is correct.  That's
just the way wireless is, that's the same on Linux, Windows, and Mac OS
X.

You also cannot ever tell if your WEP key is wrong unless the card fails
to complete association with the AP.  If you enable Shared Key mode on
the AP, you can't authenticate unless your WEP key is correct.  But
Shared Key mode is quite an insecure joke and should never be used.
With the alternative, Open System authentication, you never know whether
your WEP key is wrong, period.  So you're out of luck here.

With WPA, it's a lot easier, but you still have to start authentication
to figure out if the key is wrong of course.  The driver should notify
your application by sending a wireless rtnetlink event of SIOGSIWAP.  If
the BSSID passed in that message is valid, association has completed
successfully.  If the BSSID passed is invalid, association has failed
for some reason, or the connection to the access point has been lost.

> I understand that linkstatus information is communicated by the card
> firmware as an Unsolicited MAC Mgmt frame. So, the driver itself is
> aware when the card goes out of range. My question is how can I obtain
> this information at the application level? The 'status' field in
> the /proc/net/wireless file does not seem to indicate this
> information. 

Use wireless extensions instead.  Search for 'wireless-tools'.

Dan





More information about the HostAP mailing list