Commit graph

69 commits

Author SHA1 Message Date
Jouni Malinen
4848a38d85 Get rid of duplicated cipher suite and AKM definitions
WPA_CIPHER_* and CIPHER_* are used for the exact same set of cipher
suites with the main difference being that the WPA_CIPHER_* version is
suitable to be used as a bitfield. Similarly, WPA_KEY_MGMT_* and
KEY_MGMT_* have similar design for AKMs. There is no need to maintain
two separate copies of the definitions since the bitfield compatible
version can be used for both needs. Get rid of the CIPHER_* and
KEY_MGMT_* versions to clean up the implementation by getting rid of
unnecessary mapping functions.

Signed-hostap: Jouni Malinen <j@w1.fi>
2013-12-31 09:16:27 +02:00
Jouni Malinen
bd1e328047 Android: Remove old WEXT extensions
Android has moved to nl80211, so no need to maintain these old WEXT
extensions in wpa_supplicant.

Signed-hostap: Jouni Malinen <j@w1.fi>
2013-12-24 22:52:18 +02:00
Jouni Malinen
24f051eb14 Replace remainining strncpy() uses with strlcpy()
Signed-hostap: Jouni Malinen <j@w1.fi>
2013-10-26 15:54:47 +03:00
Jouni Malinen
5e24dc8a4b Add dup_binstr() to help common binary string tasks
There are quite a few places in the current implementation where a nul
terminated string is generated from binary data. Add a helper function
to simplify the code a bit.

Signed-hostap: Jouni Malinen <j@w1.fi>
2013-04-27 23:44:59 +03:00
Jouni Malinen
1ce0aa044c Remove unused disassociate() driver_ops
Commits 07783eaaa0 and
3da372fae8 removed the only users of the
disassociate() driver operation, so these driver wrapper functions can
also be removed now.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2012-11-15 00:06:12 +02:00
Jouni Malinen
067ffa2696 Convert os_realloc() for an array to use os_realloc_array()
Signed-hostap: Jouni Malinen <j@w1.fi>
2012-08-13 21:21:23 +03:00
Jouni Malinen
349493bd0c Validate WEP key lengths based on driver capabilities
The nl80211 driver interface does not allow 128-bit WEP to be used
without a vendor specific cipher suite and no such suite is defined for
this purpose. Do not accept WEP key length 16 for nl80211 driver
interface forn ow. wext-interface can still try to use these for
backwards compatibility.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2012-05-10 14:34:46 +03:00
Jouni Malinen
6d441b0da2 wext: Filter unexpected interface added/up events
It looks like a RTM_NEWLINK event claiming the interface to be UP is
delivered just before removing an interface after having first indicated
that the interface was going down/removed. Ignore this event if the
interface is not present anymore at the moment the event is processed.
This fixes issues where an interface that was re-added after being
removed did not get reconfigured properly.

Signed-hostap: Jouni Malinen <j@w1.fi>
intended-for: hostap-1
2012-02-18 13:28:21 +02:00
Jouni Malinen
0f3d578efc Remove the GPL notification from files contributed by Jouni Malinen
Remove the GPL notification text from the files that were
initially contributed by myself.

Signed-hostap: Jouni Malinen <j@w1.fi>
2012-02-11 19:39:36 +02:00
Dmitry Shmidt
5eb429101a Android: wext: Add sched_scan functions for PNO
(jm: This is based on the Android change that used driver_cmd. The same
implementation is used for the actual driver interface, but the commands
are now accessed through sched_scan/stop_sched_scan driver_ops instead
of driver_cmd)
2011-11-29 15:18:45 +02:00
Dmitry Shmidt
06e356fe14 Android: wext: Add driver state events 2011-11-29 15:18:21 +02:00
Jouni Malinen
545cfc4bf3 WEXT: Use linux/wireless.h instead of wireless_copy.h
WEXT is not really changing anymore and more or less all Linux
distros come with linux/wireless.h that is recent enough to
allow the driver wrappers to be build.

