mech_eap.git
8 years agotests: FST SESSION_INITIATE and SESSION_RESPOND error cases
Jouni Malinen [Sun, 26 Jul 2015 14:35:52 +0000 (17:35 +0300)]
tests: FST SESSION_INITIATE and SESSION_RESPOND error cases

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agoFST: Make fst_hw_mode_to_band() non-inline function
Jouni Malinen [Sun, 26 Jul 2015 13:34:35 +0000 (16:34 +0300)]
FST: Make fst_hw_mode_to_band() non-inline function

There is no need for using an inline function for this. Save a bit in
binary size by using a normal function.

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agotests: More FST GET_PEER_MBIES coverage
Jouni Malinen [Sun, 26 Jul 2015 13:30:21 +0000 (16:30 +0300)]
tests: More FST GET_PEER_MBIES coverage

The case of valid but unknown peer address was not covered previously.

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agoFST: Fix get_peer_mbies interface fetching in multi-group case
Jouni Malinen [Sun, 26 Jul 2015 13:28:51 +0000 (16:28 +0300)]
FST: Fix get_peer_mbies interface fetching in multi-group case

The foreach_fst_group() loop needs "break-if-found", not
"continue-if-not-found" to do the search iteration properly. If there
were multiple groups, the previous design could have failed to find the
interface.

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agoFST: Merge unreachable error case to another error return
Jouni Malinen [Sun, 26 Jul 2015 13:18:40 +0000 (16:18 +0300)]
FST: Merge unreachable error case to another error return

fst_read_next_text_param() is never called with buflen <= 1, so this
separate error path is practically unreachable. Merge it with another
error path to make this a bit more compact.

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agotests: Use a shared FST setup function
Jouni Malinen [Sun, 26 Jul 2015 10:37:44 +0000 (13:37 +0300)]
tests: Use a shared FST setup function

This removes quite a bit of duplicated code. In addition, this starts
using different FST group names to get additional coverage.

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agoFST: Use more robust interface-find for TEST_REQUEST
Jouni Malinen [Sun, 26 Jul 2015 15:44:39 +0000 (18:44 +0300)]
FST: Use more robust interface-find for TEST_REQUEST

It is possible for there to be multiple FST groups, so the hardcoded
mechanism of selecting the first one when sending out an event message
may not be sufficient. Get the interface from the caller, if available,
and if not, go through all groups in search of an interface to send the
event on.

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agoFST: Use more robust interface-find for event messages
Jouni Malinen [Sun, 26 Jul 2015 10:39:55 +0000 (13:39 +0300)]
FST: Use more robust interface-find for event messages

It is possible for there to be multiple FST groups, so the hardcoded
mechanism of selecting the first one when sending out an event message
may not be sufficient. Get the interface from the caller, if available,
and if not, go through all groups in search of an interface to send the
event on.

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agotests: Explicitly close hostapd global control socket on RELOG
Jouni Malinen [Sun, 26 Jul 2015 10:34:54 +0000 (13:34 +0300)]
tests: Explicitly close hostapd global control socket on RELOG

Without this, the run-tests.py socket could have been left in attached
to receive all hostapd global events during a test case. This could hit
the limit of pending messages on the socket since there is nothing
clearing this socket during the execution of a test case. Fix this by
explicitly closing the socket after having completed the RELOG command.

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agoFST: Remove unnecessary fst_attach() already attached check
Jouni Malinen [Sun, 26 Jul 2015 09:10:14 +0000 (12:10 +0300)]
FST: Remove unnecessary fst_attach() already attached check

Now that both hostapd and wpa_supplicant already enforce no duplicate
fst_attach() calls, there is no need for this check within fst_attach().

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agotests: FST attach errors in wpa_supplicant
Jouni Malinen [Sun, 26 Jul 2015 09:09:08 +0000 (12:09 +0300)]
tests: FST attach errors in wpa_supplicant

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agoFST: Avoid memory leak on double FST-ATTACH
Jouni Malinen [Sun, 26 Jul 2015 09:08:17 +0000 (12:08 +0300)]
FST: Avoid memory leak on double FST-ATTACH

