Commit graph

2999 commits

Author SHA1 Message Date
Jouni Malinen ebd79f07c4 hostapd: Make hostapd_config::bss array of pointers
This makes it more convenient to move BSS configuration entries between
struct hostapd_config instances to clean up per-BSS configuration file
design.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2013-10-29 16:58:21 +02:00
Jouni Malinen a781e211f9 hostapd: Force PSK to be derived again on BSS reload
This may be needed if the wpa_psk information for previously derived
from passphrase and either the SSID or the passphrase has changed.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2013-10-29 16:58:20 +02:00
Jouni Malinen 9f104b0324 hostapd: Reuse hostapd_clear_old() for RELOAD command
Instead of duplicating the functionality and missing changes (like the
hostapd_broadcast_wep_clear() call), use the hostapd_clear_old()
function that was already used for the similar case with configuration
file reload.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2013-10-29 16:09:34 +02:00
Dmitry Shmidt 32b62704fa Android: Fix ARRAY_SIZE() compilation
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
2013-10-29 14:40:15 +02:00
Eliad Peller ca9bc5b566 P2P: Add VHT support
Start GO with VHT support if VHT option was requested
and the appropriate channels are available.

Signed-hostap: Eliad Peller <eliadx.peller@intel.com>
2013-10-27 20:08:36 +02:00
Eliad Peller 20ea1ca406 P2P: Add VHT parameter to P2P operations
Add the option to ask for VHT operation similarly to the way ht40 is
configured - either by adding 'vht' param to the relevant p2p_*
commands or by configuring p2p_go_vht=1 in the configuration file.

This patch only adds the configuration option (e.g., via control
interface). The actual handling of the VHT parameter (asking the driver
to use VHT, etc.) will be done by the following patch.

Signed-hostap: Eliad Peller <eliadx.peller@intel.com>
2013-10-27 19:46:17 +02:00
Eliad Peller 53cfad46e2 nl80211: Mark VHT 80 MHz channels
Later on, we'll consider the availability of these
channels when starting P2P GO with VHT support.

Signed-hostap: Eliad Peller <eliadx.peller@intel.com>
2013-10-27 19:37:10 +02:00
Eliad Peller 6b02335a96 hostapd: Mask out not-supported VHT capabilities
Mask the remote VHT capabilities with our own capabilities, similarly
to what is done for HT capabilities.

Signed-hostap: Eliad Peller <eliadx.peller@intel.com>
2013-10-27 19:28:40 +02:00
Eliad Peller 7f0303d5b0 hostapd: Verify VHT 160/80+80 MHz driver support
Make sure the driver supports 160/80+80 MHz VHT capabilities
before trying to configure these channels.

Signed-hostap: Eliad Peller <eliadx.peller@intel.com>
2013-10-27 19:17:23 +02:00
Eliad Peller c781eb8428 hostapd: Verify VHT capabilities are supported by driver
Make sure the defined VHT capabilities are supported by the driver.

Signed-hostap: Eliad Peller <eliadx.peller@intel.com>
2013-10-27 19:11:29 +02:00
Eliad Peller b29b012cbc Fix some VHT Capabilities definitions
VHT_CAP_BEAMFORMEE_STS_MAX, VHT_CAP_SOUNDING_DIMENSION_OFFSET, and
VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT were not defined properly (wrong
name/size). Fix that and update the hostapd.conf parsing accordingly.

Signed-hostap: Eliad Peller <eliadx.peller@intel.com>
2013-10-27 19:05:58 +02:00
Helmut Schaa 6651f1f9f1 nl80211: Use max tx power from regulatory domain
Previously the Country element contained the max TX power the local
hardware was capable of. Change this to just use the regulatory limit.

Signed-hostap: Helmut Schaa <helmut.schaa@googlemail.com>
Signed-off-by: Helmut Schaa <helmut.schaa@googlemail.com>
2013-10-27 18:42:16 +02:00
Jouni Malinen 7ac3616d0f nl80211: Replace perror() and printf() calls with wpa_printf()
This avoids use of stderr and makes debug messages more consistent.

