]> git.ipfire.org Git - thirdparty/hostap.git/log
thirdparty/hostap.git
5 years agodbus: Export roam time, roam complete, and session length
Matthew Wang [Wed, 20 Jun 2018 23:42:45 +0000 (16:42 -0700)] 
dbus: Export roam time, roam complete, and session length

Add new Interface properties "RoamTime", "RoamComplete", and
"SessionLength". "RoamTime" carries the roam time of the most recent
roam in milliseconds. "RoamComplete" carries True or False corresponding
to the success status of the most recent roam. "SessionLength" carries
the number of milliseconds corresponding to how long the connection to
the last AP was before a roam or disconnect happened.

Signed-off-by: Matthew Wang <matthewmwang@chromium.org>
5 years agotests: AP VLAN with WPA2-Enterprise and local file setting VLAN IDs
Jouni Malinen [Wed, 2 Jan 2019 21:50:35 +0000 (23:50 +0200)] 
tests: AP VLAN with WPA2-Enterprise and local file setting VLAN IDs

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agoAllow remote RADIUS authentication with local VLAN management
Nils Nieuwejaar [Wed, 30 May 2018 21:09:01 +0000 (14:09 -0700)] 
Allow remote RADIUS authentication with local VLAN management

The documentation in the hostapd.conf file says that the dynamic_vlan
variable is used to control whether VLAN assignments are accepted from a
RADIUS server. The implication seems to be that a static VLAN assignment
will come from the accept_mac_file if dynamic_vlan is set to 0, and a
dynamic assignment will come from the RADIUS server if dynamic_vlan is
set to 1. Instead, I'm seeing that the static settings from the
accept_mac_file are ignored if dynamic_vlan is set to 0, but used if
dynamic_vlan is set to 1. If dynamic_vlan is set to 1 and the RADIUS
server does not provide a VLAN, then the accept_mac_file assignment is
overridden and the STA is assigned to the default non-VLANed interface.

If my understanding of the expected behavior is correct, then I believe
the problem is in ap_sta_set_vlan(). That routine checks the
dynamic_vlan setting, but has no way of determining whether the incoming
vlan_desc is static (i.e., from accept_mac_file) or dynamic (i.e., from
a RADIUS server).

I've attached a patch that gets hostapd working as I believe it's meant
to, and updates the documentation to make the implicit behavior
explicit.

The functional changes are:

- hostapd_allowed_address() will always extract the vlan_id from the
  accept_macs file. It will not update the vlan_id from the RADIUS cache
  if dynamic_vlan is DISABLED.

- hostapd_acl_recv_radius() will not update the cached vlan_id if
  dynamic_vlan is DISABLED.

- ieee802_1x_receive_auth() will not update the vlan_id if dynamic_vlan
  is DISABLED.

More cosmetic:

Most of the delta is just moving code out of ieee802_1x_receive_auth()
into a new ieee802_1x_update_vlan() routine. While I initially did this
because the new DISABLED check introduced excessive indentation, it has
the added advantage of eliminating the vlan_description allocation and
os_memset() call for all DYNAMIC_VLAN_DISABLED configs.

I've done a couple rounds of review offline with Michael Braun (who has
done much of the work in this part of the code) and incorporated his
feedback.

If dynamic_vlan=0 (disabled), vlan assignments will be managed using the
local accept_mac_file ACL file, even if a RADIUS server is being used
for user authentication. This allows us to manage users and devices
independently.

Signed-off-by: Nils Nieuwejaar <nils.nieuwejaar@gmail.com>
5 years agoUse a helper function for checking Extended Capabilities field
Jouni Malinen [Wed, 2 Jan 2019 15:56:41 +0000 (17:56 +0200)] 
Use a helper function for checking Extended Capabilities field

The new ieee802_11_ext_capab() and wpa_bss_ext_capab() functions can be
used to check whether a specific extended capability bit is set instead
of having to implement bit parsing separately for each need.

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agotests: [UTF-8] flag in scan results
Jouni Malinen [Wed, 2 Jan 2019 15:38:27 +0000 (17:38 +0200)] 
tests: [UTF-8] flag in scan results

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agoAdd [FST] and [UTF-8] flags to BSS command output
Jouni Malinen [Wed, 2 Jan 2019 15:34:53 +0000 (17:34 +0200)] 
Add [FST] and [UTF-8] flags to BSS command output

These flags were used in SCAN_RESULTS command output, but not BSS. Make
these consistent by adding the flags to BSS as well.

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agoShow [UTF-8] flag if the SSID is reported as UTF-8
Jouke Witteveen [Mon, 25 Jun 2018 20:24:15 +0000 (22:24 +0200)] 
Show [UTF-8] flag if the SSID is reported as UTF-8

Signed-off-by: Jouke Witteveen <j.witteveen@gmail.com>
5 years agocrypto internal: Make MD4 PADDING array const
Mikael Kanstrup [Tue, 19 Jun 2018 11:52:29 +0000 (13:52 +0200)] 
crypto internal: Make MD4 PADDING array const

The PADDING array used when adding padding bits in MD4 never change
so can be made const. Making it const puts the array in .rodata
section and can save a few bytes of RAM for systems running without
virtual memory.

Signed-off-by: Mikael Kanstrup <mikael.kanstrup@sony.com>
5 years agoRRM: Update own neighbor report on channel switch
Markus Theil [Mon, 20 Aug 2018 12:20:44 +0000 (14:20 +0200)] 
RRM: Update own neighbor report on channel switch

After performing a successful channel switch, the AP should update its
own neighbor report element, so do this from src/ap/drv_callbacks.c
after a successful switch.

