mech_eap.git
13 years agohostapd: Inherit correct MAC address for AP VLAN interfaces
Helmut Schaa [Thu, 24 Feb 2011 19:25:40 +0000 (21:25 +0200)]
hostapd: Inherit correct MAC address for AP VLAN interfaces

When using multiple vifs and dynamic vlan tagging is enabled on any
interface, the created AP VLAN interfaces get the BSSID of the first
AP mode interface instead of the BSSID of the corresponding AP mode
interface.

Example:

wlan0 - xx:xx:xx:xx:x0
wlan1 - xx:xx:xx:xx:x1

Assume a STA connects to the AP interface wlan1 and gets a dynamic
VLAN tag 100 assigned by the RADIUS server. Hostapd will create an AP
VLAN interface wlan1.100 but doesn't set an address for this interface
which results in wlan1.100 getting the same address as wlan0:

wlan1.100 - xx:xx:xx:xx:x0

As a result the STA that was moved to wlan1.100 isn't able to finish its
4-way handshake since mac80211 won't pass its frames to wlan1.100 due to
the different address.

To fix this issue make use of the address of the AP interface when
creating an AP VLAN interface.

Signed-off-by: Helmut Schaa <helmut.schaa@googlemail.com>
13 years agoP2P: Handle P2P-not-supported without segfaults
Jouni Malinen [Thu, 24 Feb 2011 19:13:30 +0000 (21:13 +0200)]
P2P: Handle P2P-not-supported without segfaults

Previous code was assuming that the P2P module is always initialized.
However, that is not the case anymore with drivers that do not support
P2P. Add verification of whether P2P is enabled before trying to execute
P2P commands.

13 years agoAP: Update logging related to inactivity and disassociation
Ben Greear [Thu, 24 Feb 2011 15:44:45 +0000 (17:44 +0200)]
AP: Update logging related to inactivity and disassociation

Add MAC addresses for stations and use wpa_msg instead of printf
methods to make it easier to grep logs and find messages for the
station in question.

Signed-off-by: Ben Greear <greearb@candelatech.com>
13 years agoAdd more wpa_auth debugging messages
Ben Greear [Thu, 24 Feb 2011 15:35:59 +0000 (17:35 +0200)]
Add more wpa_auth debugging messages

13 years agoWait 1 second before (re)scanning on authentication timeout
Ben Greear [Thu, 24 Feb 2011 15:16:16 +0000 (17:16 +0200)]
Wait 1 second before (re)scanning on authentication timeout

If we timed out, the AP or the local radio may be busy.
So, wait a second until scanning again.

Signed-off-by: Ben Greear <greearb@candelatech.com>
13 years agoSME: Add timers for authentication and asscoiation
Ben Greear [Thu, 24 Feb 2011 14:59:46 +0000 (16:59 +0200)]
SME: Add timers for authentication and asscoiation

mac80211 authentication or association operation may get stuck for some
reasons, so wpa_supplicant better use an internal timer to recover from
this.

Signed-off-by: Ben Greear <greearb@candelatech.com>
13 years agoRemove unneeded OpenSSL error messages from key/cert parsing
Jouni Malinen [Tue, 22 Feb 2011 20:19:55 +0000 (22:19 +0200)]
Remove unneeded OpenSSL error messages from key/cert parsing

If parsing of the certificate or private key succeeds using any of
the tried encoding types, clear the OpenSSL error queue without
showing the pending errors in debug log since they do not really
provide any useful output and can be confusing.

13 years agonl80211: Use nl_atype() from libnl
Raghunathan Kailasanathan [Tue, 22 Feb 2011 19:48:49 +0000 (21:48 +0200)]
nl80211: Use nl_atype() from libnl

libnl provides nla_type() which can be used to derive nla_type from
struct nlattr.

13 years agoP2P: Notify WPS-M2D event on parent interface and handle PBC overlap
Jouni Malinen [Tue, 22 Feb 2011 10:20:16 +0000 (12:20 +0200)]
P2P: Notify WPS-M2D event on parent interface and handle PBC overlap

GO may use M2D to notify that PBC overlap was detected if the GO was
configured to allow only a specific P2P Device to connect using PBC.
We need to report the M2D message on the parent interface if a
separate group interface is used. In addition, we can stop the P2P
operation if PBC overlap was indicated similarly to what we are
already doing in th case the overlap is detected locally.

13 years agoRemove obsolete comments about libnl 1.1 being new
Jouni Malinen [Mon, 21 Feb 2011 21:41:56 +0000 (23:41 +0200)]
Remove obsolete comments about libnl 1.1 being new

13 years agowpa_cli: Add newline to end of responses in interactive mode
Jouni Malinen [Mon, 21 Feb 2011 20:50:11 +0000 (22:50 +0200)]
wpa_cli: Add newline to end of responses in interactive mode

Some of the wpa_supplicant control interface commands, like WPS_PIN,
may not include a newline in the end of the response. This can result
in the response being lost when wpa_cli redraws the screen after an
event message. Add a newline after such responses in interactive mode
to avoid the problem.