Do not allow wpa_s->fst to be replaced when processing FST-ATTACH
command for an interface that has already been attached.

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agotests: FST Setup Request processing and OOM during MBIE update
Jouni Malinen [Sun, 26 Jul 2015 08:54:48 +0000 (11:54 +0300)]
tests: FST Setup Request processing and OOM during MBIE update

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agotests: FST setup multiple times
Jouni Malinen [Sun, 26 Jul 2015 08:45:12 +0000 (11:45 +0300)]
tests: FST setup multiple times

This verifies FST group dialog_token wrap-around and behavior with large
number of session setups and teardowns.

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agoFST: Fix dialog token wrap-around
Jouni Malinen [Sun, 26 Jul 2015 08:25:49 +0000 (11:25 +0300)]
FST: Fix dialog token wrap-around

Dialog token is only 8 bits and maintaining u32 version of it in struct
fst_group resulted in incorrect wrap-around behavior in
fst_group_assign_dialog_token(). It was possible to assign u8
dialog_token value 0 because of this. Fix this by using u8 variable
consistently.

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agotests: Additional FST Setup test coverage
Jouni Malinen [Sat, 25 Jul 2015 21:33:55 +0000 (00:33 +0300)]
tests: Additional FST Setup test coverage

This adds a test case that goes through session initialization through
separate commands that can be modified more easily for special case. The
first such special case is using special FST Setup Request frames with
non-standard MBIE contents to hit different code paths for finding the
interface.

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agotests: Extend fst_ap_ctrl_iface to support existing groups
Jouni Malinen [Sun, 26 Jul 2015 15:11:29 +0000 (18:11 +0300)]
tests: Extend fst_ap_ctrl_iface to support existing groups

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agotests: FST protocol tests to verify invalid STIE header
Jouni Malinen [Sun, 26 Jul 2015 07:56:02 +0000 (10:56 +0300)]
tests: FST protocol tests to verify invalid STIE header

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agoFST: Validate STIE header in FST Setup Request/Response
Jouni Malinen [Sun, 26 Jul 2015 07:54:58 +0000 (10:54 +0300)]
FST: Validate STIE header in FST Setup Request/Response

While this is always supposed to be the first element, check that this
is indeed the case instead of blindly using values from within the
element.

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agoFST: Fix Session Transition element length field value
Jouni Malinen [Sun, 26 Jul 2015 07:40:21 +0000 (10:40 +0300)]
FST: Fix Session Transition element length field value

The Element ID and Length subfields are not supposed to be included in
the Length. In addition, both of these subfields needs to be filled in
even for non-zero status code cases.

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agoFST: Print reason for ignoring FST Action frame in debug log
Jouni Malinen [Sat, 25 Jul 2015 20:20:33 +0000 (23:20 +0300)]
FST: Print reason for ignoring FST Action frame in debug log

This makes it easier to understand why some frames are not processed.

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agoFST: Do not replace previous attachment
Jouni Malinen [Sat, 25 Jul 2015 16:52:27 +0000 (19:52 +0300)]
FST: Do not replace previous attachment

hapd->iface->fst must not be overridden if it is already pointing to FST
instance. Without this, duplicated FST-ATTACH could result in memory
leak and process termination.

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agoFST: Use -EINVAL instead of EINVAL as return value
Jouni Malinen [Sat, 25 Jul 2015 16:50:43 +0000 (19:50 +0300)]
FST: Use -EINVAL instead of EINVAL as return value

This is more consistent with other error cases.

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agoatheros: Enable PMF functionality without CONFIG_IEEE80211R=y
Ashok Ponnaiah [Fri, 24 Jul 2015 11:43:47 +0000 (17:13 +0530)]
atheros: Enable PMF functionality without CONFIG_IEEE80211R=y

This extends the previous PMF (CONFIG_IEEE80211W=y) design that used
functionality from the FT (CONFIG_IEEE80211R=y) changes to work without
requiring CONFIG_IEEE80211R=y build option to be included.

Signed-off-by: Ashok Ponnaiah <aponnaia@qti.qualcomm.com>
8 years agotests: Fix ap_wps_wpa_cli_action outside VM
Jouni Malinen [Thu, 23 Jul 2015 17:48:33 +0000 (20:48 +0300)]
tests: Fix ap_wps_wpa_cli_action outside VM