Signed-off-by: Markus Theil <markus.theil@tu-ilmenau.de>
5 years agoRRM: Move neighbor report functions
Markus Theil [Mon, 20 Aug 2018 12:20:44 +0000 (14:20 +0200)] 
RRM: Move neighbor report functions

Move functions corresponding to neighbor report elements to
src/ap/neighbor_db.[c,h] in preparation to using them after channel
switch from src/ap/drv_callbacks.c.

Signed-off-by: Markus Theil <markus.theil@tu-ilmenau.de>
5 years agohostapd: Fix a typo in function name
Jouni Malinen [Wed, 2 Jan 2019 14:40:34 +0000 (16:40 +0200)] 
hostapd: Fix a typo in function name

This was supposed to use "hostapd_" prefix.

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agocrypto: Reduce the size of sha512_compress() stack frame
Ilan Peer [Wed, 22 Aug 2018 16:49:08 +0000 (19:49 +0300)] 
crypto: Reduce the size of sha512_compress() stack frame

The function sha512_compress() has a local variable that consumes 640
bytes. This is very heavy for embedded devices that have limited stack
resources. Handle this by replacing the static allocation with a dynamic
one.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
5 years agohostapd_cli: Add option to send beacon report request
Avraham Stern [Wed, 22 Aug 2018 13:46:21 +0000 (16:46 +0300)] 
hostapd_cli: Add option to send beacon report request

This new 'req_beacon' command is useful for testing.

Signed-off-by: Avraham Stern <avraham.stern@intel.com>
5 years agotests: Beacon report last frame indication
Avraham Stern [Wed, 22 Aug 2018 13:46:20 +0000 (16:46 +0300)] 
tests: Beacon report last frame indication

Verify that the beacon report contains the last beacon report
indication subelement when requested in the beacon request.

Signed-off-by: Avraham Stern <avraham.stern@intel.com>
5 years agoRRM: Support for Last Beacon Report Indication subelement
Avraham Stern [Wed, 22 Aug 2018 13:46:19 +0000 (16:46 +0300)] 
RRM: Support for Last Beacon Report Indication subelement

IEEE P802.11-REVmd/D2.0, 9.4.2.20.7 (Beacon request) and 9.4.2.21.7
(Beacon report) add the Last Beacon Report Indication subelement to
Beacon Request and Beacon Report elements.

Add the Last Beacon Report Indication subelement to all Beacon Report
elements if the Beacon Request indicated that this subelement is
requested.

Signed-off-by: Avraham Stern <avraham.stern@intel.com>
5 years agotests: Beacon report frame body fragmentation
Avraham Stern [Wed, 22 Aug 2018 13:46:18 +0000 (16:46 +0300)] 
tests: Beacon report frame body fragmentation

Verify that when the frame body subelement causes the
measurement report element to exceed the maximum element size,
the beacon report is fragmented and the frame body fragment ID
subelement is added with the correct fragment number.

Signed-off-by: Avraham Stern <avraham.stern@intel.com>
5 years agotests: Update rrm_beacon_req_table_rsne to expect full RSNE
Jouni Malinen [Wed, 2 Jan 2019 14:25:31 +0000 (16:25 +0200)] 
tests: Update rrm_beacon_req_table_rsne to expect full RSNE

Now that wpa_supplicant is sending out full RSNE instead of the
fragmented one, update this test case to match.

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agoRRM: Add support for beacon report fragmentation
Avraham Stern [Wed, 22 Aug 2018 13:46:17 +0000 (16:46 +0300)] 
RRM: Add support for beacon report fragmentation

When the frame body subelement would cause the measurement report
element to exceed the maximum element size, the frame body subelement
used to be truncated. In addition, some elements were always truncated
in order to keep the reported frame body short (e.g. RSN IE).

Alternatively, IEEE P802.11-REVmd/D2.0, 9.4.2.21.7 extension to Beacon
reporting can be used: The frame body subelement is fragmented across
multiple beacon report elements, and the reported frame body fragment ID
subelement is added.

Use beacon report fragmentation instead of truncating the frame body
as this method gives the AP a more complete information about the
reported APs.

Signed-off-by: Avraham Stern <avraham.stern@intel.com>
5 years agotests: D-Bus P2P peer information - VSIE
Jouni Malinen [Wed, 2 Jan 2019 11:00:33 +0000 (13:00 +0200)] 
tests: D-Bus P2P peer information - VSIE

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agodbus: Add vendor specific information element in peer properties
Nishant Chaprana [Fri, 16 Feb 2018 12:02:39 +0000 (17:32 +0530)] 
dbus: Add vendor specific information element in peer properties

Make vendor specific information elements (VSIE) available in peer
properties, so that VSIE of a specific peer can be retrieved using
peer's object path.

Signed-off-by: Nishant Chaprana <n.chaprana@samsung.com>
5 years agotests: Fix p2p_ext_discovery_go to write to logger, not stdout
Jouni Malinen [Wed, 2 Jan 2019 10:39:00 +0000 (12:39 +0200)] 
tests: Fix p2p_ext_discovery_go to write to logger, not stdout

The error case debug print should go to logger.

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agotests: Data connectivity after REAUTHENTICATE
Jouni Malinen [Wed, 2 Jan 2019 10:28:16 +0000 (12:28 +0200)] 
tests: Data connectivity after REAUTHENTICATE

Verify that not updating GTK (i.e., only update PTK) in the driver does
not break connectivity. This case is different after the check for
"already in-use GTK" and rejection of GTK reinstallation.

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agoeloop: Fix kqueue event deletion filter
Jouni Malinen [Wed, 2 Jan 2019 10:11:52 +0000 (12:11 +0200)] 
eloop: Fix kqueue event deletion filter

EV_SET() for EV_ADD used a specific filter type, but that same filter
type was not provided to the matching EV_DELETE case. This resulted in
the kernel rejecting the deletion with "Invalid argument". Fix this by
setting the same filter type for both operations.