13 years agoutils: Corrected a typo in header's name definition
Guy Eilam [Mon, 21 Feb 2011 20:44:46 +0000 (22:44 +0200)]
utils: Corrected a typo in header's name definition

Corrected a typo in the BASE64_H definition that
might cause the header file to be included more than once.

Signed-off-by: Guy Eilam <guy@wizery.com>
13 years agoWPS ER: Stop eloop only on the last terminate_cb
Ben Greear [Mon, 21 Feb 2011 19:47:46 +0000 (21:47 +0200)]
WPS ER: Stop eloop only on the last terminate_cb

This allows all WPS ER instances to be cleaned up properly if more
than one interface has an active WPS ER when wpa_supplicant is being
killed.

13 years agoIncrease internal TLSs client key exchange buffer
Christian Lamparter [Mon, 21 Feb 2011 16:25:34 +0000 (18:25 +0200)]
Increase internal TLSs client key exchange buffer

This patch fixes a problem I had when I tried to connect
an embedded system [wpa_supplicant, CONFIG_TLS=internal]
to my TLS secured network.

TLSv1: Send CertificateVerify
TLSv1: CertificateVerify hash - hexdump(len=36): ha .. ha
PKCS #1: pkcs1_generate_encryption_block - Invalid buffer lengths \
                        (modlen=512 outlen=454 inlen=36)

It turned out that a fixed 1000 byte message buffer was just
a little bit too small for the 4096 bit RSA certificates
I'm using.

Signed-off-by: Christian Lamparter <chunkeey@googlemail.com>
13 years agohostapd: Allow coexistance of HT BSSes with WEP/TKIP BSSes
Helmut Schaa [Mon, 21 Feb 2011 15:27:16 +0000 (17:27 +0200)]
hostapd: Allow coexistance of HT BSSes with WEP/TKIP BSSes

In multi BSS setups it wasn't possible to set up an HT BSS in
conjunction with a WEP/TKIP BSS. HT needed to be turned off entirely
to allow WEP/TKIP BSSes to be used.

In order to allow HT BSSes to coexist with non-HT WEP/TKIP BSSes add a
new BSS conf attribute "disable_11n" which disables HT capabilities on a
single BSS by suppressing HT IEs in the beacon and probe response
frames. Furthermore, mark all STAs associated to a WEP/TKIP BSS as
non-HT STAs. The disable_11n parameter is used internally; no new entry
is parsed from hostapd.conf.

This allows a non-HT WEP/TKIP BSS to coexist with a HT BSS without
having to disable HT mode entirely. Nevertheless, all STAs associated to
the WEP/TKIP BSS will only be served as if they were non-HT STAs.

Signed-off-by: Helmut Schaa <helmut.schaa@googlemail.com>
13 years agoFT: Set EAPOL state machined to authenticated state with FT-EAP
Jouni Malinen [Sun, 20 Feb 2011 19:57:53 +0000 (21:57 +0200)]
FT: Set EAPOL state machined to authenticated state with FT-EAP

When FT protocol run is completed with FT-EAP, the EAPOL state machine
needs to be notified of the completed authentication to make sure it
does not try to start new authentication.

13 years agoFT: Fix FT-EAP to set EAPOL Authenticator into authenticated state
Jouni Malinen [Sun, 20 Feb 2011 19:55:28 +0000 (21:55 +0200)]
FT: Fix FT-EAP to set EAPOL Authenticator into authenticated state

This is needed to avoid the EAPOL Authenticator from trying to start
new authentication when FT protocol is used. [Bug 384]

13 years agoFT: Specify source MAC address for RRB messages
Jouni Malinen [Sun, 20 Feb 2011 15:50:11 +0000 (17:50 +0200)]
FT: Specify source MAC address for RRB messages

Use l2_packet with Ethernet header included so that the source
address for RRB packets can be forced to be the local BSSID. This
fixes problems where unexpected bridge interface address may end
up getting used and the recipient of the frame dropping it as
unknown R0KH/R1KH.

13 years agoDo not propagate bad scan results to siblings sharing the radio
Ben Greear [Wed, 16 Feb 2011 16:55:37 +0000 (18:55 +0200)]
Do not propagate bad scan results to siblings sharing the radio

This decreases useless work and re-scans by siblings when a
device gets a scan failure.

Signed-off-by: Ben Greear <greearb@candelatech.com>
13 years agoFlush STA entries in hostapd when clearing STAs from kernel
Jouni Malinen [Thu, 10 Feb 2011 20:31:32 +0000 (22:31 +0200)]
Flush STA entries in hostapd when clearing STAs from kernel

This is needed to keep kernel and hostapd in sync. In addition,
the obsolete entry in hostapd prevented use of Deauthentication
or Disassociation frame with reason code 6/7 mechanism to indicate
to the STA that there is no association if the STA missed the
broadcast Deauthentication frame for any reason.

13 years agohostapd: Fix RADIUS client configuration update on reconfig
Jouni Malinen [Thu, 10 Feb 2011 20:12:29 +0000 (22:12 +0200)]
hostapd: Fix RADIUS client configuration update on reconfig

The internal pointer to RADIUS client configuration needs to be
updated whenever a new hostapd configuration is loaded. Without
this, freed memory may be dereferenced and this can result in
segmentation faults.