Pass absolute path to the daemonized wpa_cli process and add read
privileges for everyone on the action script to make this test case work
better when run without a VM.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agohostapd: Add build options for selecting eloop type
Jouni Malinen [Thu, 23 Jul 2015 15:45:31 +0000 (18:45 +0300)]
hostapd: Add build options for selecting eloop type

This adds CONFIG_ELOOP_POLL=y and CONFIG_ELOOP_EPOLL=y options to
hostapd build options similarly to how these were implemented for
wpa_supplicant.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agoeloop: Fix cases where a socket is reopened from a timeout/signal handler
Jouni Malinen [Thu, 23 Jul 2015 15:39:35 +0000 (18:39 +0300)]
eloop: Fix cases where a socket is reopened from a timeout/signal handler

It was possible for a registered eloop socket handler to be unregistered
and re-registered for a re-opened socket with the same fd from a timeout
or signal handler. If such a case happened with the old socket having a
pending event waiting for processing, some eloop combinations could end
up calling the new handler function with the new socket and get stuck
waiting for an event that has not yet happened on the new socket. This
happened with timeout and signal handlers with all eloop.c types. In
addition to that, the epoll case could also trigger this when a socket
handler re-registered a re-opened socket.

Fix these by checking whether there has been socket handler changes
during processing and break the processing round by going back to
select/poll/epoll for an updated result if any changes are done during
the eloop handler calls before processing the old socket results.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agotests: eloop socket re-open from timeout/socket handler
Jouni Malinen [Thu, 23 Jul 2015 15:39:02 +0000 (18:39 +0300)]
tests: eloop socket re-open from timeout/socket handler

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agodrv_callbacks: Coding style cleanup
Jouni Malinen [Wed, 22 Jul 2015 16:56:04 +0000 (19:56 +0300)]
drv_callbacks: Coding style cleanup

Clean up inconsistent whitespace use and split strings.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agotests: WPS events and wpa_cli action script
Jouni Malinen [Wed, 22 Jul 2015 14:12:07 +0000 (17:12 +0300)]
tests: WPS events and wpa_cli action script

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agowpa_cli: Skip action script execution when eloop termination is pending
Jouni Malinen [Wed, 22 Jul 2015 14:10:32 +0000 (17:10 +0300)]
wpa_cli: Skip action script execution when eloop termination is pending

Try to exit more quickly by avoiding execution of the action script for
any pending events if the process is requested to be killed. This may
help in avoiding hitting the two second SIGALRM workaround in eloop in
case some of the action scripts block for long period of time.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agoeloop: Try to terminate more quickly on SIGINT and SIGTERM
Jouni Malinen [Wed, 22 Jul 2015 14:05:46 +0000 (17:05 +0300)]
eloop: Try to terminate more quickly on SIGINT and SIGTERM

It was possible for the SIGINT/SIGTERM signal to be received while
processing a pending timeout/socket/signal event and then get stuck in
the following select() call before processing the signal event. If no
other events show up within the two second SIGALRM trigger, process will
be terminated forcefully even though there would have been possibility
to do clean termination assuming no operationg blocked for that two
second time.

Handle this more cleanly by checking for eloop.pending_terminate before
starting the select()/poll()/epoll_wait() wait for the following event.
Terminate the loop if pending signal handling requests termination.

In addition, make eloop_terminated() return 1 on eloop.pending_terminate
in addition to eloop.terminate since the process will be terminated
shortly and there is no point in starting additional processing.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agoAdd QCA vendor definitions for multi-port concurrency
Ahmad Kholaif [Tue, 21 Jul 2015 20:11:43 +0000 (13:11 -0700)]
Add QCA vendor definitions for multi-port concurrency

Introduce definitions for QCA vendor specific subcommands and attributes
to support multiport concurrency.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agohostapd: Mark config parameter name const
Jouni Malinen [Tue, 21 Jul 2015 10:46:00 +0000 (13:46 +0300)]
hostapd: Mark config parameter name const

The functions parsing configuration parameters do not modify the name of
the parameter, so mark that function argument constant. In theory, the
value should also be const, but at least for now, number of the parser
functions end up modifying this to simplify parsing.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agotests: hostapd DUP_NETWORK
Anton Nayshtut [Sun, 19 Jul 2015 17:09:18 +0000 (20:09 +0300)]
tests: hostapd DUP_NETWORK