Fixes: f9982b321222 ("Implement kqueue(2) support via CONFIG_ELOOP_KQUEUE")
Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agoeloop: Fix fd_table allocation for epoll and kqueue
Jouni Malinen [Wed, 2 Jan 2019 09:57:00 +0000 (11:57 +0200)] 
eloop: Fix fd_table allocation for epoll and kqueue

The previous implementation did not work if the first registered socket
had fd > 16 or if the fd was more than double the largest value used in
previous registrations. Those cases could result in too small a memory
allocation being used and writes/reads beyond the end of that buffer.

This fix is applicable to CONFIG_ELOOP_EPOLL=y and CONFIG_ELOOP_KQUEUE=y
builds.

Fixes: f0356ec85c46 ("eloop: Add epoll option for better performance")
Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agocrypto: Add option to use getrandom()
Lubomir Rintel [Mon, 18 Sep 2017 12:58:07 +0000 (14:58 +0200)] 
crypto: Add option to use getrandom()

According to random(4) manual, /dev/random is essentially deprecated on
Linux for quite some time:

"The /dev/random interface is considered a legacy interface, and
/dev/urandom is preferred and sufficient in all use cases, with the
exception of applications which require randomness during early boot
time; for these applications, getrandom(2) must be used instead, because
it will block until the entropy pool is initialized."

An attempt to use it would cause unnecessary blocking on machines
without a good hwrng even when it shouldn't be needed. Since Linux 3.17,
a getrandom(2) call is available that will block only until the
randomness pool has been seeded.

It is probably not a good default yet as it requires a fairly recent
kernel and glibc (3.17 and 2.25 respectively).

Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
5 years agowpa_ctrl: Make wpa_cli ping/pong work more reliably
Ben Greear [Mon, 4 Dec 2017 17:18:26 +0000 (09:18 -0800)] 
wpa_ctrl: Make wpa_cli ping/pong work more reliably

In 2013 or so, IFNAME=foo was prepended to at least the Unix socket
communication from wpa_supplicant to wpa_cli. This broke the (fragile)
logic that made ping/pong work more often when wpa_supplicant is busy
sending logging info to wpa_cli.

Adding check for IFNAME=foo makes this work better.

Signed-off-by: Ben Greear <greearb@candelatech.com>
5 years agoOpenSSL: Load chain certificates from client_cert file
Isaac Boukris [Sun, 21 Jan 2018 01:36:44 +0000 (01:36 +0000)] 
OpenSSL: Load chain certificates from client_cert file

This helps the server to build the chain to trusted CA when PEM encoding
of client_cert is used with multiple listed certificates. This was
already done for the server certificate configuration, but the client
certificate was limited to using only the first certificate in the file.

Signed-off-by: Isaac Boukris <iboukris@gmail.com>
5 years agovlan: Use new bridge ioctl()
Sergey Matyukevich [Tue, 21 Nov 2017 20:14:45 +0000 (23:14 +0300)] 
vlan: Use new bridge ioctl()

Legacy ioctl() through SIOCDEVPRIVATE are deprecated. Follow the
approach taken by bridge-utils and make use of new bridge ioctl's
whenever possible.

For example, using legacy ioctl() breaks dynamic VLAN mode on 32-bit
Linux systems running 64-bit kernels.

Signed-off-by: Sergey Matyukevich <sergey.matyukevich.os@quantenna.com>
5 years agoUpdate copyright notices for the new year 2019
Jouni Malinen [Tue, 1 Jan 2019 21:38:56 +0000 (23:38 +0200)] 
Update copyright notices for the new year 2019

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agotests: Use different country in p2p_go_move_reg_change
Jouni Malinen [Tue, 1 Jan 2019 21:30:16 +0000 (23:30 +0200)] 
tests: Use different country in p2p_go_move_reg_change

Use of country=00 (world roaming) seemed to not work anymore with the
current cfg80211 regulatory implementation since the existing channel is
left enabled when moving to country=00. Use a specific country code that
does enforce the selected channel from being used anymore to make this
test case pass again.