13 years agoMake sure reserved field in WMM IE is set to 0
Jouni Malinen [Thu, 10 Feb 2011 20:10:40 +0000 (22:10 +0200)]
Make sure reserved field in WMM IE is set to 0

This was previously left uninitialized for Beacon frames and could
potentially have any value.

13 years agoFix CONFIG_NO_STDOUT_DEBUG=y build
Jouni Malinen [Thu, 10 Feb 2011 18:24:06 +0000 (20:24 +0200)]
Fix CONFIG_NO_STDOUT_DEBUG=y build

13 years agoUse wpa_msg() instead of wpa_printf()
Ben Greear [Thu, 10 Feb 2011 18:14:46 +0000 (20:14 +0200)]
Use wpa_msg() instead of wpa_printf()

This converts number of debugging messages to use wpa_msg() in order
to allow the interface name to be shown with the messages.

A new function, wpa_dbg(), is introduced to allow
CONFIG_NO_STDOUT_DEBUG=y builds to remove the debug strings. This is
otherwise identical with wpa_msg(), but it gets compiled out if stdout
debugging is disabled.

13 years agohostapd: Add require_ht configuration parameter
Jouni Malinen [Wed, 9 Feb 2011 13:08:47 +0000 (15:08 +0200)]
hostapd: Add require_ht configuration parameter

This can be used to configure hostapd to reject association with
any station that does not support HT PHY.

13 years agowpa_s AP: Deliver EVENT_RX_PROBE_REQ events to AP processing
Jouni Malinen [Tue, 8 Feb 2011 12:32:35 +0000 (14:32 +0200)]
wpa_s AP: Deliver EVENT_RX_PROBE_REQ events to AP processing

This is needed to allows WPS PBC session overlap detection to work
with drivers that process Probe Request frames internally. This
code is is run in hostapd, but the wpa_supplicant AP mode did not
have call to the hostapd_probe_req_rx() function even though it
registered handlers for hostapd Probe Request RX callbacks.

13 years agoP2P: Allow WPS_PBC command on GO to select on P2P Device Address
Jouni Malinen [Mon, 7 Feb 2011 16:28:36 +0000 (18:28 +0200)]
P2P: Allow WPS_PBC command on GO to select on P2P Device Address

An optional parameter, p2p_dev_addr, can now be given to WPS_PBC
command on P2P GO to indicate that only the P2P device with the
specified P2P Device Address is allowed to connect using PBC. If
any other device tries to use PBC, a session overlap is indicated
and the negotiation is rejected with M2D. The command format for
specifying the address is "WPS_PBC p2p_dev_addr=<address>", e.g.,
WPS_PBC p2p_dev_addr=02:03:04:05:06:07

In addition, show the PBC session overlap indication as a WPS failure
event on an AP/GO interface. This particular new case shows up as
"WPS-FAIL msg=4 config_error=12".

13 years agohostapd: Add iface-name wpa_msg() callback registration
Ben Greear [Sun, 6 Feb 2011 18:50:32 +0000 (20:50 +0200)]
hostapd: Add iface-name wpa_msg() callback registration

This allows the interface name to be automatically
added to log file lines by the core logging logic.

Signed-off-by: Ben Greear <greearb@candelatech.com>
13 years agoAdd interface name to wpa_msg() output
Ben Greear [Sun, 6 Feb 2011 18:39:34 +0000 (20:39 +0200)]
Add interface name to wpa_msg() output

This makes log files much more readable if multiple interfaces
are being controlled by the same process. The interface name is
added to stdout/file/syslog entries, but not to the messages
sent to control interface monitors to avoid issues with parsing
in external programs.

Signed-off-by: Ben Greear <greearb@candelatech.com>
13 years agohostapd: Allow logging to file
Ben Greear [Sun, 6 Feb 2011 18:24:16 +0000 (20:24 +0200)]
hostapd: Allow logging to file

Also supports 'relog' CLI command to re-open the log file.

Signed-off-by: Ben Greear <greearb@candelatech.com>
13 years agowpa_supplicant: Support 'relog' command to re-open log files
Ben Greear [Sun, 6 Feb 2011 18:15:19 +0000 (20:15 +0200)]
wpa_supplicant: Support 'relog' command to re-open log files

This allows rolling log files:

mv log.txt log.txt.1
wpa_cli relog

Signed-off-by: Ben Greear <greearb@candelatech.com>
13 years agoP2P: Add wpas_p2p_disconnect()
Johannes Berg [Wed, 2 Feb 2011 15:30:15 +0000 (17:30 +0200)]
P2P: Add wpas_p2p_disconnect()

Add a new API function wpas_p2p_disconnect()
to disconnect from or dissolve a group.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
13 years agoP2P: Use a variable for generated PIN to allow multiple uses
Johannes Berg [Wed, 2 Feb 2011 15:12:37 +0000 (17:12 +0200)]
P2P: Use a variable for generated PIN to allow multiple uses

In order to pass the same PIN to multiple notifications in the future,
generate it centrally.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
13 years agoutil: Add compact MAC address formatting/parsing
Johannes Berg [Wed, 2 Feb 2011 15:11:00 +0000 (17:11 +0200)]
util: Add compact MAC address formatting/parsing