This test checks the functionality of DUP_NETWORK global control
inteface command.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agohostapd: Add DUP_NETWORK global control interface command
Anton Nayshtut [Mon, 20 Jul 2015 10:38:01 +0000 (13:38 +0300)]
hostapd: Add DUP_NETWORK global control interface command

This adds a new global control interface command DUP_NETWORK with the
following syntax:

DUP_NETWORK src_ifname dst_ifname param

The currently supported parameters:
  wpa
  wpa_key_mgmt
  wpa_pairwise
  rsn_pairwise
  wpa_passphrase
  wpa_psk

The specified configuration parameter is copied from the source
interface to the destination interface. The main use for this is to
allow cloning of security configuration without having to expose the
keys from the hostapd process.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agohostapd: Introduce hostapd_ctrl_iface_get_key_mgmt()
Anton Nayshtut [Sun, 19 Jul 2015 14:21:57 +0000 (17:21 +0300)]
hostapd: Introduce hostapd_ctrl_iface_get_key_mgmt()

This function will be used in DUP_NETWORK command implementation.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agohostapd: Introduce hostapd_interfaces_get_hapd()
Anton Nayshtut [Sun, 19 Jul 2015 09:13:23 +0000 (12:13 +0300)]
hostapd: Introduce hostapd_interfaces_get_hapd()

This function will be used in DUP_NETWORK command implementation.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agoAdd QCA vendor command for updating gateway parameters
Ravi Joshi [Fri, 17 Jul 2015 00:45:41 +0000 (17:45 -0700)]
Add QCA vendor command for updating gateway parameters

Add vendor command for updating gateway parameters to the driver.

Signed-off-by: Ravi Joshi <ravij@qca.qualcomm.com>
8 years agoFST: Include fst/fst.h explicitly into wpa_supplicant/ctrl_iface.c
Jouni Malinen [Tue, 21 Jul 2015 10:15:24 +0000 (13:15 +0300)]
FST: Include fst/fst.h explicitly into wpa_supplicant/ctrl_iface.c

This header file is needed to get struct fst_iface_cfg and struct
fst_wpa_obj defined. While it does currently get pulled in through
ap/hostapd.h and ap/ap_config.h, a more explicit inclusion may be a
cleaner option for future.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agoMove ap_list_timer() to use common AP periodic cleanup mechanism
Jouni Malinen [Mon, 20 Jul 2015 10:42:35 +0000 (13:42 +0300)]
Move ap_list_timer() to use common AP periodic cleanup mechanism

This reduces number of periodic eloop timeouts when AP mode operations
are in progress.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agoMove hostapd_acl_expire() to use common AP periodic cleanup mechanism
Jouni Malinen [Mon, 20 Jul 2015 10:39:22 +0000 (13:39 +0300)]
Move hostapd_acl_expire() to use common AP periodic cleanup mechanism

This reduces number of periodic eloop timeouts when AP mode operations
are in progress.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agoAdd shared periodic cleanup function for AP mode
Jouni Malinen [Mon, 20 Jul 2015 10:33:30 +0000 (13:33 +0300)]
Add shared periodic cleanup function for AP mode

This new mechanism can be used to combine multiple periodic AP
(including P2P GO) task into a single eloop timeout to minimize number
of wakeups for the process. hostapd gets its own periodic caller and
wpa_supplicant uses the previously added timer to trigger these calls.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agoUse a single cleanup timer per wpa_supplicant process
Jouni Malinen [Mon, 20 Jul 2015 10:11:31 +0000 (13:11 +0300)]
Use a single cleanup timer per wpa_supplicant process

Previously, one timeout per process (by default every 30 seconds) was
used P2P peer expiration and another per-interface timeout (every 10
seconds) was used to expire BSS entries. Merge these to a single
per-process timeout that triggers every 10 seconds to minimize number of
process wakeups due to periodic operations.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agotests: Use codecov build hostapd/wpa_supplicant in FST tests
Jouni Malinen [Sun, 19 Jul 2015 20:10:55 +0000 (23:10 +0300)]
tests: Use codecov build hostapd/wpa_supplicant in FST tests