The change in cfg80211 behavior is from the kernel commit 113f3aaa81bd
("cfg80211: Prevent regulatory restore during STA disconnect in
concurrent interfaces").

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agotests: dot1xAuthSessionUserName
Jouni Malinen [Tue, 1 Jan 2019 19:29:25 +0000 (21:29 +0200)] 
tests: dot1xAuthSessionUserName

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agoUse internal EAP server identity as dot1xAuthSessionUserName
Jouni Malinen [Tue, 1 Jan 2019 19:27:54 +0000 (21:27 +0200)] 
Use internal EAP server identity as dot1xAuthSessionUserName

If the internal EAP server is used instead of an external RADIUS server,
sm->identity does not get set. Use the identity from the internal EAP
server in such case to get the dot1xAuthSessionUserName value in STA MIB
information.

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agobrowser: Replace deprecated gtk_window_set_wmclass()
Jouni Malinen [Tue, 1 Jan 2019 18:36:42 +0000 (20:36 +0200)] 
browser: Replace deprecated gtk_window_set_wmclass()

Use gtk_window_set_role() instead of the deprecated
gtk_window_set_wmclass().

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agoHTTP (curl): Replace deprecated ASN1_STRING_data()
Jouni Malinen [Tue, 1 Jan 2019 18:29:34 +0000 (20:29 +0200)] 
HTTP (curl): Replace deprecated ASN1_STRING_data()

Use ASN1_STRING_get0_data() instead of the older ASN1_STRING_data() that
got deprecated in OpenSSL 1.1.0.

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agoHTTP (curl): Fix build with newer OpenSSL versions
Ben Greear [Tue, 12 Sep 2017 17:43:36 +0000 (10:43 -0700)] 
HTTP (curl): Fix build with newer OpenSSL versions

The SSL_METHOD patching hack to get proper OCSP validation for Hotspot
2.0 OSU needs cannot be used with OpenSSL 1.1.0 and newer since the
SSL_METHOD structure is not exposed anymore. Fall back to using the
incomplete CURLOPT_SSL_VERIFYSTATUS design to fix the build.

Signed-off-by: Ben Greear <greearb@candelatech.com>
5 years agoHTTP (curl): Use DEFINE_STACK_OF() with newer OpenSSL versions
Ben Greear [Tue, 12 Sep 2017 17:43:36 +0000 (10:43 -0700)] 
HTTP (curl): Use DEFINE_STACK_OF() with newer OpenSSL versions

SKM_sk_num() is not available anymore, so use DEFINE_STACK_OF() to get
the appropriate accessor functions.

Signed-off-by: Ben Greear <greearb@candelatech.com>
5 years agoHTTP (curl): Use SSL_get_SSL_CTX() helper
Ben Greear [Tue, 12 Sep 2017 17:43:36 +0000 (10:43 -0700)] 
HTTP (curl): Use SSL_get_SSL_CTX() helper

The direct ssl->ctx access are not allowed anymore in newer OpenSSL
versions, so use the SSL_get_SSL_CTX() helper for this.

Signed-off-by: Ben Greear <greearb@candelatech.com>
5 years agoHS 2.0: Fix EST compilation with OpenSSL 1.1.0 and newer
Ben Greear [Tue, 12 Sep 2017 17:43:36 +0000 (10:43 -0700)] 
HS 2.0: Fix EST compilation with OpenSSL 1.1.0 and newer

SKM_sk_value() is not available anymore, so use DEFINE_STACK_OF() to get
the appropriate accessor functions.

Signed-off-by: Ben Greear <greearb@candelatech.com>
5 years agohostap: Silence compiler warnings about IFNAMSIZ buffers
Jouni Malinen [Tue, 1 Jan 2019 17:38:58 +0000 (19:38 +0200)] 
hostap: Silence compiler warnings about IFNAMSIZ buffers

Report interface name truncation and reject such cases in Host AP driver
initialization of the AP interface.

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agoOCE: RSSI-based rejection to consider Authentication frames (AP)
Jouni Malinen [Tue, 1 Jan 2019 16:17:02 +0000 (18:17 +0200)] 
OCE: RSSI-based rejection to consider Authentication frames (AP)

Try to make RSSI-based rejection of associating stations a bit less
likely to trigger false rejections by considering RSSI from the last
received Authentication frame. Association is rejected only if both the
Authentication and (Re)Association Request frames are below the RSSI
threshold.

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agotests: Add RSSI based association rejection tests
Beni Lev [Mon, 21 Aug 2017 16:43:55 +0000 (19:43 +0300)] 
tests: Add RSSI based association rejection tests

Signed-off-by: Beni Lev <beni.lev@intel.com>
5 years agotests: Add a command for setting TX power/RSSI
Beni Lev [Mon, 21 Aug 2017 16:43:54 +0000 (19:43 +0300)] 
tests: Add a command for setting TX power/RSSI

With this command, RSSI signal can be controlled. Due to restrictions in
kernel, only values in the range of [-30, -50] can be used. The command
is implemented by changing the TX power.

Signed-off-by: Beni Lev <beni.lev@intel.com>
5 years agoOCE: Add RSSI based association rejection support (AP)
Beni Lev [Mon, 21 Aug 2017 16:43:53 +0000 (19:43 +0300)] 
OCE: Add RSSI based association rejection support (AP)

An AP might reject a STA association request due to low RSSI. In such
case, the AP informs the STA the desired RSSI improvement and a retry
timeout. The STA might retry to associate even if the RSSI hasn't
improved if the retry timeout expired.

Signed-off-by: Beni Lev <beni.lev@intel.com>
5 years agoOCE: Add RSSI based association rejection support (STA)
Beni Lev [Mon, 21 Aug 2017 16:43:52 +0000 (19:43 +0300)] 
OCE: Add RSSI based association rejection support (STA)

An AP might refuse to connect a STA if it has a low RSSI. In such case,
the AP informs the STA with the desired RSSI delta and a retry timeout.
Any subsequent association attempt with that AP (BSS) should be avoided,
unless the RSSI level improved by the desired delta or the timeout has
expired.

Defined in Wi-Fi Alliance Optimized Connectivity Experience technical
specification v1.0, section 3.14 (RSSI-based association rejection
information).

Signed-off-by: Beni Lev <beni.lev@intel.com>
5 years agotests: P2P cancel join-group using p2pdev and no separate group interface
Jouni Malinen [Tue, 1 Jan 2019 14:58:11 +0000 (16:58 +0200)] 
tests: P2P cancel join-group using p2pdev and no separate group interface

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agoP2P: Set global->p2p_group_formation in wpas_p2p_join_start() for p2pdev
Aloni, Adiel [Mon, 21 Aug 2017 16:36:22 +0000 (19:36 +0300)] 
P2P: Set global->p2p_group_formation in wpas_p2p_join_start() for p2pdev

When a dedicated P2P device interface is used, the
global->p2p_group_formation was not set in wpas_p2p_join_start() if no
separate group interface is used. This would cause that in case of a
failure in group formation, the cleaning of p2p_in_provisioning is done
on the wrong interface. Furthermore, P2P_CANCEL command could not be
used to stop such a group-join operation. Fix this by setting the
global->p2p_group_formation correctly in case that the group interface
is reusing wpa_s->parent.

Signed-off-by: Adiel Aloni <adiel.aloni@intel.com>
5 years agotests: Clear regdom state in go_neg_forced_freq_diff_than_bss_freq
Jouni Malinen [Tue, 1 Jan 2019 14:35:42 +0000 (16:35 +0200)] 
tests: Clear regdom state in go_neg_forced_freq_diff_than_bss_freq

Be more careful with cleaning up the regdom state in cfg80211.

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agotests: Make dpp_pkex_no_responder handle enabled 5 GHz channels
Jouni Malinen [Tue, 1 Jan 2019 14:17:13 +0000 (16:17 +0200)] 
tests: Make dpp_pkex_no_responder handle enabled 5 GHz channels

It was possible for the 5 GHz PKEX channels to be enabled, e.g., when
running "ap_ht40_csa2 dpp_pkex_no_responder" test sequence, and that
resulted in a failure in dpp_pkex_no_responder due to the unexpectedly
long wait needed for the DPP-FAIL event. Increase the wait time to allow
for 5 GHz PKEX channels to be probed.

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agoUpdate wpa_supplicant channel list on FLUSH
Jouni Malinen [Tue, 1 Jan 2019 13:58:46 +0000 (15:58 +0200)] 
Update wpa_supplicant channel list on FLUSH

Try to make sure the driver channel list state is synchronized with
wpa_supplicant whenever explicitly clearing state (e.g., between hwsim
test cases).

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agonl80211: Debug print channel list
Jouni Malinen [Tue, 1 Jan 2019 13:51:10 +0000 (15:51 +0200)] 
nl80211: Debug print channel list

This makes it a bit easier to figure out how channel list update from
the kernel is taken into use.

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agotests: Check per-wiphy specific country code between test cases
Jouni Malinen [Mon, 31 Dec 2018 15:05:03 +0000 (17:05 +0200)] 
tests: Check per-wiphy specific country code between test cases

This allows more accurate logging of failures related to the cfg80211
country=98 (intersection) case. This version is trying to give some more
time to allow the country code to clear, but that does not seem to be
sufficient with the current cfg80211 implementation for country=98 (but
might be for other cases).

The additional check for country=98 at the beginning of each test case
is an attempt to force cfg80211 to restore world roaming state with a
new association and disconnection at the station side detected after the
AP side has already stopped. This is needed after the Linux kernel
commit 113f3aaa81bd ("cfg80211: Prevent regulatory restore during STA
disconnect in concurrent interfaces").

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agotests: Wait a bit after 'iw reg set 00' at the end of test cases
Jouni Malinen [Tue, 1 Jan 2019 09:45:50 +0000 (11:45 +0200)] 
tests: Wait a bit after 'iw reg set 00' at the end of test cases

This is needed to avoid leaving unexpected cfg80211 regulatory country
code in place at the point when a test case terminates.

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agotests: Clear regdom changes more robustly in FST test cases
Jouni Malinen [Tue, 1 Jan 2019 09:35:22 +0000 (11:35 +0200)] 
tests: Clear regdom changes more robustly in FST test cases

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agotests: Clear regulatory setting in ap_ht_op_class_* more robustly
Jouni Malinen [Mon, 31 Dec 2018 15:14:01 +0000 (17:14 +0200)] 
tests: Clear regulatory setting in ap_ht_op_class_* more robustly

Avoid exiting the test case with regulatory domain set to something else
than 00 (world roaming).

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agonl82011: Make wiphy-specific country (alpha2) available in STATUS-DRIVER
Jouni Malinen [Mon, 31 Dec 2018 14:41:24 +0000 (16:41 +0200)] 
nl82011: Make wiphy-specific country (alpha2) available in STATUS-DRIVER

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agonl80211: Debug print details from the beacon hint events
Jouni Malinen [Mon, 31 Dec 2018 14:29:16 +0000 (16:29 +0200)] 
nl80211: Debug print details from the beacon hint events

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agohostapd: Add configuration option check_crl_strict
Sam Voss [Mon, 7 Aug 2017 16:26:33 +0000 (11:26 -0500)] 
hostapd: Add configuration option check_crl_strict

Add the ability to ignore time-based CRL errors from OpenSSL by
specifying a new configuration parameter, check_crl_strict=0.

This causes the following:

- This setting does nothing when CRL checking is not enabled.

- When CRL is enabled, "strict mode" will cause CRL time errors to not
  be ignored and will continue behaving as it currently does.

- When CRL is enabled, disabling strict mode will cause CRL time
  errors to be ignored and will allow connections.

By default, check_crl_strict is set to 1, or strict mode, to keep
current functionality.

Signed-off-by: Sam Voss <sam.voss@rockwellcollins.com>
5 years agowpa_cli: Allow reconnect to global interface
Ben Greear [Thu, 8 Jun 2017 17:58:54 +0000 (10:58 -0700)] 
wpa_cli: Allow reconnect to global interface

Old code would just re-connect to a particular interface, even if user
had started wpa_cli with the '-g' option. Refactor global control
interface connection routine to allow it to be used in
wpa_cli_reconnect().

Signed-off-by: Ben Greear <greearb@candelatech.com>
5 years agotests: Build tests for wpa_supplicant and hostapd
Jouni Malinen [Mon, 31 Dec 2018 08:50:22 +0000 (10:50 +0200)] 
tests: Build tests for wpa_supplicant and hostapd

Allow multiple build configurations to be tested automatically.

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agoAdd internal HMAC-SHA512 implementation to fix NEED_SHA512 builds
Jouni Malinen [Mon, 31 Dec 2018 09:51:45 +0000 (11:51 +0200)] 
Add internal HMAC-SHA512 implementation to fix NEED_SHA512 builds

Build configurations with CONFIG_TLS=internal and NEED_SHA512 failed due
to missing sha512.c file. Add that file even though this is not really
used in the currently available configuration combinations since DPP and
OWE are the only users of it and the internal crypto implementation
supports neither.

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agowpa_supplicant: Fix build with !CONFIG_AP and CONFIG_CTRL_IFACE_DBUS_NEW
Michal Privoznik [Sun, 30 Dec 2018 18:36:22 +0000 (19:36 +0100)] 
wpa_supplicant: Fix build with !CONFIG_AP and CONFIG_CTRL_IFACE_DBUS_NEW

If the CONFIG_CTRL_IFACE_DBUS_NEW is enabled but CONFIG_AP is
disabled the build fails. This is because dbus getters try to
access ap_iface member of wpa_supplicant struct which is defined
if and only if CONFIG_AP is enabled.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
5 years agomka: Log MI update failure in debug log
Jouni Malinen [Sun, 30 Dec 2018 23:09:02 +0000 (01:09 +0200)] 
mka: Log MI update failure in debug log

One of the reset_participant_mi() callers did not log the error. Make
this more consistent with the other callers.

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agonl80211: Note interface-removal-from-bridge errors in debug log
Jouni Malinen [Sun, 30 Dec 2018 23:05:23 +0000 (01:05 +0200)] 
nl80211: Note interface-removal-from-bridge errors in debug log

One of the linux_br_del_if() calls did not log nl80211-specific entry.
Make this more consistent with the other cases even though
linux_br_add_if() function itself is logging an error in the ioctl()
failure case (but not in the interface not found case).

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agotests: hostapd configuration reload from file when disabled
Jouni Malinen [Sun, 30 Dec 2018 15:35:54 +0000 (17:35 +0200)] 
tests: hostapd configuration reload from file when disabled

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agohostapd: Add openssl_ecdh_curves configuration parameter
Hristo Venev [Thu, 20 Apr 2017 13:44:31 +0000 (14:44 +0100)] 
hostapd: Add openssl_ecdh_curves configuration parameter

This makes it possible to use ECDSA certificates with EAP-TLS/TTLS/etc.
It should be noted that when using Suite B, different mechanism is used
to specify the allowed ECDH curves and this new parameter must not be
used in such cases.

Signed-off-by: Hristo Venev <hristo@venev.name>
5 years agoOpenSSL: Add openssl_ecdh_curves parameter
Hristo Venev [Thu, 20 Apr 2017 13:40:35 +0000 (14:40 +0100)] 
OpenSSL: Add openssl_ecdh_curves parameter

Some versions of OpenSSL need server support for ECDH to be explicitly
enabled, so provide a new parameter for doing so and all
SSL_{,CTX_}set_ecdh_auto() for versions that need it to enable automatic
selection.

Signed-off-by: Hristo Venev <hristo@venev.name>
5 years agoHS 2.0: DHCP broadcast-to-unicast conversion before address learning
Jouni Malinen [Sat, 29 Dec 2018 23:05:18 +0000 (01:05 +0200)] 
HS 2.0: DHCP broadcast-to-unicast conversion before address learning

handle_dhcp() was first trying to learn the IP address of an associated
STA before doing broadcast-to-unicast conversion. This could result in
not converting some DHCPACK messages since the address learning part
aborts processing by returning from the function in various cases.

Reorder these operations to allow broadcast-to-unicast conversion to
happen even if an associated STA entry is not updated based on a
DHCPACK.

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agotests: Add UDP checksum into DHCP frames in ProxyARP/DGAF disabled case
Jouni Malinen [Sat, 29 Dec 2018 23:04:03 +0000 (01:04 +0200)] 
tests: Add UDP checksum into DHCP frames in ProxyARP/DGAF disabled case

Previously, the special value 0 was used to indicate no UDP checksum.
Replace that with the calculated checksum for more like use case.

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agomka: Make ICV Indicator dependant on ICV length
Jaap Keuter [Fri, 7 Apr 2017 21:39:23 +0000 (23:39 +0200)] 
mka: Make ICV Indicator dependant on ICV length

IEEE Std 802.1X-2010, 11.11 describes that the ICV is separate from the
parameter sets before it. Due to its convenient layout the ICV Indicator
'body part' is used to encode the ICV as well.

IEEE Std 802.1X-2010, 11.11.3 describes the encoding of MKPDUs. In
bullet e) is desribed that the ICV Indicator itself is encoded when the
ICV is not 16 octets in length. IEEE Std 802.1Xbx-2014, Table 11-7 note
e) states that it will not be encoded unless the Algorithm Agility
parameter specifies the use of an ICV that is not 16 octets in length.