The P2P DBus interface will use addresses for
DBus paths, and uses them without any separators.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
13 years agoDBus: Improve error reporting
Johannes Berg [Wed, 2 Feb 2011 15:03:32 +0000 (17:03 +0200)]
DBus: Improve error reporting

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
13 years agoDBus: Increase introspection buffer sizes
Johannes Berg [Wed, 2 Feb 2011 15:01:29 +0000 (17:01 +0200)]
DBus: Increase introspection buffer sizes

The P2P additions will add more data so
that the current buffers aren't big enough.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
13 years agoDBus: Publish provisioned keys in network properties
Johannes Berg [Wed, 2 Feb 2011 15:00:12 +0000 (17:00 +0200)]
DBus: Publish provisioned keys in network properties

When the network was provisioned, we need to get the keys to be able to
reconnect without new provisioning. To be able to publish those keys but
not normally configured ones, add a new attribute to struct wpa_ssid
indicating whether or not keys may be exported.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
13 years agoAP: Add callback for STA authorized transitions
Johannes Berg [Wed, 2 Feb 2011 14:56:59 +0000 (16:56 +0200)]
AP: Add callback for STA authorized transitions

Add a callback for station's authorized transitions
to allow wpa_supplicant to emit events in DBus.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
13 years agoAP: Introduce sta authorized wrappers
Johannes Berg [Wed, 2 Feb 2011 14:52:32 +0000 (16:52 +0200)]
AP: Introduce sta authorized wrappers

To enable making state change notifications on the WLAN_STA_AUTHORIZED
flag, introduce ap_sta_set_authorized(), and to reduce use of the flag
itself also add a wrapper for testing the flag: ap_sta_is_authorized().

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
13 years agoP2P: Clear driver Probe Response IE on stop_listen
Johannes Berg [Tue, 1 Feb 2011 16:30:33 +0000 (18:30 +0200)]
P2P: Clear driver Probe Response IE on stop_listen

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
13 years agonl80211: Use max_remain_on_chan data from nl80211
Johannes Berg [Tue, 1 Feb 2011 16:18:32 +0000 (18:18 +0200)]
nl80211: Use max_remain_on_chan data from nl80211

If the driver advertises max_remain_on_chan data, use it instead of
the hardcoded value of 5000. Keep the default at 5000 since that is the
value used by earlier versions of cfg80211/mac80211 and not advertised
in nl80211 for those.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
13 years agoP2P: Fix p2p_long_listen
Johannes Berg [Tue, 1 Feb 2011 16:09:38 +0000 (18:09 +0200)]
P2P: Fix p2p_long_listen

There are two issues with p2p_long_listen:
 1) max_remain_on_channel is assumed to be 5 seconds,
 2) if max_remain_on_channel is not a full multiple of
    seconds, accounting breaks.

Fix these by converting p2p_long_listen to ms and
tracking it according to max_remain_on_channel.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
13 years agonl80211: Remove excessive nl80211_set_mode() call
Eliad Peller [Tue, 1 Feb 2011 14:38:38 +0000 (16:38 +0200)]
nl80211: Remove excessive nl80211_set_mode() call

When authenticating, and the interface type is not already
NL80211_IFTYPE_STATION, we need to call wpa_driver_nl80211_set_mode()
only once. Remove the excessive call.

Signed-off-by: Eliad Peller <eliad@wizery.com>
13 years agoAP: Make sure ieee80211n_allowed_ht40_channel_pair() gets called
Jouni Malinen [Tue, 1 Feb 2011 14:09:26 +0000 (16:09 +0200)]
AP: Make sure ieee80211n_allowed_ht40_channel_pair() gets called

We need to call this function after having completed the neighboring
channel scan to figure out whether HT40 can be used and if so, which
channel is the secondary channel.

13 years agoAP: Ensure ieee80211n_supported_ht_capab() gets called to check ht caps
Nishant Sarmukadam [Tue, 1 Feb 2011 14:04:59 +0000 (16:04 +0200)]
AP: Ensure ieee80211n_supported_ht_capab() gets called to check ht caps

ieee80211n_supported_ht_capab is called after ieee80211n_check_40mhz in
function hostapd_check_ht_capab. ieee80211n_check_40mhz can return 1 in
a valid scenario where the initialization is completed in a callback. In
this case ieee80211n_supported_ht_capab is skipped and hostapd does not
check the ht capabilities reported by the driver. Fix this issue making
sure ieee80211n_supported_ht_capab gets called.

Signed-off-by: Nishant Sarmukadam <nishants@marvell.com>
13 years agoAP: Enable WMM with default parameters by default for HT
Johannes Berg [Tue, 1 Feb 2011 12:34:12 +0000 (14:34 +0200)]
AP: Enable WMM with default parameters by default for HT

If WMM is not disabled explicitly (wmm_enabled=0 in hostapd.conf),
enable WMM automatically whenever HT (ieee80211n) is enabled. Use
the default WMM parameters for AP TX queues and the EDCA parameters
advertised for stations in WMM IE if no overriding values are
included in the configuration.