Try to use the special build for --codecov purposes, if present, instead
of hardcoding the hostapd/wpa_supplicant binary to the default location.
This is needed to collect code coverage correctly.

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agotests: wpa_supplicant ctrl_iface network OOM in string parsing
Jouni Malinen [Sun, 19 Jul 2015 19:36:35 +0000 (22:36 +0300)]
tests: wpa_supplicant ctrl_iface network OOM in string parsing

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agotests: Additional module tests for src/utils
Jouni Malinen [Sun, 19 Jul 2015 17:25:41 +0000 (20:25 +0300)]
tests: Additional module tests for src/utils

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agotests: wpa_supplicant control interface wait for client
Jouni Malinen [Sun, 19 Jul 2015 19:04:07 +0000 (22:04 +0300)]
tests: wpa_supplicant control interface wait for client

This test case is also adding code coverage for process daemonizing and
Linux tracing.

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agotests: UUID parsing error cases
Jouni Malinen [Sun, 19 Jul 2015 17:52:11 +0000 (20:52 +0300)]
tests: UUID parsing error cases

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agotests: NFC connection handover to form a new P2P group and IP pool OOM
Jouni Malinen [Sun, 19 Jul 2015 14:28:44 +0000 (17:28 +0300)]
tests: NFC connection handover to form a new P2P group and IP pool OOM

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agotests: WPS ER OOM in XML processing
Jouni Malinen [Sun, 19 Jul 2015 13:44:51 +0000 (16:44 +0300)]
tests: WPS ER OOM in XML processing

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agotests: Initial AP configuration and OOM during PSK generation
Jouni Malinen [Sun, 19 Jul 2015 13:31:12 +0000 (16:31 +0300)]
tests: Initial AP configuration and OOM during PSK generation

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agoEAP server: Force FAILURE if EAP method buildReq fails
Jouni Malinen [Sun, 19 Jul 2015 13:29:29 +0000 (16:29 +0300)]
EAP server: Force FAILURE if EAP method buildReq fails

Previously, this resulted in unnecessary wait and retransmission of the
previous EAP-Request. Change that to trigger immediate transmission of
EAP-Failure and disconnection since the EAP method cannot really recover
from this state.

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agohostap: Remove special handling for protocol version 3 on RX
Jouni Malinen [Sat, 18 Jul 2015 20:24:16 +0000 (23:24 +0300)]
hostap: Remove special handling for protocol version 3 on RX

This functionality was removed from the Host AP driver in May 2003, so
there is not any point in maintaining this in hostapd either.

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agohlr_auc_gw: Hide a bogus static analyzer warning
Jouni Malinen [Sat, 18 Jul 2015 19:53:07 +0000 (22:53 +0300)]
hlr_auc_gw: Hide a bogus static analyzer warning

For some reason, snprintf() was not seen as sufficient to remove
potentially tainted string from fgets() before passing this to rename().
This does not make much sense, but anyway, try to get rid of the warning
by using a separate buffer for the internally written file names.
(CID 72690)

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agotests: FST-MANAGER TEST_REQUEST error cases
Jouni Malinen [Sat, 18 Jul 2015 16:29:39 +0000 (19:29 +0300)]
tests: FST-MANAGER TEST_REQUEST error cases

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agoFST: Fix FST-MANAGER TEST_REQUEST parsing
Jouni Malinen [Sat, 18 Jul 2015 16:28:38 +0000 (19:28 +0300)]
FST: Fix FST-MANAGER TEST_REQUEST parsing

The space separator between the command and the parameter was not
skipped properly and the first integer ended up being interpreted as 0
in all cases.

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agotests: FST protocol testing for Ack Response
Jouni Malinen [Sat, 18 Jul 2015 15:53:06 +0000 (18:53 +0300)]
tests: FST protocol testing for Ack Response

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agoFST: Remove unreachable code in fst_session_handle_tear_down()
Jouni Malinen [Sat, 18 Jul 2015 15:09:57 +0000 (18:09 +0300)]
FST: Remove unreachable code in fst_session_handle_tear_down()