Signed-hostap: Jouni Malinen <j@w1.fi>
2013-10-27 17:58:12 +02:00
Jouni Malinen 51e9f22809 P2P: Add option to allow additional client channels
The new p2p_add_cli_chan=1 configuration parameter can be used to
request passive-scan channels to be included in P2P channel lists for
cases where the local end may become the P2P client in a group. This
allows more options for the peer to use channels, e.g., if the local
device is not aware of its current location and has marked most channels
to require passive scanning.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2013-10-26 17:49:10 +03:00
Jouni Malinen 556b30daca P2P: Add option to remove channels from GO use
The new p2p_no_go_freq frequency range list (comma-separated list of
min-max frequency ranges in MHz) can now be used to configure channels
on which the local device is not allowed to operate as a GO, but on
which that device can be a P2P Client. These channels are left in the
P2P Channel List in GO Negotiation to allow the peer device to select
one of the channels for the cases where the peer becomes the GO. The
local end will remove these channels from consideration if it becomes
the GO.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2013-10-26 17:49:10 +03:00
Jouni Malinen e7ecab4a3b Use ARRAY_SIZE() macro
Replace the common sizeof(a)/sizeof(a[0]) constructions with a more
readable version.

Signed-hostap: Jouni Malinen <j@w1.fi>
2013-10-26 17:49:05 +03:00
Jouni Malinen 39044a7033 Introduce ARRAY_SIZE() macro
This can be used to clean up the common sizeof(a)/sizeof(a[0])
constructions to use a more readable version.

Signed-hostap: Jouni Malinen <j@w1.fi>
2013-10-26 17:49:00 +03:00
Janusz Dziedzic 2e946249b1 DFS: Handle radar event when CAC actived correctly
When we have CAC active and receive a radar event, we should ignore
CAC_ABORT event and handle channel switch in the radar event handler.

Signed-hostap: Janusz Dziedzic <janusz.dziedzic@tieto.com>
2013-10-26 17:48:55 +03:00
Janusz Dziedzic 5eaf240af5 DFS: Fix overlapped() function to check only DFS channels
This fixes a problem when operating on non-DFS channel and receiving a
radar event for that channel. Previously, we would have decided to
switch channels.

Signed-hostap: Janusz Dziedzic <janusz.dziedzic@tieto.com>
2013-10-26 17:48:46 +03:00
Janusz Dziedzic 345276a6b5 DFS: Adjust center freq correctly for VHT20/VHT40
Setup correct seg0 for VHT with 20/40 MHz width (VHT_CHANWIDTH_USE_HT).

Signed-hostap: Janusz Dziedzic <janusz.dziedzic@tieto.com>
2013-10-26 17:48:41 +03:00
Janusz Dziedzic 1dc17db34a DFS: Fix available channels list for VHT80
Add a table of available VHT80 channels. This table contains the first
available channel. We will also choose this first channel as the control
one.

Signed-hostap: Janusz Dziedzic <janusz.dziedzic@tieto.com>
2013-10-26 17:48:36 +03:00
Jouni Malinen 34068ac3b1 nl80211: Add debug prints on nl_recvmsgs() failure
These libnl calls could potentially fail and it is useful to know if
that has happened.

Signed-hostap: Jouni Malinen <j@w1.fi>
2013-10-26 17:48:28 +03:00
Johannes Berg 10b8592183 nl80211: Make eloop sockets non-blocking
To avoid a problem where the beacon socket occasionally
blocks, mark any sockets on the eloop as non-blocking.
The previous patch reordered the code to never send a
command after a socket was put on the eloop, but now also
invalidate the nl handle pointer while it's on there.

Signed-hostap: Johannes Berg <johannes.berg@intel.com>
2013-10-26 17:48:22 +03:00
Johannes Berg 5f65e9f717 nl80211: Abstract handling of sockets on eloop
Abstract the handling of sockets on the eloop to avoid
destroying sockets still on the eloop and also to allow
the next patch to mark the socket non-blocking.

Signed-hostap: Johannes Berg <johannes.berg@intel.com>
2013-10-26 17:48:17 +03:00
Johannes Berg e8d1168b73 nl80211: Register for IBSS auth frames before eloop
The IBSS code registers the bss nl_mgmt socket for auth
frames when the join event happens, but that is too late
as then the socket is already on the eloop, which could
cause problems when other events are received at the
same time as the registration is done.

Move the auth frame registration to the initial setup
before the socket is put onto the eloop.

Signed-hostap: Johannes Berg <johannes.berg@intel.com>
2013-10-26 17:48:09 +03:00
Jouni Malinen 03610ad28d Clean up get_seqnum() use for IPN
Some driver wrappers may implement this by writing eight octets even
though IPN is only six octets. Use a separate WPA_KEY_RSC_LEN (8) octet
buffer in the call to make sure there is enough buffer room available
for the full returned value and then copy it to IPN field.

The previous implementation used the following igtk field as the extra
buffer and then initialized that field afterwards, so this change does
not fix any real issue in behavior, but it is cleaner to use an explicit
buffer of the maximum length for get_seqnum().