13 years agoFT: Configure FT XXKey as PMK for driver-based 4-way handshake
Jouni Malinen [Mon, 31 Jan 2011 22:06:13 +0000 (00:06 +0200)]
FT: Configure FT XXKey as PMK for driver-based 4-way handshake

When using FT-EAP, the second half of MSK is used as the starting
point for PMK key hierarchy. Configure that instead of the first
half of MSK when using FT with driver-based 4-way handshake and
FT protocol.

13 years agoSet portValid=TRUE on association for driver-based 4-way handshake
Jouni Malinen [Mon, 31 Jan 2011 22:04:02 +0000 (00:04 +0200)]
Set portValid=TRUE on association for driver-based 4-way handshake

This was previously done for WPA/WPA2-Personal as part of association
processing when the driver is implementing 4-way handshake. The
portValid needs to be done for WPA/WPA2-Enterprise to get the proper
EAPOL authentication completed callback to configure PMK to the driver.

13 years agonl80211: use P2P interface types
Johannes Berg [Mon, 31 Jan 2011 19:49:48 +0000 (21:49 +0200)]
nl80211: use P2P interface types

We can use the P2P interface types to check if the driver supports P2P
and to tell the kernel that a given interface is going to be used for
P2P (when it is created).

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
13 years agoP2P: Show "FAIL" for failed p2p_find operation
Masashi Honma [Mon, 31 Jan 2011 15:29:31 +0000 (17:29 +0200)]
P2P: Show "FAIL" for failed p2p_find operation

I tried these commands:

./wpa_cli -i wlan0 p2p_group_add
./wpa_cli -i wlan0 p2p_find

The second one results in following messages because it is invalid
operation.

-------
nl80211: Scan trigger failed: ret=-95 (Operation not supported)
P2P: Failed to start p2p_scan
-------

But the second one shows "OK" on control console.

This patch makes it to show "FAIL".

13 years agohostapd: Ensure that the destination directory exists
Mike Crowe [Sun, 30 Jan 2011 19:33:17 +0000 (21:33 +0200)]
hostapd: Ensure that the destination directory exists

Ensure that the destination binary directory exists before installing
into it.

Signed-off-by: Mike Crowe <mac@mcrowe.com>
13 years agoUse DESTDIR when installing hostapd to support cross-compiling
Mike Crowe [Sun, 30 Jan 2011 19:32:44 +0000 (21:32 +0200)]
Use DESTDIR when installing hostapd to support cross-compiling

Signed-off-by: Mike Crowe <mac@mcrowe.com>
13 years agoRemove obsolete drivers wrappers: atmel, ndiswrapper, ipw, hermes
Jouni Malinen [Sun, 30 Jan 2011 19:29:25 +0000 (21:29 +0200)]
Remove obsolete drivers wrappers: atmel, ndiswrapper, ipw, hermes

There is no real reason to maintain these in the current development
branch anymore. If someone really needs support for the obsolete
driver interfaces, these can be found in older wpa_supplicant
branches.

driver_atmel.c
- vendor-specific interface for ATMEL AT76C5XXx cards
- for some old out-of-tree driver; not for the upstream atmel*
  drivers

driver_ndiswrapper.c
- vendor-specific interface for an out-of-tree driver
- ndiswrapper should work with driver_wext.c, too

driver_ipw.c
- vendor-specific interface for old ipw2100/2200 driver
- the upstream driver works with driver_wext.c (and does not work
  with the old interface)

driver_hermes.c
- vendor driver that was not even included in the main wpa_supplicant
  releases

13 years agonl80211: Make use of the ht opmode bss attribute
Helmut Schaa [Sun, 30 Jan 2011 19:16:29 +0000 (21:16 +0200)]
nl80211: Make use of the ht opmode bss attribute

In order to enable protection mechanisms for different HT opmodes the
driver needs to be aware of the current HT opmode that is calculated by
hostapd. Hence, pass the current opmode to the nl80211 driver via
the bss attribute NL80211_ATTR_BSS_HT_OPMODE.

Signed-off-by: Helmut Schaa <helmut.schaa@googlemail.com>
13 years agohostapd: Allow TDLS use to be prohibited in the BSS
Jouni Malinen [Fri, 28 Jan 2011 17:21:59 +0000 (19:21 +0200)]
hostapd: Allow TDLS use to be prohibited in the BSS

tdls_prohibit=1 and tdls_prohibit_chan_switch=1 and now be used to
disable use of TDLS or TDLS channel switching in the BSS using
extended cabilities IE as defined in IEEE 802.11z.

13 years agowlantest: Add command for adding WEP keys during run time
Jouni Malinen [Fri, 28 Jan 2011 11:33:21 +0000 (13:33 +0200)]
wlantest: Add command for adding WEP keys during run time

13 years agoFix couple of compiler warnings about uninitialized variables
Jouni Malinen [Wed, 26 Jan 2011 19:29:28 +0000 (21:29 +0200)]
Fix couple of compiler warnings about uninitialized variables