fst_session_is_in_progress() is already checked as part of
fst_find_session_in_progress() before calling
fst_session_handle_action(). This is the only call path that can reach
fst_session_handle_tear_down() and as such, fst_session_is_in_progress()
cannot return 0 here.

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agotests: FST protocol testing for Setup Response
Jouni Malinen [Sat, 18 Jul 2015 15:08:51 +0000 (18:08 +0300)]
tests: FST protocol testing for Setup Response

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agotests: Speed up fst_proto by waiting for MGMT-TX-STATUS event
Jouni Malinen [Sat, 18 Jul 2015 16:04:55 +0000 (19:04 +0300)]
tests: Speed up fst_proto by waiting for MGMT-TX-STATUS event

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agoFST: Remove duplicated dl_list_empty() check befor dl_list_first()
Jouni Malinen [Sat, 18 Jul 2015 13:29:44 +0000 (16:29 +0300)]
FST: Remove duplicated dl_list_empty() check befor dl_list_first()

dl_list_first() takes care of this already, so there is no need to do a
separate check here.

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agoFST: Use EINVAL more consistently as a negative return value
Jouni Malinen [Sat, 18 Jul 2015 13:26:19 +0000 (16:26 +0300)]
FST: Use EINVAL more consistently as a negative return value

There was a mix of EINVAL and -EINVAL returns through the FST
implementation. Make this more consistent by always returning -EINVAL in
error cases.

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agoFST: Mark get_mb_ie() return value const
Jouni Malinen [Sat, 18 Jul 2015 13:16:26 +0000 (16:16 +0300)]
FST: Mark get_mb_ie() return value const

The caller is not expected to free or modify the value since this is
returning a reference to a buffer maintained by the upper layer.

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agoFST: Replace print_mb_ies() with wpa_snprintf_hex()
Jouni Malinen [Sat, 18 Jul 2015 13:09:42 +0000 (16:09 +0300)]
FST: Replace print_mb_ies() with wpa_snprintf_hex()

There is no need to add new functions with more or less identical
functionality of an already available helper function.

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agotests: FST-MANAGER TEST_REQUEST GET_FSTS_ID and ID not found
Jouni Malinen [Sat, 18 Jul 2015 13:01:35 +0000 (16:01 +0300)]
tests: FST-MANAGER TEST_REQUEST GET_FSTS_ID and ID not found

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agotests: FST-MANAGER SESSION_RESPOND failure
Jouni Malinen [Sat, 18 Jul 2015 12:56:20 +0000 (15:56 +0300)]
tests: FST-MANAGER SESSION_RESPOND failure

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agotests: FST-MANAGER SESSION_ADD OOM
Jouni Malinen [Sat, 18 Jul 2015 12:36:49 +0000 (15:36 +0300)]
tests: FST-MANAGER SESSION_ADD OOM

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agotests: FST-MANAGER SESSION_SET parameter parsing error cases
Jouni Malinen [Sat, 18 Jul 2015 09:51:06 +0000 (12:51 +0300)]
tests: FST-MANAGER SESSION_SET parameter parsing error cases

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agoFST: Mark format_session_state_extra() static
Jouni Malinen [Sat, 18 Jul 2015 09:40:23 +0000 (12:40 +0300)]
FST: Mark format_session_state_extra() static

This is not used outside fst_ctrl_iface.c.

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agotests: FST-ATTACH OOM in fst_iface_create()
Jouni Malinen [Sat, 18 Jul 2015 08:13:20 +0000 (11:13 +0300)]
tests: FST-ATTACH OOM in fst_iface_create()

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agotests: Use direct fst_test_common access
Jouni Malinen [Sat, 18 Jul 2015 08:02:46 +0000 (11:02 +0300)]
tests: Use direct fst_test_common access

There is no need to go through fst_module_aux to reach fst_test_common
since both of these get imported here.

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agotests: FST attach with llt=0
Jouni Malinen [Sat, 18 Jul 2015 08:01:44 +0000 (11:01 +0300)]
tests: FST attach with llt=0

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agotests: Verify wpa parameter in hostapd GET_CONFIG
Jouni Malinen [Fri, 17 Jul 2015 21:20:23 +0000 (00:20 +0300)]
tests: Verify wpa parameter in hostapd GET_CONFIG

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agohostapd: Add current wpa parameter into GET_CONFIG output
Mohammed Shafi Shajakhan [Thu, 25 Jun 2015 12:42:49 +0000 (18:12 +0530)]
hostapd: Add current wpa parameter into GET_CONFIG output

