mech_eap.git
10 years agoP2P: Show P2P flag in BSS entries also based on Beacon frames
Jouni Malinen [Mon, 14 Oct 2013 16:22:09 +0000 (19:22 +0300)]
P2P: Show P2P flag in BSS entries also based on Beacon frames

It is possible that a P2P GO has been discovered through a non-P2P scan
that did not return P2P IE in Probe Response frames. To cover those
cases, check also Beacon frame (if received) for P2P IE.

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

10 years agoP2P: Do not drop P2P IEs from BSS table on non-P2P scans
Jouni Malinen [Fri, 27 Sep 2013 18:03:16 +0000 (21:03 +0300)]
P2P: Do not drop P2P IEs from BSS table on non-P2P scans

This could happen when non-P2P station interface runs a scan without P2P
IE in the Probe Request frame. P2P GO would reply to that with a Probe
Response that does not include P2P IE. Do not update the IEs in this BSS
entry to avoid such loss of information that may be needed for P2P
operations to determine group information.

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

10 years agoP2P: Make sure wait for the first client gets stopped
Jouni Malinen [Sun, 6 Oct 2013 05:15:28 +0000 (22:15 -0700)]
P2P: Make sure wait for the first client gets stopped

If a group was removed before the wait for the first client had timed
out and the client had not yet connected, p2p_go_wait_client could have
been left set and with that, scan operations could be unnecessarily
delayed. This fixes some undesired delays from commit
c1c0b35fea656345b672984910cc3b93938bc5e5.

Signed-hostap: Jouni Malinen <j@w1.fi>

10 years agoP2P: Clone 'disable_scan_offload' parameter for p2p group
Dmitry Shmidt [Wed, 2 Oct 2013 23:14:55 +0000 (16:14 -0700)]
P2P: Clone 'disable_scan_offload' parameter for p2p group

Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
10 years agoP2P: Increase Invitation Request timeouts
Swaroop Golti [Sun, 6 Oct 2013 01:14:33 +0000 (18:14 -0700)]
P2P: Increase Invitation Request timeouts

In noisy environment peer may take more time to send Invitation
Response so increase Invitation Response timeout to 500 ms in success
case and also increase Invitation Request action wait time to 500 ms.
This makes the Invitation Request case use the same timeout with GO
Negotiation.

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

10 years agoP2P: Clear p2p_group_formation and p2p_in_provisioning on group removal
Deepthi Gowri [Sun, 6 Oct 2013 00:54:52 +0000 (17:54 -0700)]
P2P: Clear p2p_group_formation and p2p_in_provisioning on group removal

Commit 41f853235fe1d1fad1acecc0ee5dfe81c872c6b2 extends group formation
timeout for the first data connection to complete and resets
p2p_go_group_formation_completed flag due to which p2p_in_provisioning
and p2p_group_formation flags are not cleared when
wpas_group_formation_completed() is called. This can result in both
station scan and p2p_find failures in the case where separate P2P group
interface is not used and the client does not complete 4-way handshake.
Fix this by clearing p2p_group_formation and p2p_in_provisioning when
such a P2P group is deleted.

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

10 years agoInclude Extended Capabilities element based on scan results
Arif Hussain [Wed, 2 Oct 2013 14:38:35 +0000 (07:38 -0700)]
Include Extended Capabilities element based on scan results

Add Extended Capabilities element to association request only if the AP
included this element in Beacon/Probe Response frames. This is a
workaround to address interoperability issues with some older APs that
do not seem to be able to handle Extended Capabilities element in
(Re)Association Request frames.

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

10 years agoP2P Extend postponing of concurrent scans for persistent GO
Deepthi Gowri [Wed, 2 Oct 2013 14:32:17 +0000 (07:32 -0700)]
P2P Extend postponing of concurrent scans for persistent GO

Update the p2p_go_wait_client timestamp in p2p_go_configured() to
address the case where the group is set up without the provisioning
step.

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

10 years agoTDLS: Do not start concurrent TDLS setup
Sunil Dutt [Mon, 30 Sep 2013 14:38:41 +0000 (17:38 +0300)]
TDLS: Do not start concurrent TDLS setup

A new TDLS request shall transmit TPK M1 frame with a unique INonce.
Thus a new explicit request would fail an ongoing TDLS negotiation with
the error "TDLS: FTIE SNonce in TPK M3 does not match with FTIE SNonce
used in TPK M1" if the peer happens to receive two M1 frames before an
M3 frame. Check for the ongoing negotiation with the peer and do not
start a new one if we are already in a setup negotiation with the peer.

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

10 years agoTDLS: Use wpa_tdls_disable_peer_link() in TPK M1 processing
Sunil Dutt [Mon, 30 Sep 2013 14:36:26 +0000 (17:36 +0300)]
TDLS: Use wpa_tdls_disable_peer_link() in TPK M1 processing

This function is used only with external setup, so this can cleaned up
to use simpler design.

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

10 years agoTDLS: Use wpa_tdls_disable_peer_link() to avoid peer search
Sunil Dutt [Mon, 30 Sep 2013 14:34:13 +0000 (17:34 +0300)]
TDLS: Use wpa_tdls_disable_peer_link() to avoid peer search

There is no need to go through the peer list when we already have a
pointer to the specific peer entry.

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

10 years agoTDLS: Use helper function for disable link operation
Sunil Dutt [Mon, 30 Sep 2013 14:23:23 +0000 (17:23 +0300)]
TDLS: Use helper function for disable link operation

This is called from number of locations and it is more efficient to use
a new helper function instead of wpa_tdls_disable_link() that would do
peer address search from the list of peers.

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