Signed-hostap: Jouni Malinen <j@w1.fi>
2013-10-26 15:56:07 +03:00
Jouni Malinen 3318376101 Add explicit buffer length checks for p2p_build_wps_ie()
Even though the length of this buffer is based only on locally
configured information, it is cleaner to include explicit buffer room
validation steps when adding the attributes into the buffer.

Signed-hostap: Jouni Malinen <j@w1.fi>
2013-10-26 15:55:46 +03:00
Jouni Malinen 0f0120148a Verify that readlink() did not truncate result
linux_br_get() was forcing null termination on the buffer, but did not
check whether the string could have been truncated. Make this more
strict by rejecting any truncation case.

Signed-hostap: Jouni Malinen <j@w1.fi>
2013-10-26 15:55:39 +03:00
Jouni Malinen f5eb9da304 nl80211: Clean up if_add() for hostapd use
The allocation of new_bss and its use was separated by a lot of code in
this function. This can be cleaned up by moving the allocation next to
the use, so that this all can be within a single #ifdef HOSTAPD block.
The i802_check_bridge() call was outside type == WPA_IF_AP_BSS case, but
in practice, it is only used for WPA_IF_AP_BSS (and if used for
something else, this would have resulted in NULL pointer dereference
anyway).

Signed-hostap: Jouni Malinen <j@w1.fi>
2013-10-26 15:55:30 +03:00
Jouni Malinen a288da61b6 OpenSSL: Fix memory leak on error path
If SSL_CTX_new() fails in tls_init(), the per-SSL app-data allocation
could have been leaked when multiple TLS instances are allocated.

Signed-hostap: Jouni Malinen <j@w1.fi>
2013-10-26 15:55:24 +03:00
Jouni Malinen 6cb4f11dba nl80211: Fix strerror() value in P2P Dev debug messages
send_and_recv_msgs() returns negative errno, so need to use -ret in the
strerror() call.

Signed-hostap: Jouni Malinen <j@w1.fi>
2013-10-26 15:55:18 +03:00
Jouni Malinen 35f836375d DFS: Add forgotten break statement
The VHT_CHANWIDTH_160MHZ case fell through to the default case and
printed out a debug message that was not supposed to be shown here.

Signed-hostap: Jouni Malinen <j@w1.fi>
2013-10-26 15:55:09 +03:00
Jouni Malinen 2f243b804a Remove os_strncpy()
os_strlpcy() should be used instead of os_strncpy() to guarantee null
termination. Since there are no remaining strncpy uses, remove
os_strncpy() definition.

Signed-hostap: Jouni Malinen <j@w1.fi>
2013-10-26 15:55:00 +03: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
Naresh Jayaram fa56315cfc eap_proxy: Add context data pointer to the get_imsi call
This was already included in all the other calls to eap_proxy, but
somehow the get_imsi call had been forgotten.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2013-10-23 20:51:46 +03:00
Naresh Jayaram 07041c6f99 eap_proxy: Confirm eap_proxy initialization before reading SIM info
Trying to access the SIM card details without checking if the eap_proxy
layer has been initialized can results in a crash. Address this by
sending the request for the IMSI through eapol_supp_sm.c which can
verify that eap_proxy has been initialized.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2013-10-23 20:51:39 +03:00
Helmut Schaa 677cf19091 hostapd: Select any supported channel if ACS fails
Signed-hostap: Helmut Schaa <helmut.schaa@googlemail.com>
2013-10-23 00:44:48 +03:00
Helmut Schaa 20f9cb1842 hostapd: Allow ACS to deal with partial survey data
Previously ACS required valid survey data on all available channels.
This can however not be guaranteed. Instead of just failing, fall back
to the subset of channels that have valid ACS data.

Signed-hostap: Helmut Schaa <helmut.schaa@googlemail.com>
2013-10-23 00:44:41 +03:00
Helmut Schaa 3645fd5aae hostapd: Propagate ACS errors to iface setup
Otherwise hostapd might hang doing nothing anymore. Propagate ACS
errors so we can fail gracefully.

Signed-hostap: Helmut Schaa <helmut.schaa@googlemail.com>
2013-10-23 00:44:36 +03:00
Helmut Schaa 0e1d0b370f hostapd: Don't get stuck after failed ACS
If ACS fails we still need to call hostapd_setup_interface_complete.
Otherwise hostapd will just hang doing nothing anymore. However, pass
an error to hostapd_setup_interface_complete to allow a graceful fail.