This can be used, e.g., by an action script to update new WPS
settings for the AP.

Signed-off-by: Mohammed Shafi Shajakhan <mohammed@qti.qualcomm.com>
8 years agohostapd_cli: Allow PID file to be specified
Mohammed Shafi Shajakhan [Thu, 25 Jun 2015 12:42:48 +0000 (18:12 +0530)]
hostapd_cli: Allow PID file to be specified

This can help when running multiple hostapd_cli instances
per interface and need to kill them correspondingly.

Signed-off-by: Mohammed Shafi Shajakhan <mohammed@qti.qualcomm.com>
8 years agotests: Add coverage for new vht_capab values
Jouni Malinen [Fri, 17 Jul 2015 21:00:20 +0000 (00:00 +0300)]
tests: Add coverage for new vht_capab values

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agohostapd: Extend the sounding and BF steering capabilities
Vivek Natarajan [Wed, 15 Jul 2015 11:58:22 +0000 (17:28 +0530)]
hostapd: Extend the sounding and BF steering capabilities

Depending on the number of antennas, the txbf sounding
and steering capabilites need to be extended.

Signed-off-by: Vivek Natarajan <nataraja@qti.qualcomm.com>
8 years agotests: Add hostapd interface with driver specified
Jouni Malinen [Fri, 17 Jul 2015 20:57:04 +0000 (23:57 +0300)]
tests: Add hostapd interface with driver specified

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agoAllow driver to be set in hostapd through global control interface
PavanKumar N [Mon, 13 Jul 2015 05:21:07 +0000 (10:51 +0530)]
Allow driver to be set in hostapd through global control interface

This extends the hostapd global control interface ADD command to allow
driver wrapper to be specified ("ADD <ifname> <ctrl_iface> <driver>").
Previously, this case that did not use a configuration file allowed only
the default driver wrapper to be used.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agoDrop CONFIG_TI_COMPILER ifdefs
Jouni Malinen [Fri, 17 Jul 2015 18:57:07 +0000 (21:57 +0300)]
Drop CONFIG_TI_COMPILER ifdefs

This experimental support for Texas Instruments C compiler was never
fully completed and it has not really been used in close to ten years,
so drop this to simply the header files.

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agoWPS: Avoid bogus static analyzer warning in ndef_parse_record()
Jouni Malinen [Fri, 17 Jul 2015 17:43:17 +0000 (20:43 +0300)]
WPS: Avoid bogus static analyzer warning in ndef_parse_record()

Use a local variable and check the record payload length validity before
writing it into record->payload_length in hopes of getting rid of a
bogus static analyzer warning. The negative return value was sufficient
to avoid record->payload_length being used, but that seems to be too
complex for some analyzers. (CID 122668)

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agoFST: Avoid using pointer to mgmt->u.action.u.fst_action
Jouni Malinen [Fri, 17 Jul 2015 17:37:15 +0000 (20:37 +0300)]
FST: Avoid using pointer to mgmt->u.action.u.fst_action

Typecasting &mgmt->u.action.u.fst_action to a struct pointer for various
FST Action frame payloads seemed to be triggering static analyzer
warnings about bounds checking since sizeof(mgmt->u.action.u.fst_action)
== 1 even though that is really a variable length structure. Try to
avoid this by calculating the pointer for the beginning of the frame
instead of variable length struct. (CID 125642)

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agoP2P: Clear p2p->ssid_set on flush
Jouni Malinen [Fri, 17 Jul 2015 17:32:13 +0000 (20:32 +0300)]
P2P: Clear p2p->ssid_set on flush