10 years agoTDLS: Clean up wpa_tdls_teardown_link() uses
Sunil Dutt [Mon, 30 Sep 2013 14:10:18 +0000 (17:10 +0300)]
TDLS: Clean up wpa_tdls_teardown_link() uses

Making this function be used only for external setup case simplifies the
implementation and makes core wpa_supplicant calls in ctrl_iface.c and
events.c consistent.

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

10 years agotests: Flush stdout after each status line print
Jouni Malinen [Sun, 29 Sep 2013 17:42:37 +0000 (20:42 +0300)]
tests: Flush stdout after each status line print

This makes it more convenient to follow live test execution status.

Signed-hostap: Jouni Malinen <j@w1.fi>

10 years agotests: Add test cases for WPA2-Enterprise
Jouni Malinen [Sun, 29 Sep 2013 17:35:26 +0000 (20:35 +0300)]
tests: Add test cases for WPA2-Enterprise

Signed-hostap: Jouni Malinen <j@w1.fi>

10 years agotests: Start RADIUS authentication server
Jouni Malinen [Sun, 29 Sep 2013 16:14:16 +0000 (19:14 +0300)]
tests: Start RADIUS authentication server

This can be used to run WPA2-Enterprise test cases.

Signed-hostap: Jouni Malinen <j@w1.fi>

10 years agohlr_auc_gw: Fix max_chal value validation
Jouni Malinen [Sun, 29 Sep 2013 15:47:26 +0000 (18:47 +0300)]
hlr_auc_gw: Fix max_chal value validation

This was supposed to be at maximum EAP_SIM_MAX_CHAL (3).

Signed-hostap: Jouni Malinen <j@w1.fi>

10 years agohlr_auc_gw: Add support for processing command line operations
Jouni Malinen [Sun, 29 Sep 2013 15:42:37 +0000 (18:42 +0300)]
hlr_auc_gw: Add support for processing command line operations

This allows hlr_auc_gw to be used to run a single operation without
having to use it as a server. This can be useful, e.g., for generating
GSM authentication triplets for external programs. For example:
./hlr_auc_gw -m hlr_auc_gw.milenage_db "SIM-REQ-AUTH 232010000000000"

Signed-hostap: Jouni Malinen <j@w1.fi>

10 years agoEAP-AKA server: Fix AUTS processing
Jouni Malinen [Sun, 29 Sep 2013 15:39:14 +0000 (18:39 +0300)]
EAP-AKA server: Fix AUTS processing