Therefore the length calculation for the ICV indicator body part must
take into account if the ICV Indicator is to be encoded or not. The
actual encoder of the ICV body already takes care of the rest.

In practice, this change will remove the ICV Indicator parameter set (4
octets before the ICV value itself) since the only defined algorithm
agility value uses an ICV of 16 octets. IEEE Std 802.1X-2010 MKPDU
validation and decoding rules in 11.11.2 and 11.11.4 require the
receipient to handle both cases of ICV Indicator being included or not.

Signed-off-by: Jaap Keuter <jaap.keuter@xs4all.nl>
5 years agotests: Clear regulatory Beacon hints more robustly in TDLS test cases
Jouni Malinen [Sat, 29 Dec 2018 15:01:01 +0000 (17:01 +0200)] 
tests: Clear regulatory Beacon hints more robustly in TDLS test cases

The ap_open_tdls_vht* test cases could leave some pending regulatory
Beacon hints waiting to be cleared during the following test case. This
would result in a failure if the following test case expected specific
regdom event behavior. For example, this caused "ap_open_tdls_vht160
dbus_country" sequence to result in failure in dbus_country. Fix this by
using more robust sequence in clearing regdom state at the end of the
TDLS test cases that have the AP advertising a country code.

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agotests: MKA MIB information
Jouni Malinen [Sat, 29 Dec 2018 14:52:56 +0000 (16:52 +0200)] 
tests: MKA MIB information

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agomka: MIB information
Jouni Malinen [Sat, 29 Dec 2018 14:52:31 +0000 (16:52 +0200)] 
mka: MIB information