13 years agowlantest: Handle missing fields in TDLS Setup Confirm error case
Jouni Malinen [Mon, 24 Jan 2011 18:51:28 +0000 (20:51 +0200)]
wlantest: Handle missing fields in TDLS Setup Confirm error case

13 years agowlantest: Handle missing fields in TDLS Setup Response error case
Jouni Malinen [Mon, 24 Jan 2011 16:16:26 +0000 (18:16 +0200)]
wlantest: Handle missing fields in TDLS Setup Response error case

13 years agowlantest: Count TDLS Teardown messages
Jouni Malinen [Mon, 24 Jan 2011 15:00:28 +0000 (17:00 +0200)]
wlantest: Count TDLS Teardown messages

13 years agowlantest: Fix compiler warnings
Jouni Malinen [Mon, 24 Jan 2011 14:57:36 +0000 (16:57 +0200)]
wlantest: Fix compiler warnings

13 years agowlantest: Fix TDLS setup failure counting
Jouni Malinen [Mon, 24 Jan 2011 13:25:59 +0000 (15:25 +0200)]
wlantest: Fix TDLS setup failure counting

Need to be able to handle TDLS Setup Response frame with LinkId IE
when non-zero status code is used. In addition, allow finding of a
TDLS entry based on real BSSID instead of the one used in the LinkId
to allow negative testing of different BSS.

13 years agowlantest: Determine ping matches properly for direct link
Jouni Malinen [Mon, 24 Jan 2011 12:50:51 +0000 (14:50 +0200)]
wlantest: Determine ping matches properly for direct link

Check ICMP echo request/response matches for both STAs to get proper
counter values for a ping from a one STA to another one using TDLS.

13 years agowlantest: Set direct links down on deauth/disassoc
Jouni Malinen [Mon, 24 Jan 2011 12:33:48 +0000 (14:33 +0200)]
wlantest: Set direct links down on deauth/disassoc

13 years agowlantest: Maintain only a single entry for an active direct link
Jouni Malinen [Mon, 24 Jan 2011 12:26:35 +0000 (14:26 +0200)]
wlantest: Maintain only a single entry for an active direct link

The TDLS link itself is bidirectional, but there is explicit
initiator/responder roles. Remove the other direction of the link if it
exists when processing TDLS Setup Confirm to make sure that the link
counters are stored for the current TDLS entery.

This is also changing the control interface search for TDLS counters
to require initiator/responder addresses in the correct order instead
of matching entries regardless of the role.

13 years agowlantest: Add counters for TDLS setup frames
Jouni Malinen [Mon, 24 Jan 2011 12:03:03 +0000 (14:03 +0200)]
wlantest: Add counters for TDLS setup frames

13 years agowlantest: Add TDLS entry on TDLS Setup Request
Jouni Malinen [Wed, 19 Jan 2011 12:00:14 +0000 (14:00 +0200)]
wlantest: Add TDLS entry on TDLS Setup Request

This will make the TDLS counters available even if setup fails.

13 years agowlantest: Check WPA/RSN IE match between AssocReq and Beacon
Jouni Malinen [Mon, 17 Jan 2011 17:52:35 +0000 (19:52 +0200)]
wlantest: Check WPA/RSN IE match between AssocReq and Beacon

Note unexpected WPA/RSN IE in AssocReq and ignore them if the last
Beacon/ProbeResp from the AP is not advertising support for
WPA/RSN.

13 years agoAP: Validate management frame length
Jouni Malinen [Mon, 17 Jan 2011 10:21:29 +0000 (12:21 +0200)]
AP: Validate management frame length

Make sure that received management frames are long enough before
processing them. This avoids a potential segmentation fault if a
driver delivers an invalid frame all the way to hostapd.

13 years agoEAP-pwd: Fix some interoperability issues
Dan Harkins [Sun, 16 Jan 2011 11:12:07 +0000 (13:12 +0200)]
EAP-pwd: Fix some interoperability issues

The changes are:

  1. the word "and" in the hunting-and-pecking string passed to the KDF
     should be capitalized.
  2. the primebitlen used in the KDF should be a short not an int.
  3. the computation of MK in hostap is based on an older version of the
     draft and is not the way it's specified in the RFC.
  4. the group being passed into computation of the Commit was not in
     network order.

13 years agoEAP-pwd: Use os_free to free memory allocated with os_malloc
Jouni Malinen [Sun, 16 Jan 2011 11:02:11 +0000 (13:02 +0200)]
EAP-pwd: Use os_free to free memory allocated with os_malloc

The direct use of free() caused a crash with CONFIG_WPA_TRACE=y.

13 years agoWPA: Add more info for EAPOL-Key Nonce/MIC debugging
Jouni Malinen [Sat, 15 Jan 2011 14:57:08 +0000 (16:57 +0200)]
WPA: Add more info for EAPOL-Key Nonce/MIC debugging

13 years agoIBSS RSN: Do not start multiple Auth/Supp for same peer
Jouni Malinen [Sat, 15 Jan 2011 14:55:15 +0000 (16:55 +0200)]
IBSS RSN: Do not start multiple Auth/Supp for same peer