Signed-hostap: Jouni Malinen <j@w1.fi>
2011-11-15 20:03:00 +02:00
Dmitry Shmidt
bd43938102 wext: Do not set SSID on disconnect on Android
Some drivers seem to try to associate using the random SSID, so
do not use this hack on Android.
2011-10-21 19:11:07 +03:00
Jouni Malinen
724950836f wext: Clean up the disconnect BSSID/SSID clearing 2011-10-21 19:09:25 +03:00
Jouni Malinen
bdc4c18e0a wext: Remove trailing whitespace 2011-10-21 18:58:01 +03:00
Jouni Malinen
180cdf45a4 wext: Increase scan timeout from 5 to 10 seconds
Some dualband cards can use more than five seconds to run through
a full scan, so increase the timeout to avoid hitting the missing
scan completed event workaround.
2011-10-18 23:04:36 +03:00
Pavel Roskin
a776b19cda wext: Remove write-only variable ap_num
Signed-off-by: Pavel Roskin <proski@gnu.org>
2011-09-22 00:41:17 +03:00
Jouni Malinen
0382097ef3 Use set_key addr to distinguish default and multicast keys
Previously, both NULL and ff:ff:ff:ff:ff:ff addr were used in various
places to indicate default/broadcast keys. Make this more consistent
and useful by defining NULL to mean default key (i.e., used both for
unicast and broadcast) and ff:ff:ff:ff:ff:ff to indicate broadcast
key (i.e., used only with broadcast).
2011-01-09 19:44:28 +02:00
Ben Greear
6859f1cb24 Enable sharing of scan result events among virtual interfaces
When controlling multiple virtual interfaces on the same physical
radio, share the scan results events with sibling interfaces. This
decreases the time it takes to connect many virtual interfaces.

This is currently only supported on Linux with cfg80211-based
drivers when using nl80211 or wext driver interface.

Signed-off-by: Ben Greear <greearb@candelatech.com>
2010-11-26 21:46:30 +02:00
David A Benjamin
32f4e7b124 wext: Fix scan result signal levels when driver reports in dBm
wpa_supplicant showed signal levels incorrectly with some drivers:
Jun  6 16:29:36 rupert wpa_supplicant[18945]: Current BSS: 00:0d:97:11:40:d6
level=190
Jun  6 16:29:36 rupert wpa_supplicant[18945]: Selected BSS: 00:0d:97:11:50:09
level=192

Judging from output from other tools (iwlist) and the min_diff block
at the end of wpa_supplicant_need_to_roam, it seems these values
should actually be negative. Specifically, if one treats that number
as a signed char instead of unsigned, everything matches up.

To be honest, I've little to no understanding of wireless, but looking
at the source code for wireless-tools (iw_print_stats in iwlib.c), it
seems that the fields of the iw_quality struct need to be decoded
differently depending on various flags. I guess
src/drivers/driver_wext.c should have similar logic in
wext_get_scan_qual.

I wrote a patch that attempts to replicate some of that logic,
although it may be more complicated than is necessary; I think some of
the complexity is for backwards-compatibility, which might not be
necessary depending on wpa_supplicant's dependencies? In any case, it
is attached. Again, I don't know how any of this works, so it's likely
the patch is a bit off. But I think at least the logic to determine
min_diff in wpa_supplicant_need_to_roam would be more accurate if
level were determined correctly.
2010-10-04 08:25:00 +03:00
Jouni Malinen
a63063b4f6 rfkill: Use rtnetlink ifup/ifdown events
Replace use of rfkill block event with rtnetlink ifdown. This makes
the design more robust since the rfkill event could have been for
another interface while the rtnetlink events are already filtered
based of ifindex. In addition, the new design handles other than
rfkill-triggered ifdown/ifup events, too. rfkill unblocked event
is still needed to try to set the interface back up. If the unblock
was for another interface, ifup will fail and the driver state is
not changed.
2010-05-31 18:52:17 +03:00
Jouni Malinen
5216938960 Fix memory leak on rfkill init error path 2010-05-25 12:06:25 +03:00
Jouni Malinen
8401a6b028 Add Linux rfkill support
Add a new wpa_supplicant state: interface disabled. This can be used
to allow wpa_supplicant to be running with the network interface even
when the driver does not actually allow any radio operations (e.g.,
due to rfkill).