Provide MKA information through the wpa_supplicant control interface MIB
command.

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agotests: MACsec PSK with bridge interface
Jouni Malinen [Thu, 27 Dec 2018 13:57:45 +0000 (15:57 +0200)] 
tests: MACsec PSK with bridge interface

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agotests: Use more robust way to determine MKA is done for MACsec testing
Jouni Malinen [Sat, 29 Dec 2018 09:37:01 +0000 (11:37 +0200)] 
tests: Use more robust way to determine MKA is done for MACsec testing

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agomka: Provide more status information over control interface
Jouni Malinen [Sat, 29 Dec 2018 08:38:54 +0000 (10:38 +0200)] 
mka: Provide more status information over control interface

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agomka: Stop trying to generate and distribute new SAK when not key server
Jouni Malinen [Fri, 28 Dec 2018 23:27:22 +0000 (01:27 +0200)] 
mka: Stop trying to generate and distribute new SAK when not key server

It was possible for a participant to first be elected as a key server
and schedule a new SAK to be generated and distributed just to be
followed by another participant being elected as the key server. That
did not stop the participant that disabled key server functionality to
stop generating the new SAK and then trying to distribute it. That is
not correct behavior, so make these steps conditional on the participant
still being a key server when going through the timer.

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agomka: Add more debug print details
Jouni Malinen [Thu, 27 Dec 2018 14:19:46 +0000 (16:19 +0200)] 
mka: Add more debug print details