This avoids an issue when a received EAPOL-Key frame from a peer
is initiating IBSS RSN Authenticator and Supplicant for the peer
and the following new-STA-in-IBSS event from the driver is adding
yet another instance of Authenticator/Supplicant. The EAPOL-Key
RX case was already checking whether an instance had been started;
the driver new-STA event needs to do same.

13 years agoIBSS RSN: Delay setting of the initial TX GTK
Jouni Malinen [Sat, 15 Jan 2011 12:07:02 +0000 (14:07 +0200)]
IBSS RSN: Delay setting of the initial TX GTK

The driver may get confused if we set the initial TX GTK before having
fully configured and connected to an IBSS, so better delay this
operation until the connection (join/start IBSS) has been completed.

13 years agowlantest: Add support for decrypting WEP frames
Jouni Malinen [Fri, 14 Jan 2011 15:43:17 +0000 (17:43 +0200)]
wlantest: Add support for decrypting WEP frames

13 years agowlantest: Add more details for CCMP MIC failures
Jouni Malinen [Fri, 14 Jan 2011 14:32:59 +0000 (16:32 +0200)]
wlantest: Add more details for CCMP MIC failures

13 years agowlantest: Fix masking of CCMP AAD QC field
Jouni Malinen [Fri, 14 Jan 2011 14:32:14 +0000 (16:32 +0200)]
wlantest: Fix masking of CCMP AAD QC field

13 years agoWPS: Indicate WPS-FAIL event on EAPOL timeout-based failure callback
Chao-Wen Yang [Thu, 13 Jan 2011 16:04:33 +0000 (18:04 +0200)]
WPS: Indicate WPS-FAIL event on EAPOL timeout-based failure callback

If the EAPOL processing times out (e.g., if the AP stops replying
to messages for some reason) during WPS negotiation, we need to
indicate WPS-FAIL event from eapol_cb since no other WPS failure is
reported for this particular case.

13 years agoWPS: Add mechanism for indicating non-standard WPS errors
Chao-Wen Yang [Thu, 13 Jan 2011 15:50:59 +0000 (17:50 +0200)]
WPS: Add mechanism for indicating non-standard WPS errors

Previously, only the Configuration Error values were indicated in
WPS-FAIL events. Since those values are defined in the specification
it is not feasible to extend them for indicating other errors. Add
a new error indication value that is internal to wpa_supplicant and
hostapd to allow other errors to be indicated.

Use the new mechanism to indicate if negotiation fails because of
WEP or TKIP-only configurations being disallows by WPS 2.0.

13 years agoP2P: Check GO Neg Req retransmit limit in p2p_listen_end
Jouni Malinen [Wed, 12 Jan 2011 11:48:55 +0000 (13:48 +0200)]
P2P: Check GO Neg Req retransmit limit in p2p_listen_end

This needs to be done both in the more normal location in
p2p_timeout_connect_listen() (internal timeout after driver event) and
in p2p_listen_end() as a workaround for the case where the driver event
is delayed to happen after the internal timeout.

13 years agotest-sha1: Add test vectors from RFC 6070
Jouni Malinen [Mon, 10 Jan 2011 18:41:04 +0000 (20:41 +0200)]
test-sha1: Add test vectors from RFC 6070

The test with very large iterations count is commented out since it
takes quite long to derive (it does pass, though). In addition, the
last test vector is commented out since pbkdf2_sha1() does not support
arbitrary binary passphrases (\0 inside the string).

13 years agonl80211: Set NL80211_ATTR_KEY_DEFAULT_TYPES based on set_key addr
Jouni Malinen [Sun, 9 Jan 2011 17:54:50 +0000 (19:54 +0200)]
nl80211: Set NL80211_ATTR_KEY_DEFAULT_TYPES based on set_key addr

This allows mac80211 to configure default keys properly for RSN IBSS
mode.

13 years agoUse set_key addr to distinguish default and multicast keys
Jouni Malinen [Sun, 9 Jan 2011 17:44:28 +0000 (19:44 +0200)]
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).

13 years agonl80211: Avoid infinite loop when searching a BSS
Jouni Malinen [Sun, 9 Jan 2011 17:18:50 +0000 (19:18 +0200)]
nl80211: Avoid infinite loop when searching a BSS

When hostapd is removing a virtual BSS interface, the loop here was
incorrectly not updating the iterator during list traversal and
ended up in an infinite loop in some cases.

13 years agoMove hostap driver specific workaround into the driver wrapper
Jouni Malinen [Sun, 9 Jan 2011 10:50:57 +0000 (12:50 +0200)]
Move hostap driver specific workaround into the driver wrapper

13 years agoDo not use set_tx=1 when clearing keys with set_key
Jouni Malinen [Sun, 9 Jan 2011 10:18:36 +0000 (12:18 +0200)]
Do not use set_tx=1 when clearing keys with set_key

13 years agoUse key=NULL when clearing PTK with set_key
Jouni Malinen [Sun, 9 Jan 2011 10:12:48 +0000 (12:12 +0200)]
Use key=NULL when clearing PTK with set_key

The key clearing operations are using NULL everywhere else, so make
this consistent with other callers.