Allow driver_nl80211.c and driver_wext.c to start while rfkill is in
blocked state (i.e., when ifconfig up fails) and process rfkill
events to block/unblock WLAN.
2010-05-23 10:27:32 +03:00
Jouni Malinen
3145e6154c wext: Add cfg80211-specific optimization to avoid silly behavior
If the driver is detected to use cfg80211, we can rely on it being able
to disconnect with SIOCSIWMLME commands and to use empty SSID as a way
to stop it from associating when we are in progress of configuring the
driver for association. Consequently, we can remove the hack that uses
random 32-octet SSID to force disconnection and re-order association
commands to match the expectations that cfg80211 has for WEXT ioctls.
This gets rid of extra scan rounds and attempts to associate with the
silly 32-octet SSID.
2010-01-12 20:01:09 +02:00
Jouni Malinen
4a5869206e wext: Check hexstr2bin() return value in custom scan text processing 2010-01-10 22:26:11 +02:00
Jouni Malinen
a7efb16052 WEXT: Show BSSID/SSID set failures on disconnect in debug log 2010-01-10 22:18:50 +02:00
Jouni Malinen
fbe3e7f840 wext: Check hexstr2bin() return value 2010-01-10 22:16:51 +02:00
Jouni Malinen
34f2f814e0 Share a single Linux ioctl helper fo setting interface up/down
Number of Linux driver wrappers included this more or less identical
function, so lets add a new helper file to be able to share some more
code between the driver wrappers.
2010-01-03 22:08:26 +02:00
Jouni Malinen
abd9fafab6 Standardize on a single definition of auth_alg bitfield values 2010-01-03 21:14:40 +02:00
Jouni Malinen
1d041bec84 Use generic driver event notification for AP mode assoc/disassoc 2010-01-03 18:22:22 +02:00
Jouni Malinen
291b60682a nl80211/wext: Hardcode all auth_algs as supported
There does not seem to be a driver interface for fetching auth_algs
capability, but this may be used by some external application, so
hardcode all auth_algs as supported for now.
2010-01-01 21:41:19 +02:00
Jouni Malinen
719347511a Get rid of unnecessary typedefs for enums. 2009-12-26 10:35:08 +02:00
Jouni Malinen
62d680c3ca netlink: Move more of the newlink/dellink parsing into shared code 2009-12-18 17:49:07 +02:00
Jouni Malinen
08063178fb nl80211/wext: Share netlink new/del link event receive code 2009-12-18 17:11:54 +02:00
Jouni Malinen
e2d02c29b5 driver_nl80211/wext: Share netlink operstate send function
As an initial step in sharing netlink helper functions among driver
wrappers, create a new file for netlink code and move operstate send
function there.
2009-12-18 16:35:33 +02:00
Jouni Malinen
3b31db5199 Fix netlink payload length calculation
nlmsghdr length needs to be removed from payload length. [Bug 341]
2009-12-18 16:14:54 +02:00
Jouni Malinen
90973fb2fd Remove src/common from default header file path
This makes it clearer which files are including header from src/common.
Some of these cases should probably be cleaned up in the future not to
do that.