This makes it a bit easier to try to figure out what is going on with
KaY operations and MKA setup.

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agomka: Fix deleteSAs clearing of principal->new_key
Jouni Malinen [Thu, 27 Dec 2018 22:47:53 +0000 (00:47 +0200)] 
mka: Fix deleteSAs clearing of principal->new_key

This pointer needs to be cleared when the matching SAK is being removed
from the SAK list. The previous implementation was doing something
pretty strange in the loop by clearing the pointer for any non-matching
key that happened to be iterated through before finding the matching
key. This could probably result in incorrect behavior, but not clearing
the pointer for the matching key could do more harm by causing freed
memory to be referenced.

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agomka: Derive MACsec cipher suite and MKA algorithm table index
Jouni Malinen [Thu, 27 Dec 2018 14:37:57 +0000 (16:37 +0200)] 
mka: Derive MACsec cipher suite and MKA algorithm table index

Instead of using a specifically set index value from table definition,
use the actual real index of the table entry. This removes need for
maintaining these index values separately. Furthermore, the
mka_alg_tbl[] index was already off-by-one (but not used anywhere).

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agowpa_supplicant: Document nl80211 driver in the man page
Asbjørn Sloth Tønnesen [Thu, 27 Dec 2018 00:16:44 +0000 (00:16 +0000)] 
wpa_supplicant: Document nl80211 driver in the man page

Signed-off-by: Asbjørn Sloth Tønnesen <hostap@asbjorn.st>
5 years agomka: Clean up KaY log output
Jaap Keuter [Fri, 15 Jun 2018 15:06:41 +0000 (17:06 +0200)] 
mka: Clean up KaY log output

When running wpa_supplicant (with logging for testing) the log output is
somewhat disorganized for KaY related items. E.g., items are not
aligned, inconsistent type handling, wrong wording, missing labels, etc.
This change tries to clean up the log output, so it is somewhat more
accessible.

Signed-off-by: Jaap Keuter <jaap.keuter@xs4all.nl>
5 years agotests: MACsec PSK local failures in CP state machine
Jouni Malinen [Thu, 27 Dec 2018 10:25:37 +0000 (12:25 +0200)] 
tests: MACsec PSK local failures in CP state machine

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agomka: Do not force entry into INIT state on CP state machine creation
Jouni Malinen [Thu, 27 Dec 2018 09:33:46 +0000 (11:33 +0200)] 
mka: Do not force entry into INIT state on CP state machine creation

Go through the SM_STEP_RUN() global transition to get into the INIT
state to follow the state machine design more closely.

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agomka: Remove unused authorization data from CP
Jouni Malinen [Thu, 27 Dec 2018 09:26:27 +0000 (11:26 +0200)] 
mka: Remove unused authorization data from CP

While IEEE Std 802.1X-2010 talks about arbitrary authorization data that
could be passed to the CP from sources like RADIUS server, there is not
much point in trying to implement this as an arbitrary memory buffer in
wpa_supplicant. Should such data be supported in the future, it would
much more likely use more detailed data structures that encode the
received data in easier to use form.

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agotests: MACsec
Jouni Malinen [Mon, 24 Dec 2018 21:57:10 +0000 (23:57 +0200)] 
tests: MACsec

Add some coverage for MACsec with the macsec_linux driver interface in
wpa_supplicant.

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agomka: Extend CAK/CKN-from-EAP-MSK API to pass in MSK length
Jouni Malinen [Wed, 26 Dec 2018 14:37:49 +0000 (16:37 +0200)] 
mka: Extend CAK/CKN-from-EAP-MSK API to pass in MSK length

This can be used to allow 256-bit key hierarchy to be derived from
EAP-based authentication. For now, the MSK length is hardcoded to 128
bits, so the previous behavior is maintained.

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agomka: Allow 256-bit CAK to be configured for PSK mode
Jouni Malinen [Wed, 26 Dec 2018 10:27:39 +0000 (12:27 +0200)] 
mka: Allow 256-bit CAK to be configured for PSK mode