13 years agoUse more consistent set_key seq value when nothing is being set
Jouni Malinen [Sun, 9 Jan 2011 10:09:04 +0000 (12:09 +0200)]
Use more consistent set_key seq value when nothing is being set

Use NULL instead of (u8 *) "" as the seq value and make sure the
driver wrapper implementations can handle NULL value. This was
previously already done in number of places, but not everywhere.

13 years agowlantest: Add STA counter prot_data_tx
Jouni Malinen [Fri, 7 Jan 2011 15:09:09 +0000 (17:09 +0200)]
wlantest: Add STA counter prot_data_tx

13 years agowlantest: Add counters for AP deauth/disassoc while asleep/awake
Jouni Malinen [Fri, 7 Jan 2011 14:52:56 +0000 (16:52 +0200)]
wlantest: Add counters for AP deauth/disassoc while asleep/awake

These can be used to check whether the STA is in power save mode
and because of that, is not seeing disconnection notifications.

13 years agowlantest: Track station PS state
Jouni Malinen [Fri, 7 Jan 2011 13:54:58 +0000 (15:54 +0200)]
wlantest: Track station PS state

13 years agowlantest: Add more details for replay debug messages
Jouni Malinen [Fri, 7 Jan 2011 12:17:08 +0000 (14:17 +0200)]
wlantest: Add more details for replay debug messages

These make it easier to find the frame in question when looking at
the capture in Wireshark.

13 years agoWPS: Make WPS-AP-AVAILABLE* events a bit more consistent
Jouni Malinen [Wed, 5 Jan 2011 09:49:03 +0000 (11:49 +0200)]
WPS: Make WPS-AP-AVAILABLE* events a bit more consistent

The BSS table entries may be in more or less random order and it is
better to show the most likely WPS configuration method in a way that is
somewhat more consistent instead of just showing the method of the first
BSS entry found in the table.

13 years agowlantest: Skip frames inserted by wlantest when reading pcap file
Jouni Malinen [Wed, 5 Jan 2011 08:41:51 +0000 (10:41 +0200)]
wlantest: Skip frames inserted by wlantest when reading pcap file

This makes debug output clearer when re-reading a file that has
previously been processed and decrypted by wlantest.

13 years agowlantest: Count number of STA ACK'ed Deauth/Disassoc frames
Jouni Malinen [Mon, 3 Jan 2011 17:28:40 +0000 (19:28 +0200)]
wlantest: Count number of STA ACK'ed Deauth/Disassoc frames

13 years agowlantest: Add ping_ok_first_assoc STA counter
Jouni Malinen [Mon, 3 Jan 2011 14:54:14 +0000 (16:54 +0200)]
wlantest: Add ping_ok_first_assoc STA counter

This can be used to verify whether ping goes through between
clearing of the STA counters and the first (re)association.

13 years agoFix wpa_supplicant_ssid_bss_match() handler for non-WPA
Jouni Malinen [Thu, 30 Dec 2010 16:27:33 +0000 (18:27 +0200)]
Fix wpa_supplicant_ssid_bss_match() handler for non-WPA

The proto configuration may be left to non-zero when moving from one
configuration to another. To avoid misidentifying a network
configuration as enabling WPA, check key_mgmt field, too.

13 years agoatheros: Rename "madwifi_" prefix to "atheros_"
Shan Palanisamy [Mon, 20 Dec 2010 10:35:57 +0000 (12:35 +0200)]
atheros: Rename "madwifi_" prefix to "atheros_"

13 years agobsd: Fix receive buffer alignment issue
Yi Zhu [Thu, 9 Dec 2010 19:30:20 +0000 (11:30 -0800)]
bsd: Fix receive buffer alignment issue

wpa_supplicant seems to crash from time to time on a NetBSD 4.0 MIPS
platform. The root cause turned out to be a MIPS alignment issue.

In my wpa_supplicant crash case, in function
wpa_driver_bsd_event_receive (from driver_bsd.c), the buf[2048] address
is started from i.e. 0x7fffd546, which is not 4 bytes aligned. Later
when it is casted to (struct if_msghdr *), and rtm->rtm_flags is used.
rtm->rtm_flags is "int" type, but its address is not 4 bytes aligned.
This is because the start address of rtm is not 4 bytes aligned.
Unfortunately in NetBSD MIPS kernel (unlike Linux MIPS kernel emulates
unaligned access in its exception handler), the default behavior is to
generate a memory fault to the application that accesses unaligned
memory address. Thus comes the early mentioned wpa_supplicant crash. An
interesting note is when I'm using the wpa_supplicant version 0.4.9, I
never saw this problem. Maybe the stack layout is different. But I
didn't look into details.

I used below patch to resolve this problem. Now it runs correctly for at
least several hours. But you might have a better fix (maybe we can use
malloc/free so that it is at least cache line aligned?). I'm also not
sure if other drivers should have the same problem.

13 years agoFix driver_bsd.c compile error
Yi Zhu [Thu, 9 Dec 2010 19:29:26 +0000 (11:29 -0800)]
Fix driver_bsd.c compile error

I got an error for WPA_KEY_RSC_LEN is not defined when compiling the
driver_bsd.c on NetBSD 4.0. Below patch fixed it.