Commit 8a9f58f2cca92e5e362809ae4a531a4676c29888 ("EAP-AKA server: Store
permanent username in session data") broke AUTS processing by skipping
new authentication triplet fetch after having reported AUTS. Fix this by
started new full authentication sequence immediately after reporting
AUTS so that the updated parameters are available for the Challenge
message.

Signed-hostap: Jouni Malinen <j@w1.fi>

10 years agohlr_auc_gw: Update file comments to mention Milenage
Jouni Malinen [Sun, 29 Sep 2013 14:29:44 +0000 (17:29 +0300)]
hlr_auc_gw: Update file comments to mention Milenage

The notes about using only fixed GSM authentication triplets were not
really up-to-date with the implementation. Milenage and GSM-Milenage
were available for EAP-SIM, EAP-AKA, and EAP-AKA'.

Signed-hostap: Jouni Malinen <j@w1.fi>

10 years agotests: Auto detect group name
Jouni Malinen [Sun, 29 Sep 2013 13:41:17 +0000 (16:41 +0300)]
tests: Auto detect group name

Some older systems used admin group, but adm group seems to be more
common nowadays, so detect this automatically rather than assume admin
group is used.

Signed-hostap: Jouni Malinen <j@w1.fi>

10 years agotests: Merge start-p2p-concurrent.sh functionality into start.sh
Jouni Malinen [Sun, 29 Sep 2013 13:37:25 +0000 (16:37 +0300)]
tests: Merge start-p2p-concurrent.sh functionality into start.sh

Signed-hostap: Jouni Malinen <j@w1.fi>

10 years agotests: Add mechanism for test cases to indicate a skipped run
Jouni Malinen [Sun, 29 Sep 2013 13:21:42 +0000 (16:21 +0300)]
tests: Add mechanism for test cases to indicate a skipped run

This can be used by test cases that depend on some external component
that may not always be available to indicate clearly that a test case
was skipped rather than passed or failed.

Signed-hostap: Jouni Malinen <j@w1.fi>

10 years agotests: run-tests.py -L to print out list of test cases
Jouni Malinen [Sun, 29 Sep 2013 13:11:48 +0000 (16:11 +0300)]
tests: run-tests.py -L to print out list of test cases

This can be used to get a summary of all the available test cases.

Signed-hostap: Jouni Malinen <j@w1.fi>

10 years agotests: Adjust debug verbosity levels to get rid of extra info
Jouni Malinen [Sun, 29 Sep 2013 13:07:01 +0000 (16:07 +0300)]
tests: Adjust debug verbosity levels to get rid of extra info

Signed-hostap: Jouni Malinen <j@w1.fi>

10 years agotests: Document automated mac80211_hwsim test setup
Jouni Malinen [Sun, 29 Sep 2013 12:55:43 +0000 (15:55 +0300)]
tests: Document automated mac80211_hwsim test setup

This provides guidance on how to build the test setup, how to run the
tests, and how to add new test cases.

Signed-hostap: Jouni Malinen <j@w1.fi>

10 years agotests: Add test cases for P2P service discovery
Jouni Malinen [Sun, 29 Sep 2013 10:15:26 +0000 (13:15 +0300)]
tests: Add test cases for P2P service discovery

Signed-hostap: Jouni Malinen <j@w1.fi>

10 years agotests: Test GO functionality with legacy STAs
Jouni Malinen [Sun, 29 Sep 2013 09:42:05 +0000 (12:42 +0300)]
tests: Test GO functionality with legacy STAs

Signed-hostap: Jouni Malinen <j@w1.fi>

10 years agoDocument use of Linux capabilities instead of privileged process
Jouni Malinen [Sun, 29 Sep 2013 09:04:40 +0000 (12:04 +0300)]
Document use of Linux capabilities instead of privileged process

Linux capabilities cap_net_admin and cap_net_raw can be used to replace
need for running wpa_supplicant as a root process.

Signed-hostap: Jouni Malinen <j@w1.fi>

10 years agotests: Make run-tests.py command argument parser more flexible
Jouni Malinen [Sat, 28 Sep 2013 15:35:17 +0000 (18:35 +0300)]
tests: Make run-tests.py command argument parser more flexible

This allow -e, -r, and -f arguments to be given in any order.

Signed-hostap: Jouni Malinen <j@w1.fi>

10 years agotests: Write test case result summary into a file
Jouni Malinen [Sat, 28 Sep 2013 15:31:00 +0000 (18:31 +0300)]
tests: Write test case result summary into a file

This can be used to build statistics from test execution without having
to go through number of log files.

Signed-hostap: Jouni Malinen <j@w1.fi>

10 years agotests: Add test duration and time to PASS/FAIL reports
Jouni Malinen [Sat, 28 Sep 2013 15:20:32 +0000 (18:20 +0300)]
tests: Add test duration and time to PASS/FAIL reports

Signed-hostap: Jouni Malinen <j@w1.fi>

10 years agotests: Exit early if startup fails
Jouni Malinen [Sat, 28 Sep 2013 15:19:38 +0000 (18:19 +0300)]
tests: Exit early if startup fails

There is no point trying to go through the tests if hostapd and
wpa_supplicant processes cannot be started properly.

Signed-hostap: Jouni Malinen <j@w1.fi>

10 years agotests: Wait for driver scan state to clear between tests
Jouni Malinen [Sat, 28 Sep 2013 14:31:54 +0000 (17:31 +0300)]
tests: Wait for driver scan state to clear between tests

cfg80211/mac80211 seems to getting stuck with scans every now and then.
Check for this special state and delay return from reset() until the
driver has stopped the scan operation. This reduces likelihood of
failing multiple test cases in a row because of a single error.

Signed-hostap: Jouni Malinen <j@w1.fi>

10 years agoAdd driver status information to control interface
Jouni Malinen [Sat, 28 Sep 2013 14:19:30 +0000 (17:19 +0300)]
Add driver status information to control interface

STATUS-DRIVER command can now be used to fetch driver interface status
information. This is mainly for exporting low-level driver interface
information for debug purposes.

Signed-hostap: Jouni Malinen <j@w1.fi>

10 years agonl80211: Add some more debug prints for mgmt frame TX
Jouni Malinen [Sat, 28 Sep 2013 08:33:38 +0000 (11:33 +0300)]
nl80211: Add some more debug prints for mgmt frame TX

Signed-hostap: Jouni Malinen <j@w1.fi>

10 years agotests: Add a test case for P2P invitation
Jouni Malinen [Sat, 28 Sep 2013 09:09:40 +0000 (12:09 +0300)]
tests: Add a test case for P2P invitation

test_p2p_go_invite verifies that GO can invite a peer in a case where
the operating channel and peer's listen channel are different.

Signed-hostap: Jouni Malinen <j@w1.fi>

10 years agonl80211: Fix off-channel Action frame TX from GO with use_monitor
Jouni Malinen [Sat, 28 Sep 2013 09:05:03 +0000 (12:05 +0300)]
nl80211: Fix off-channel Action frame TX from GO with use_monitor

TX frequency gets lost when going through the monitor send MLME option
and this resulted in P2P operations like invitation from a GO failing
when the driver needs monitor socket, but would support offchannel TX.
Fix this by using frame_cmd path instead in case the monitor socket
would have been hit for action frame TX.

Signed-hostap: Jouni Malinen <j@w1.fi>

10 years agotests: Speed up stop-wifi.sh
Jouni Malinen [Sat, 28 Sep 2013 07:54:10 +0000 (10:54 +0300)]
tests: Speed up stop-wifi.sh

Split the long waits to iterations of shorter waits that can be stopped
based on processes having died.

Signed-hostap: Jouni Malinen <j@w1.fi>

10 years agotests: Add support for using Linux kernel tracing functionality
Jouni Malinen [Sat, 28 Sep 2013 07:36:56 +0000 (10:36 +0300)]
tests: Add support for using Linux kernel tracing functionality

run-all.sh and start.sh scripts can now take 'trace' command line
argument to request Linux tracing information from mac80211, cfg80211,
and wpa_supplicant to be recorded.

Signed-hostap: Jouni Malinen <j@w1.fi>

10 years agoGet rid of compiler warning in no-CONFIG_CTRL_IFACE builds
Jouni Malinen [Fri, 27 Sep 2013 20:42:37 +0000 (23:42 +0300)]
Get rid of compiler warning in no-CONFIG_CTRL_IFACE builds

no_ctrl_interface parsing was declared within ifdef CONFIG_CTRL_IFACE
block, so the parser function needs to be marked similarly.

Signed-hostap: Jouni Malinen <j@w1.fi>

10 years agoAdd no_ctrl_interface config param to clear ctrl_interface
Jouni Malinen [Fri, 27 Sep 2013 20:30:20 +0000 (23:30 +0300)]
Add no_ctrl_interface config param to clear ctrl_interface

This can be used to override previously set ctrl_interface value in a
way that clears the variable to NULL instead of empty string. The only
real use case for this is to disable per-interface ctrl_interface from
the additional control file (-I<file>) in case ctrl_interface was set in
the main configuration file. It should be noted that zero-length
ctrl_interface parameter can be used to initiate some control interface
backends, so simpler designs were not available for this.

The format of the new parameter is not exactly cleanest due to
configuration file parsing assumptions. For example:

ctrl_interface=....
no_ctrl_interface=

would end up with ctrl_interface=NULL.

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

10 years agoMake sure updated BSS entry does not get added twice to the list
Jouni Malinen [Fri, 27 Sep 2013 13:00:50 +0000 (16:00 +0300)]
Make sure updated BSS entry does not get added twice to the list

When the BSS table is being updated based on new scan results, a BSS
entry could end up getting added into last_scan_res list multiple times
if the scan results from the driver includes duplicated values. This
should not happen with driver_nl80211.c since it filter outs duplicates,
but in theory, other driver wrappers could indicate such scan results.
Anyway, it is safer to make sure this cannot happen by explicitly
verifying the last_scan_res list before adding an updated BSS entry
there. A duplicated entry in the list could potentially result in freed
memory being used if there is large enough number of BSSes in the scan
results to cause removal of old BSS entries.

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

10 years agoFix possible freed-memory use in BSS table updates
Jouni Malinen [Fri, 27 Sep 2013 12:47:09 +0000 (15:47 +0300)]
Fix possible freed-memory use in BSS table updates

If there are large number of BSSes in the scan results, BSS table update
could have added a BSS entry to the last_scan_res in a case where that
BSS entry got just deleted. This would happen only if there are more
than bss_max_count (by default 200) BSSes and if at least bss_max_count
of those BSSes are known (match a configured network). In such a case,
wpa_bss_add() could end up allocating a new BSS entry and return a
pointer to that entry even if it was the one that ended up getting freed
to keep the BSS table length within the limit. This could result in
freed memory being used and the process crashing (likely with segfault)
when trying to access information from that BSS entry.

Fix the issue by removing the oldest BSS entry before linking the new
entry to the table. This makes sure the newly added entry will never get
picked up as the one to be deleted immediately.

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

10 years agoP2P: Use group formation timeout on persistent group GO
Jouni Malinen [Thu, 26 Sep 2013 18:24:09 +0000 (21:24 +0300)]
P2P: Use group formation timeout on persistent group GO

Previously, GO considered the group to be fully re-invoked after
starting beaconing on successful invitation exchange. This would leave
the group running until idle timeout (which may not be enabled) or
explicit removal if the client fails to connect for any reason. Since
the client is expected to connect immediately after the invitation
exchange that ends with status=0 (i.e., either client initiated the
exchange or it responded with success), extend group formation timeout
to cover that period until the first successfully completed data
connection. This allows the GO to remove the group automatically if the
client devices does not connect within
P2P_MAX_INITIAL_CONN_WAIT_GO_REINVOKE (15) seconds.

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

10 years agoP2P: Extend group formation timeout on GO to first data connection
Jouni Malinen [Thu, 26 Sep 2013 17:32:44 +0000 (20:32 +0300)]
P2P: Extend group formation timeout on GO to first data connection

Previously, GO considered the group to be fully formed at the completed
of WPS provisioning step. This would leave the group running until idle
timeout (which may not be enabled) or explicit removal if the client
fails to connect for any reason. Since the client is expected to connect
immediately after the WPS provisioning step, extend group formation
timeout to cover that period until the first successfully completed data
connection. This allows the GO to remove the group automatically if the
client devices does not connect within P2P_MAX_INITIAL_CONN_WAIT_GO (10)
seconds.

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

10 years agoP2P: Remove P2P groups on process termination
Jouni Malinen [Wed, 25 Sep 2013 22:38:30 +0000 (01:38 +0300)]
P2P: Remove P2P groups on process termination

Killing the wpa_supplicant process or using TERMINATE ctrl_iface command
resulted in the process existing without cleaning up possibly added
dynamic P2P group interfaces. Clean this up by stopping each P2P group
before stopping eloop.

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

10 years agoRegister wpa_msg callback even if only global ctrl_iface is used
Jouni Malinen [Wed, 25 Sep 2013 22:31:32 +0000 (01:31 +0300)]
Register wpa_msg callback even if only global ctrl_iface is used

Previously, wpa_msg_register_cb() was called only from successful
completion of per-interface control interface initialization. This would
leave the callback unregistered in case only the global control
interface is used which would result in not delivering control interface
events on the global interface. Fix this by registering the callback
handler also from successful initialization of the global control
interface.

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

10 years agonl80211: Add more debug prints for send_mlme operations
Jouni Malinen [Wed, 25 Sep 2013 20:18:33 +0000 (23:18 +0300)]
nl80211: Add more debug prints for send_mlme operations

This makes it easier to debug issues in incorrect channel use in
management frame transmission.

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

10 years agonl80211: Reset nlmode to station on leaving IBSS
Jouni Malinen [Wed, 25 Sep 2013 20:14:41 +0000 (23:14 +0300)]
nl80211: Reset nlmode to station on leaving IBSS

Previously, IBSS mode (NL80211_IFTYPE_ADHOC) was left in drv->nlmode
when leaving IBSS. This causes issues for send_mlme() handler for P2P
Probe Response transmission in Listen state. Fix this by clearing nlmode
back to NL80211_IFTYPE_STATION on leaving IBSS so that following P2P
operations can be executed correctly. Previously, this was fixed only
when the next authentication/association attempt in station mode
occured.

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

10 years agoAvoid compiler warning with CONFIG_NO_STDOUT_DEBUG=y
Jouni Malinen [Wed, 25 Sep 2013 16:24:17 +0000 (19:24 +0300)]
Avoid compiler warning with CONFIG_NO_STDOUT_DEBUG=y

There is no need to use the bss variable which is used only within a
wpa_printf() call that can be conditionally removed from the build.

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

10 years agoAllow hostapd config file for dynamically added interface
Jouni Malinen [Wed, 25 Sep 2013 16:07:29 +0000 (19:07 +0300)]
Allow hostapd config file for dynamically added interface

This extends hostapd global control interface command "ADD" to use a
configuration file instead of requiring configuration to be built using
SET command.

The command format is now following:
ADD <ifname> <control path|config=<path to config>>

For example:

ADD wlan0 /var/run/hostapd
ADD wlan0 config=/tmp/hostapd.conf

When using the configuration file option, ctrl_interface parameter in
the file needs to be set to allow ENABLE command to be issued on the new
interface.

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

10 years agoDo not clear hostapd configuration parameters on disable-iface
Jouni Malinen [Wed, 25 Sep 2013 15:35:32 +0000 (18:35 +0300)]
Do not clear hostapd configuration parameters on disable-iface

There was a comment about the the cleanup steps being from
hostapd_cleanup_iface(). However, the operations that cleared some
security parameters do not seem to exist elsewhere and do not make sense
here. Remove them to avoid changing configuration with DISABLE followed
by ENABLE.

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

10 years agohostapd: Fix couple of deinit path cases to clear pointers
Jouni Malinen [Wed, 25 Sep 2013 15:14:13 +0000 (18:14 +0300)]
hostapd: Fix couple of deinit path cases to clear pointers

This fixes some issues where dynamic interface enable/disable cycles
could end up trying to free resources twice and crash the process while
doing so.

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

10 years agonl80211: Print more debug info on management frame RX information
Jouni Malinen [Wed, 25 Sep 2013 14:42:00 +0000 (17:42 +0300)]
nl80211: Print more debug info on management frame RX information

This can be useful in figuring out how drv->last_mgmt_freq gets set
to debug issues with P2P frames being sent on incorrect channel.

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

10 years agotests: Clear global monitor interface on dump_monitor()
Jouni Malinen [Wed, 25 Sep 2013 13:45:45 +0000 (16:45 +0300)]
tests: Clear global monitor interface on dump_monitor()

This avoids some issues with the global control interface socket
getting stuck with send buffer limit reached if test cases did not
use wait_global_event().

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

10 years agoRe-open ctrl_iface socket on some failure cases as a workaround
Jouni Malinen [Wed, 25 Sep 2013 13:23:11 +0000 (16:23 +0300)]
Re-open ctrl_iface socket on some failure cases as a workaround

If wpa_supplicant ctrl_iface clients are misbehaving and refusing to
read replies or event messages from wpa_supplicant, the single socket
used in wpa_supplicant to send messages can reach the maximum send
buffer limit. When that happens, no more responses to any client can be
sent. Work around this by closed and reopening the socket in case such a
failure state is detected. This is obviously not desirable since it
breaks existing connected sockets, but is needed to avoid leaving
wpa_supplicant completely unable to respond to any client. Cleaner fix
for this may require more considerable changes in the ctrl_iface design
to move to connection oriented design to allow each client to be handled
separately and unreachability to be detected more reliably.

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

10 years agoatheros: Compile fix for driver code not defining IEEE80211_APPIE_FRAME_WNM
Kyeyoon Park [Thu, 29 Aug 2013 23:02:16 +0000 (16:02 -0700)]
atheros: Compile fix for driver code not defining IEEE80211_APPIE_FRAME_WNM

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

10 years agoOpenSSL: Split OCSP peer_cert/peer_issuer debug output into parts
Jouni Malinen [Tue, 24 Sep 2013 13:36:06 +0000 (16:36 +0300)]
OpenSSL: Split OCSP peer_cert/peer_issuer debug output into parts

This makes it clearer which certificate was missing.

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

10 years agoHS 2.0: Allow printf format parsing with language:name strings
Kyeyoon Park [Wed, 25 Sep 2013 10:03:16 +0000 (13:03 +0300)]
HS 2.0: Allow printf format parsing with language:name strings

This allows Hotspot 2.0 and Interworking strings that use language:name
string (e.g., venue_name) to be encoded using printf format to enter
special characters like newline.

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

10 years agoFix wpa_config_parse_string() to null terminate printf decoded values
Kyeyoon Park [Wed, 25 Sep 2013 09:34:35 +0000 (12:34 +0300)]
Fix wpa_config_parse_string() to null terminate printf decoded values

printf_decode() fills in a binary buffer and returns the length of
the written data. This did not use null termination since initial
use cases used the output as a binary value. However, Hotspot 2.0
cred block values are also using this for parsing strings. Those
cases could end up without proper null termination depending on what
os_malloc() ends up getting as the memory buffer. Fix these and make
printf_decode() more convenient by forcing the output buffer to be
null terminated.

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

10 years agoFix language string length validation in parse_lang_string()
Jouni Malinen [Wed, 25 Sep 2013 09:53:00 +0000 (12:53 +0300)]
Fix language string length validation in parse_lang_string()

The language string length needs to be validated to hit into the
three-octet lang field in struct hostapd_lang_string before copying
this. Invalid configuration entries in hostapd.conf could have resulted
in buffer overflow.

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

10 years agoSimplify ctrl_iface sendto() use
Jouni Malinen [Mon, 23 Sep 2013 14:52:10 +0000 (17:52 +0300)]
Simplify ctrl_iface sendto() use

Prepare reply buffer first for all cases and then use a single sendto()
call instead of three calls depending on reply type. This allows simpler
error handling for control interface send operations.

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

10 years agoClear frequency list on empty value
Jouni Malinen [Mon, 23 Sep 2013 13:22:16 +0000 (16:22 +0300)]
Clear frequency list on empty value

Allow current frequency list of be cleared with an empty string value.

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

10 years agoMake scan_freq field to be saved by save_config
Masashi Honma [Mon, 23 Sep 2013 13:06:06 +0000 (16:06 +0300)]
Make scan_freq field to be saved by save_config

Signed-hostap: Masashi Honma <masashi.honma@gmail.com>

10 years agoP2P: Prefer 20 MHz operating channels on 5 GHz band over 2.4 GHz
Hardik Kantilal Patel [Sun, 15 Sep 2013 01:09:48 +0000 (18:09 -0700)]
P2P: Prefer 20 MHz operating channels on 5 GHz band over 2.4 GHz

When no other user preference is specified, opt to use an operating
channel that allows 5 GHz band to be used rather than 2.4 GHz.
Previously, this was already done in practice for HT40 channels since no
such channel is enabled for P2P on 2.4 GHz. This commit extends this to
apply 5 GHz preference for 20 MHz channels as well.

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

10 years agoDrop EAP packet with code 10 before EAPOL state machine processing
Sunil Dutt [Sun, 15 Sep 2013 18:29:25 +0000 (11:29 -0700)]
Drop EAP packet with code 10 before EAPOL state machine processing

H3C WA2620i-AGN AP may send an EAP packet with an undefined EAP code
10 after successful EAP authentication which restarts the EAPOL
state machine. Drop such frames with this unrecognized code without
advancing the EAPOL supplicant or EAP peer state machines to avoid
interoperability issues with the AP.

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

10 years agoUse configured sched_scan interval for the PNO scan
Kamath Vinayak [Sun, 15 Sep 2013 22:21:42 +0000 (15:21 -0700)]
Use configured sched_scan interval for the PNO scan

The interval for the PNO scan did not use the configured sched_scan
interval. This commit addresses the same by using the configured value
or the default of 10 seconds if configuration parameter is not used.

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

10 years agoTDLS: Do not modify RNonce for an TPK M1 frame with same INonce
Sunil Dutt [Sun, 15 Sep 2013 19:09:40 +0000 (12:09 -0700)]
TDLS: Do not modify RNonce for an TPK M1 frame with same INonce

There is no point in updating the RNonce for every obtained TPK M1 frame
(e.g., retransmission due to timeout) with the same INonce (SNonce in
FTIE). Update RNonce only if a TPK M1 is received with a different
INonce (new TDLS session) to avoid issues with two setup exchanges
getting mixed and exchange failing due to mismatching nonces ("TDLS:
FTIE ANonce in TPK M3 does not match with FTIE ANonce used in TPK M2").

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

10 years agoTDLS: Disable the created link on a failed TDLS handshake
Sunil Dutt [Sun, 15 Sep 2013 18:51:00 +0000 (11:51 -0700)]
TDLS: Disable the created link on a failed TDLS handshake

Clear the peer information and disable the created link on a
failed TDLS setup negotiation. This is needed to avoid leaving
TDLS setup pending and to return to the AP path in case anything
goes wrong during the setup attempt.

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

10 years agoWPS: Ignore PBC-to-PIN change from M1 to M2 as a workaround
Jouni Malinen [Sat, 14 Sep 2013 19:02:33 +0000 (12:02 -0700)]
WPS: Ignore PBC-to-PIN change from M1 to M2 as a workaround

Some APs may incorrectly change Device Password ID from PBC in M1 to
Default PIN in M2 even when they are ready to continue with PBC. This
behavior used to work with earlier implementation in wpa_supplicant, but
commit b4a17a6ea74b2ffba082e05c84730e979513042c started validating this
as part of a change that is needed to support NFC configuration method.

While this kind of AP behavior is against the WSC specification and
there could be potential use cases for moving from PBC to PIN, e.g., in
case of PBC session overlap, it is justifiable to work around this issue
to avoid interoperability issues with deployed APs. There are no known
implementations of PBC-to-PIN change from M1 to M2, so this should not
reduce available functionality in practice.

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

10 years agoPrint ctrl_iface sendto() failures into debug log
Jouni Malinen [Wed, 11 Sep 2013 03:17:07 +0000 (20:17 -0700)]
Print ctrl_iface sendto() failures into debug log

This makes it easier to debug issues with control interface operations
failing.

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

10 years agoP2P: Cancel group formation timeout on client connection
Jouni Malinen [Sat, 14 Sep 2013 17:39:50 +0000 (10:39 -0700)]
P2P: Cancel group formation timeout on client connection

It was possiblle for the group formation timeout to be left running even
after the P2P Client connected to the group if the WPS provisioning step
was not completed cleanly (e.g., due to WSC_Done not getting received
from the client). There is no need to remove the group in such case due
to the initial group formation timeout, so work around this by removing
that timeout on data connection.

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

10 years agoP2P: Fix operation channel configuration update
Jouni Malinen [Tue, 10 Sep 2013 05:14:27 +0000 (22:14 -0700)]
P2P: Fix operation channel configuration update

There was already a CFG_CHANGED_P2P_OPER_CHANNEL handler function, but
this flag was not set when the p2p_oper_reg_class or p2p_oper_channel
parameters were changed.

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

10 years agoP2P: Fix crash when failed to create GO interface aosp-kk-from-upstream
Vinay Krishna Eranna [Tue, 3 Sep 2013 08:17:21 +0000 (11:17 +0300)]
P2P: Fix crash when failed to create GO interface

wpa_supplicant crashes if driver configuration for AP mode interface
configuration fails after group negotiation. This is because of a
regression from commit 1075b2957169d8f9d6dddd7679339c751dc9515b that
ends up freeing the wpa_s instance from within
wpa_supplicant_create_ap() without the caller knowing.

Fix this by using an eloop timeout to free remove the P2P group so that
wpa_supplicant_create_ap() and especially wpa_supplicant_associate()
callers do not need to know about interface getting possibly removed. In
addition, move the P2P specific code into p2p_supplicant.c where it
really belongs. This allows the already existing group formation timeout
to be used by reducing the timeout to zero.

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

10 years agotests: Check wpa_supplicant connection after reset
Jouni Malinen [Tue, 3 Sep 2013 09:13:25 +0000 (12:13 +0300)]
tests: Check wpa_supplicant connection after reset

Some test runs have resulted in wpa_supplicant being unresponsive or
very slow on the control interface. Check for that type of issues as
part of the reset sequence that is done between each test case.

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

10 years agoWPS NFC: Fix build without CONFIG_AP=y
Jouni Malinen [Tue, 3 Sep 2013 08:27:24 +0000 (11:27 +0300)]
WPS NFC: Fix build without CONFIG_AP=y

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

10 years agoSAE: Fix build without CONFIG_AP=y
Jouni Malinen [Tue, 3 Sep 2013 08:25:29 +0000 (11:25 +0300)]
SAE: Fix build without CONFIG_AP=y

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

10 years agoP2P: Remove group from timeout on PSK failure
Jouni Malinen [Mon, 2 Sep 2013 13:33:42 +0000 (16:33 +0300)]
P2P: Remove group from timeout on PSK failure

Avoid potential issues with removing a P2P group on PSK failure directly
from the wpa_supplicant_event() call since the caller (in driver_*.c)
may not be prepared for the interface disappearing at that point in
time.

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

10 years agotests: Add a test case for invitation after client removal
Jouni Malinen [Sun, 1 Sep 2013 17:47:37 +0000 (20:47 +0300)]
tests: Add a test case for invitation after client removal

test_persistent_group_invite_removed_client verifies that a client
that is removed from a group can rejoin based on new invitation.

Signed-hostap: Jouni Malinen <j@w1.fi>

10 years agotests: Use a helper function for waiting session termination
Jouni Malinen [Sun, 1 Sep 2013 16:30:08 +0000 (19:30 +0300)]
tests: Use a helper function for waiting session termination

Signed-hostap: Jouni Malinen <j@w1.fi>

10 years agotests: Add test cases for persistent P2P groups
Jouni Malinen [Sun, 1 Sep 2013 16:24:12 +0000 (19:24 +0300)]
tests: Add test cases for persistent P2P groups

Signed-hostap: Jouni Malinen <j@w1.fi>

10 years agotests: Extend test_autogo_2cli to test client removal
Jouni Malinen [Sun, 1 Sep 2013 14:58:17 +0000 (17:58 +0300)]
tests: Extend test_autogo_2cli to test client removal

Signed-hostap: Jouni Malinen <j@w1.fi>

10 years agotests: Add test cases for per-STA PSK in P2P group
Jouni Malinen [Sun, 1 Sep 2013 08:56:55 +0000 (11:56 +0300)]
tests: Add test cases for per-STA PSK in P2P group

Signed-hostap: Jouni Malinen <j@w1.fi>

10 years agoP2P: Add event messages for possible PSK failures on P2P groups
Jouni Malinen [Sun, 1 Sep 2013 18:28:16 +0000 (21:28 +0300)]
P2P: Add event messages for possible PSK failures on P2P groups

It is possible for the GO of a persistent group to change the PSK or
remove a client when per-client PSKs are used and this can happen
without the SSID changing (i.e., the group is still valid, but just not
for a specific client). If the client side of such persistent group ends
up trying to use an invalidated persistent group information, the
connection will fail in 4-way handshake. A new WPS provisioning step is
needed to recover from this.

Detect this type of case based on two 4-way handshake failures when
acting as a P2P client in a persistent group. A new
"P2P-PERSISTENT-PSK-FAIL id=<persistent group id>" event is used to
indicate when this happens. This makes it easier for upper layers to
remove the persistent group information with "REMOVE_NETWORK <persistent
group id>" if desired (e.g., based on user confirmation).

In addition to indicating the error cases for persistent groups, all
this type of PSK failures end up in the client removing the group with
the new reason=PSK_FAILURE information in the P2P-GROUP-REMOVED event.

Signed-hostap: Jouni Malinen <j@w1.fi>

10 years agoP2P: Document per-client keys and p2p_remove_client
Jouni Malinen [Sun, 1 Sep 2013 14:54:10 +0000 (17:54 +0300)]
P2P: Document per-client keys and p2p_remove_client

Signed-hostap: Jouni Malinen <j@w1.fi>

10 years agoP2P: Do not store duplicate PSK entries for the same device
Jouni Malinen [Sun, 1 Sep 2013 14:47:05 +0000 (17:47 +0300)]
P2P: Do not store duplicate PSK entries for the same device

If a client joins a P2P group multiple times, replace the previous
per-client PSK entry instead of adding a new entry each time.

Signed-hostap: Jouni Malinen <j@w1.fi>

10 years agoP2P: Add a command for removing a client from all groups
Jouni Malinen [Sun, 1 Sep 2013 14:37:22 +0000 (17:37 +0300)]
P2P: Add a command for removing a client from all groups

The new control interface command P2P_REMOVE_CLIENT <P2P Device
Address|iface=Address> can now be used to remove the specified client
from all groups (ongoing and persistent) in which the local device is a
GO. This will remove any per-client PSK entries and deauthenticate the
device.

Signed-hostap: Jouni Malinen <j@w1.fi>

10 years agoP2P: Maintain list of per-client PSKs for persistent groups
Jouni Malinen [Sun, 1 Sep 2013 10:40:33 +0000 (13:40 +0300)]
P2P: Maintain list of per-client PSKs for persistent groups

Record all generated per-client PSKs in the persistent group network
block and configure these for the GO Authenticator whenever re-starting
the persistent group. This completes per-client PSK support for
persistent groups.

Signed-hostap: Jouni Malinen <j@w1.fi>

10 years agoP2P: Select PSK based on Device Address instead of Interface Address
Jouni Malinen [Sun, 1 Sep 2013 08:30:26 +0000 (11:30 +0300)]
P2P: Select PSK based on Device Address instead of Interface Address

When using per-device PSKs, select the PSK based on the P2P Device
Address of the connecting client if that client is a P2P Device. This
allows the P2P Interface Address to be changed between P2P group
connections which may happen especially when using persistent groups.

Signed-hostap: Jouni Malinen <j@w1.fi>

10 years agoP2P: Make peer's P2P Device Address available to authenticator
Jouni Malinen [Sun, 1 Sep 2013 08:05:19 +0000 (11:05 +0300)]
P2P: Make peer's P2P Device Address available to authenticator

This can be used to implement per-device PSK selection based on the
peer's P2P Device Address instead of P2P Interface Address.

Signed-hostap: Jouni Malinen <j@w1.fi>

10 years agoP2P: Store P2P Device Address in per-device PSK records
Jouni Malinen [Sun, 1 Sep 2013 07:47:34 +0000 (10:47 +0300)]
P2P: Store P2P Device Address in per-device PSK records

This makes the P2P Device Address of the Enrollee available with the PSK
records to allow P2P Device Address instead of P2P Interface Address to
be used for finding the correct PSK.

Signed-hostap: Jouni Malinen <j@w1.fi>

10 years agoP2P: Allow per-device PSK to be assigned
Jouni Malinen [Sun, 1 Sep 2013 07:08:30 +0000 (10:08 +0300)]
P2P: Allow per-device PSK to be assigned

"wpa_cli p2p_set per_sta_psk <0/1>" can now be used to disable/enable
use of per-device PSKs in P2P groups. This is disabled by default.
When enabled, a default passphrase is still generated by the GO for
legacy stations, but all P2P and non-P2P devices using WPS will get
a unique PSK.

This gives more protection for the P2P group by preventing clients from
being able to derive the unicast keys used by other clients. This is
also a step towards allowing specific clients to be removed from a group
reliably without having to tear down the full group to do so.

Signed-hostap: Jouni Malinen <j@w1.fi>

10 years agowpa_cli: Add tab completion for p2p_set field values
Jouni Malinen [Sat, 31 Aug 2013 17:58:35 +0000 (20:58 +0300)]
wpa_cli: Add tab completion for p2p_set field values

Signed-hostap: Jouni Malinen <j@w1.fi>

10 years agoP2P: Stop listen state when listen-only duration is over
Syed Asifful Dayyan Rafiuddeen [Sat, 31 Aug 2013 15:09:15 +0000 (18:09 +0300)]
P2P: Stop listen state when listen-only duration is over

Even after listen duration is over, P2P module remained in
P2P_LISTEN_ONLY state, which is blocking station mode scans. Fix this by
stopping P2P listen explicitly to update p2p_state to IDLE when listen
duration expires.

Signed-hostap: Syed Asifful Dayyan <syedd@broadcom.com>

10 years agotests: Make test_autogo validate group removal event on client
Jouni Malinen [Sat, 31 Aug 2013 14:59:16 +0000 (17:59 +0300)]
tests: Make test_autogo validate group removal event on client

Use test_autogo to verify that P2P client is able to notice explicit
group session termination message from the GO. This would have caught
the regression in processing P2P deauthentication notifications.

Signed-hostap: Jouni Malinen <j@w1.fi>

10 years agowpa_cli: Allow first DISCONNECTED event to be reported
Jouni Malinen [Sat, 31 Aug 2013 14:27:20 +0000 (17:27 +0300)]
wpa_cli: Allow first DISCONNECTED event to be reported

wpa_cli filters out extra DISCONNECTED events from action scripts. This
ended up filtering out the first real DISCONNECT event in case wpa_cli
was started when wpa_supplicant was in connected state. Change wpa_cli
to allow the first disconnection event to be reported to the action
script in such case.

Signed-hostap: Jouni Malinen <j@w1.fi>

10 years agoDisallow WEP configuration in WPA network
Jouni Malinen [Sat, 31 Aug 2013 14:18:45 +0000 (17:18 +0300)]
Disallow WEP configuration in WPA network

Some drivers fail to work if WEP keys are configured in a WPA network.
To avoid potentially confusing error cases, reject hostapd configuration
that enables WPA and includes parameters that would imply that WEP keys
would be set.

Signed-hostap: Jouni Malinen <j@w1.fi>

10 years agoD-Bus: Fix per-iface object unregistration on not existing objects
Jouni Malinen [Sat, 31 Aug 2013 13:46:24 +0000 (16:46 +0300)]
D-Bus: Fix per-iface object unregistration on not existing objects

If the private data for an object is not found, do not try to unregister
that object to avoid D-Bus errors.

Signed-hostap: Jouni Malinen <j@w1.fi>

10 years agoD-Bus: Do not send network notification for all P2P groups
Jouni Malinen [Sat, 31 Aug 2013 13:44:42 +0000 (16:44 +0300)]
D-Bus: Do not send network notification for all P2P groups

Previously, network added event was skipping during group formation.
However, this did not necessarily catch all cases of temporary P2P
network blocks. Check ssid->p2p_group to make this behavior more
consistent by avoiding all P2P groups.

Signed-hostap: Jouni Malinen <j@w1.fi>