This allows 256-bit CAK to be used as the root key in the MKA key
hierarchy.

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agomka: Allow CAK length 32 (256-bit) to be initialized
Jouni Malinen [Wed, 26 Dec 2018 14:28:27 +0000 (16:28 +0200)] 
mka: Allow CAK length 32 (256-bit) to be initialized

The CAK length is not hardcoded in the algorithm agility parameter, so
remove that from the table. Instead, allow both 16 (128-bit) and 32
(256-bit) CAK to be used so that the following key derivations use
appropriate key lengths based on the configured/derived CAK.

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agomka: Determine KCK/ICK length from CAK length
Jouni Malinen [Wed, 26 Dec 2018 14:23:29 +0000 (16:23 +0200)] 
mka: Determine KCK/ICK length from CAK length

The ICK and KEK are derived from a CAK and the length of the CAK
determines the length of the KCK/ICK. Remove the separate ICK/KEK length
parameters from the algorithm agility table.

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agomka: ICV calculation using 256-bit ICK
Jouni Malinen [Wed, 26 Dec 2018 14:18:00 +0000 (16:18 +0200)] 
mka: ICV calculation using 256-bit ICK

Add support for using AES-CMAC with 256-bit key (ICK) to calculate ICV.

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agomka: Support 256-bit ICK derivation
Jouni Malinen [Wed, 26 Dec 2018 10:39:21 +0000 (12:39 +0200)] 
mka: Support 256-bit ICK derivation

Support derivation of a 256-bit ICK and use of a 256-bit CAK in ICK
derivation.

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agomka: Support 256-bit KEK derivation
Jouni Malinen [Wed, 26 Dec 2018 10:35:18 +0000 (12:35 +0200)] 
mka: Support 256-bit KEK derivation

Support derivation of a 256-bit KEK and use of a 256-bit CAK in KEK
derivation.

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agomka: Support 256-bit CAK in SAK derivation
Jouni Malinen [Wed, 26 Dec 2018 10:20:57 +0000 (12:20 +0200)] 
mka: Support 256-bit CAK in SAK derivation

Pass the configured CAK length to SAK derivation instead of using
hardcoded 128-bit length.

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agomka: AES-CMAC-256 -based KDF
Jouni Malinen [Wed, 26 Dec 2018 10:13:40 +0000 (12:13 +0200)] 
mka: AES-CMAC-256 -based KDF

Extend the previously implemented KDF (IEEE Std 802.1X-2010, 6.2.1) to
support 256-bit input key and AES-CMAC-256. This does not change any
actual key derivation functionality yet, but is needed as a step towards
supporting 256-bit CAK.

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agomka: Change MI if key invalid
Andrey Kartashev [Fri, 2 Nov 2018 18:02:20 +0000 (19:02 +0100)] 
mka: Change MI if key invalid

It is possible to get a situation where a peer removes the Key Server
from its live peers list but the server still thinks that the peer is
alive (e.g., high packet loss in one direction). In such a case, the Key
Server will continue to advertise Last Key but this peer will not be
able to set up SA as it has already deleted its key.

Change the peer MI which will force the Key Server to distribute a new
SAK.

Signed-off-by: Andrey Kartashev <andrey.kartashev@afconsult.com>
5 years agomka: Speed up processing of duplicated SCI
Andrey Kartashev [Fri, 2 Nov 2018 18:02:19 +0000 (19:02 +0100)] 
mka: Speed up processing of duplicated SCI

Decrease timeout for a peer with duplicated SCI to speed up process in
case it is a valid peer after MI change.

Signed-off-by: Andrey Kartashev <andrey.kartashev@afconsult.com>
5 years agomka: Support for 256-bit SAK generation
Andrey Kartashev [Fri, 2 Nov 2018 18:02:18 +0000 (19:02 +0100)] 
mka: Support for 256-bit SAK generation

There is already partial support of GCM-AES-256. It is possible to
enable this mode by setting 'kay->macsec_csindex = 1;' in
ieee802_1x_kay_init() function, but the generated key contained only 128
bits of data while other 128 bits are in 0.

Enables KaY to generate full 256-bit SAK from the same 128-bit CAK. Note
that this does not support 256-bit CAK or AES-CMAC-256 -based KDF.

Signed-off-by: Andrey Kartashev <andrey.kartashev@afconsult.com>
5 years agomka: Remember LowestPN for each key server
Andrey Kartashev [Fri, 2 Nov 2018 18:02:17 +0000 (19:02 +0100)] 
mka: Remember LowestPN for each key server

According IEEE Std 802.1X-2010, 9.8 each participant shall record the
values of NextPN for last SAK accepted from each Key Server to use it in
case of a switch from one Key Server to another and back. Add LPN
recording and set saved value as the initial PN for the created channel.

Signed-off-by: Andrey Kartashev <andrey.kartashev@afconsult.com>
5 years agomka: Check for errors on create Secure Channel
Andrey Kartashev [Fri, 2 Nov 2018 18:02:16 +0000 (19:02 +0100)] 
mka: Check for errors on create Secure Channel

It is possible that the driver fails to create Secure Channel (due to
hardware limitations for example). Add checks of create_*_sc() result
codes and abort procedure in case of failure.

Signed-off-by: Andrey Kartashev <andrey.kartashev@afconsult.com>
5 years agomka: Fix a memory leak on error path
Andrey Kartashev [Fri, 2 Nov 2018 18:02:16 +0000 (19:02 +0100)] 
mka: Fix a memory leak on error path

Fix a minor memory leak in ieee802_1x_kay_create_mka() in
case of KEK/ICK derivation failure.

Signed-off-by: Andrey Kartashev <andrey.kartashev@afconsult.com>