It was possible for the previously set SSID to remain in place between
test cases (e.g., in sequence "p2ps_connect_adv_go_persistent
p2p_set_ssid_postfix") and the P2P SSID postfix not getting used
properly. Make this less likely to occur by clearing the old SSID in
p2p_flush().

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agotests: FST session create OOM
Jouni Malinen [Fri, 17 Jul 2015 16:11:00 +0000 (19:11 +0300)]
tests: FST session create OOM

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agotests: FST send action OOM
Jouni Malinen [Fri, 17 Jul 2015 15:56:55 +0000 (18:56 +0300)]
tests: FST send action OOM

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agotests: FST AP configuration and OOM
Jouni Malinen [Fri, 17 Jul 2015 14:21:55 +0000 (17:21 +0300)]
tests: FST AP configuration and OOM

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agotests: FST protocol testing
Jouni Malinen [Fri, 17 Jul 2015 10:02:50 +0000 (13:02 +0300)]
tests: FST protocol testing

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agoFST: Remove the IE header len/size macros
Jouni Malinen [Fri, 17 Jul 2015 15:36:03 +0000 (18:36 +0300)]
FST: Remove the IE header len/size macros

These are confusing when the style used with the couple of FST IE checks
differs from the rest of hostapd/wpa_supplicant implementation.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agoFST: Clean up fst_group_update_ie()
Jouni Malinen [Fri, 17 Jul 2015 13:59:09 +0000 (16:59 +0300)]
FST: Clean up fst_group_update_ie()

None of the callers passed in cleaning_up == TRUE, so drop that unused
code path.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agoFST: Move fst_mbie_get_peer_addr() into fst_group.c
Jouni Malinen [Fri, 17 Jul 2015 13:55:08 +0000 (16:55 +0300)]
FST: Move fst_mbie_get_peer_addr() into fst_group.c

There is no need for this function to be an inline function in a header
file since it is used only within fst_group.c.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agoFST: Show FST IE update details in debug log
Jouni Malinen [Fri, 17 Jul 2015 13:25:09 +0000 (16:25 +0300)]
FST: Show FST IE update details in debug log

This makes it more convenient to debug FST IE updates.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agoFST: Clear hostapd fst_ies on FST-DETACH to avoid use of freed memory
Jouni Malinen [Fri, 17 Jul 2015 13:24:11 +0000 (16:24 +0300)]
FST: Clear hostapd fst_ies on FST-DETACH to avoid use of freed memory

This is needed in the corner case of FST-DETACH being used without
stopping the AP instance.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agoFST: Fix FST Action frame length validation
Jouni Malinen [Fri, 17 Jul 2015 10:00:17 +0000 (13:00 +0300)]
FST: Fix FST Action frame length validation

Commit 717333f4e4d027c69e7c1241dc124ef7d59a6c85 ('FST: Add the Fast
Session Transfer (FST) module') performed incorrect frame length
validation for Setup Request (did not remove 24+1 header from
consideration) and did not include payload validation for other FST
Action frames. Fix these by explicitly verifying that the payload of
these frames is sufficiently long before reading the values from there.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agoFT: Register RRB l2_packet only if FT-over-DS is enabled
Jouni Malinen [Thu, 16 Jul 2015 22:15:28 +0000 (01:15 +0300)]
FT: Register RRB l2_packet only if FT-over-DS is enabled

There is no need to waste resources for this packet socket if FT-over-DS
is disabled or when operating P2P GO or AP mode in wpa_supplicant.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agoDocument hostapd ft_over_ds configuration parameter
Jouni Malinen [Thu, 16 Jul 2015 22:13:07 +0000 (01:13 +0300)]
Document hostapd ft_over_ds configuration parameter

This had been forgotten from hostapd.conf.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agotests: WPA2-PSK-FT RRB protocol testing
Jouni Malinen [Thu, 16 Jul 2015 22:08:25 +0000 (01:08 +0300)]
tests: WPA2-PSK-FT RRB protocol testing

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agotests: hostapd global-to-local control interface redirection
Anton Nayshtut [Mon, 22 Jun 2015 08:27:13 +0000 (11:27 +0300)]
tests: hostapd global-to-local control interface redirection

This implements basic global-to-local control interface command
redirection tests.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agohostapd: Add global to local control interface redirection
Anton Nayshtut [Thu, 16 Jul 2015 10:29:29 +0000 (13:29 +0300)]
hostapd: Add global to local control interface redirection

This patch implements global to local control interface redirection in
the same way as it's done for wpa_supplicant. Any global control
interface command beginning with "IFNAME=..." will be routed to the
corresponding local control interface handler.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agohostapd: Add hostapd_ctrl_iface_receive_process()
Anton Nayshtut [Thu, 16 Jul 2015 10:19:49 +0000 (13:19 +0300)]
hostapd: Add hostapd_ctrl_iface_receive_process()

The newly introduced function will be used in followup commits to handle
requests redirected from the global control interface.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>