In addition, src/common/nl80211_copy.h and wireless_copy.h were moved
into src/drivers since they are only used by driver wrappers and do not
need to live in src/common.
2009-11-29 17:51:55 +02:00
Jouni Malinen
c2e8d0a092 Remove deprecated scan and set_probe_req_ie driver_ops
These have been replaced with scan2 driver_ops that provides all
parameters in a single call.
2009-11-23 21:13:46 +02:00
Jouni Malinen
4a867032ae Remove deprecated driver_ops handlers
This gets rid of previously deprecated driver_ops handlers set_wpa,
set_drop_unencrypted, set_auth_alg, set_mode. The same functionality
can be achieved by using the init/deinit/associate handlers.
2009-11-23 20:22:38 +02:00
Jouni Malinen
642187d6bf Merge set_key and hapd_set_key driver_ops into a single function 2009-11-23 16:58:32 +02:00
Jouni Malinen
0ae7b08691 Work around some gcc 4.4 strict-aliasing warnings
gcc 4.4 ends up generating strict-aliasing warnings about some very common
networking socket uses that do not really result in a real problem and
cannot be easily avoided with union-based type-punning due to struct
definitions including another struct in system header files. To avoid having
to fully disable strict-aliasing warnings, provide a mechanism to hide the
typecast from aliasing for now. A cleaner solution will hopefully be found
in the future to handle these cases.
2009-11-04 19:49:14 +02:00
Dan Williams
2976121955 wext: disconnect at init and deinit
To ensure the supplicant starts and ends with a clean slate (keys are
already cleaned up at init and deinit time), force a null BSSID and
bogus SSID to ensure the driver isn't connected to anything.

Signed-off-by: Dan Williams <dcbw@redhat.com>
2009-05-27 21:01:26 +03:00
Dan Williams
87d01acfeb wext: Fix deauthentication to do IW_MLME_DEAUTH prior to disconnect
4853d5ac84 had a small bug in the order
of these function calls in _wext_deauthenticate() (_disassociate()
did have the correct order). The deauthentication frame is supposed
to go out (if driver supports that) before we disconnect more
forcefully.
2009-05-27 20:57:29 +03:00
Dan Williams
64a04447c3 wext: don't force-disconnect in ad-hoc mode
Otherwise the driver might interpret the request as a request to
create/join a new adhoc network with the bogus SSID.

Signed-off-by: Dan Williams <dcbw@redhat.com>
2009-05-27 20:55:15 +03:00
Jouni Malinen
7c2849d2a0 Add BSS flags to scan results to indicate signal quality validity
These flags are used to mark which values (level, noise, qual) are
invalid (not available from the driver) and whether level is using dBm.
D-Bus interface will now only report the values that were available.
2009-02-18 13:40:38 +02:00
Jouni Malinen
ba2a573c5f Rename "broadcast SSID" to "wildcard SSID"
"Wildcard SSID" is the term used in IEEE Std 802.11-2007, so it is a
better name for the zero-length SSID used in Probe Request.
2009-02-14 22:21:17 +02:00
Jouni Malinen
362f781e1c Allow multiple driver wrappers to be specified on command line
For example, -Dnl80211,wext could be used to automatically select
between nl80211 and wext. The first driver wrapper that is able to
initialize the interface will be used.
2009-02-14 16:43:43 +02:00
Jouni Malinen
80bc75f135 New driver capability info: max number of scan SSIDs
The driver wrappers can now inform wpa_supplicant how many SSIDs can
be used in a single scan request (i.e., send multiple Probe Requests
per channel). This value is not yet used, but it can eventually be used
to allow a new scan command to specify multiple SSIDs to speed up
scan_ssid=1 operations. In addition, a warning could be printed if
scan_ssid=1 is used with a driver that does not support it
(max_scan_ssids=0).
2009-02-12 22:05:32 +02:00
Jouni Malinen
4853d5ac84 wext: Force disconnect on deauthenticate()
Use the same zero-BSSID, random-SSID trick for both disassociate() and
deauthenticate().
2009-02-10 11:43:40 +02:00
Dan Williams
b965fa7294 wext: really disassociate (set random SSID)
Really disassociate when tearing stuff down; drivers may sometimes
(legally) keep trying to reassociate unless the BSSID is unlocked.  If
the SSID is unlocked too, under WEXT drivers are able to pick an SSID to
associate, so kill that behavior by setting a bogus SSID.  Unfortunately
WEXT doesn't provide an easy method to say "stop whatever doing and just
idle".

Signed-off-by: Dan Williams <dcbw@redhat.com>
2009-02-10 11:40:19 +02:00