Signed-hostap: Helmut Schaa <helmut.schaa@googlemail.com>
2013-10-23 00:44:30 +03:00
Jouni Malinen af8a827b90 Make frequency range list routines more general
This allows the frequency range list implementation to be shared for
other purposes.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2013-10-23 00:44:07 +03:00
Jouni Malinen 941dae0a2e P2P: Add more user friendly debug print of channel lists
This makes it easier to go through the P2P channel list operations in
the debug log without having to parse through the hexdump manually.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2013-10-23 00:39:17 +03:00
Michal Kazior cd3b0700df nl80211: Fix DFS radar event parsing
Incorrect nla_get variants were used to get event type and frequency.
Kernel passes both as u32. This caused issues on tinynl/big-endian hosts
- CAC finished was treated as radar detection and frequency was 0.

Signed-hostap: Michal Kazior <michal.kazior@tieto.com>
2013-10-22 15:50:07 +03:00
Jouni Malinen 2b72df6374 nl80211: Free BSS structure even if netdev does not exists
It is possible for a vif netdev to be removed by something else than
hostapd and if that happens for a virtual AP interface, if_remove()
handler should still free the local data structure to avoid memory leaks
if something external removes a netdev.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2013-10-22 13:35:32 +03:00
Jouni Malinen 41cc50d19e nl80211: Update send_action_cookie on AP-offchannel-TX path
Previously, the send_mlme->send_frame->send_frame_cmd path that could be
used when a GO sends an offchannel Action frame ended up not updating
drv->send_action_cookie. This can result in an issue with not being able
to cancel wait for the response, e.g., in invitation-to-running-group
case.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2013-10-21 18:24:20 +03:00
Jouni Malinen dc46fd66c9 P2P: Cancel offchannel TX wait on Invitation Response RX
This fixes issues where a GO used offchannel-TX operation to send an
Invitation Request frame. Wait for the offchannel TX operation needs to
be stopped as soon as the Invitation Response frame has been received.
This addresses some issues where Probe Response frame from the GO
through the monitor interface may end up going out on a wrong channel
(the channel of this offchannel TX operation for invitation).

Signed-hostap: Jouni Malinen <j@w1.fi>
2013-10-20 21:38:02 +03:00
Jouni Malinen 8d82c2105b P2P: Fix PD retry channel on join-a-group case
Join-a-group needs to force the current operating channel of the target
group as the frequency to use for the PD exchange. When the channel was
selected based on a BSS entry for the GO, this worked only for the first
PD Request frame while the retries reverted to a potentially different
channel based on a P2P peer entry. Fix this by maintaining the forced
channel through the PD retry sequence.

Signed-hostap: Jouni Malinen <j@w1.fi>
2013-10-20 21:38:02 +03:00
Jouni Malinen 512629aefe P2P: Accept Invitation Response non-success without Channel List
P2P Invitation Response frame is required to include the Channel List
attribute only in Status=Success case. Skip the debug message claiming
that a mandatory attribute was not included in non-Success case.

Signed-hostap: Jouni Malinen <j@w1.fi>
2013-10-20 21:37:52 +03:00
Jouni Malinen db13605816 EAP-AKA/AKA' peer: Allow external USIM processing to be used
This allows the new external_sim=1 case to be used to perform UMTS
authentication step in EAP-AKA/AKA' peer process. Following control
interface event is used to request the operation:

CTRL-REQ-SIM-<network id>:UMTS-AUTH:<RAND>:<AUTN> needed for SSID <SSID>

Response from external processing is returned with
CTRL-RSP-SIM-<network id> UMTS-AUTH:<IK>:<CK>:<RES>
or
CTRL-RSP-SIM-<network id> UMTS-AUTS:<AUTS>

Signed-hostap: Jouni Malinen <j@w1.fi>
2013-10-20 13:12:04 +03:00
Jouni Malinen 569ccf719f EAP-SIM peer: Allow external SIM processing to be used
This allows the new external_sim=1 case to be used to perform GSM
authentication step in EAP-SIM peer process. Following control interface
event is used to request the operation:

CTRL-REQ-SIM-<network id>:GSM-AUTH:<RAND1>:<RAND2>[:<RAND3>] needed
for SSID <SSID>

For example:
<3>CTRL-REQ-SIM-0:GSM-AUTH:5e3496ce7d5863b3b09f97f565513bc3:
73f0f0bc5c47bcbed6f572d07ab74056:447b784f08de80bdc2b1e100fccbb534
needed for SSID test

Response from external processing is returned with
CTRL-RSP-SIM-<network id> GSM-AUTH:<Kc1>:<SRES1>:<Kc2>:<SRES2>
[:<Kc3>:<SRES3>]

For example:
wpa_cli sim 0 GSM-AUTH:d41c76e0079247aa:2709ebfb:43baa77cfc8bcd6c:
0fa98dc1:a8ad1f6e30e

Signed-hostap: Jouni Malinen <j@w1.fi>
2013-10-20 13:12:04 +03:00