mech_eap.git
7 years agoP2P: Fix common frequencies calculation for a group
Ilan Peer [Mon, 5 Sep 2016 14:33:01 +0000 (17:33 +0300)]
P2P: Fix common frequencies calculation for a group

Ignore group members for which there is no supported channels
information when calculating common group frequencies.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
7 years agotests: Skip wpas_ap_dfs when MCC > 1
Ilan Peer [Tue, 6 Sep 2016 06:52:41 +0000 (09:52 +0300)]
tests: Skip wpas_ap_dfs when MCC > 1

Skip wpas_ap_dfs in case that multi-channel is used, as
DFS operation is not supported in such a case.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
7 years agoP2P: Fix compilation warning in p2p_supplicant.c
Max Stepanov [Tue, 6 Sep 2016 06:44:33 +0000 (09:44 +0300)]
P2P: Fix compilation warning in p2p_supplicant.c

On some architectures unsigned int differs from size_t, and
some compilers warn about it.

Signed-off-by: Max Stepanov <Max.Stepanov@intel.com>
7 years agoFlush the BSS (scan) entries when an interface becomes disabled
Moshe Benji [Mon, 5 Sep 2016 14:32:55 +0000 (17:32 +0300)]
Flush the BSS (scan) entries when an interface becomes disabled

When an interface becomes disabled (e.g., when RF-kill becomes blocked)
we should clear the stored scan results to avoid maintaining stale
information.

Fix this by flushing the BSS entries when an interface becomes
disabled.

Signed-off-by: Moshe Benji <moshe.benji@intel.com>
7 years agodoc: Remove duplicate description for -t
Reiner Herrmann [Wed, 21 Sep 2016 19:54:01 +0000 (21:54 +0200)]
doc: Remove duplicate description for -t

Signed-off-by: Reiner Herrmann <reiner@reiner-h.de>
7 years agotests: mode=mesh in STATUS
Jouni Malinen [Thu, 22 Sep 2016 20:20:48 +0000 (23:20 +0300)]
tests: mode=mesh in STATUS

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
7 years agoShow mode=mesh in STATUS command
Saurav Babu [Wed, 21 Sep 2016 14:25:26 +0000 (19:55 +0530)]
Show mode=mesh in STATUS command

Signed-off-by: Saurav Babu <saurav.babu@samsung.com>
7 years agoDefine a QCA vendor command to validate encryption engine
Srinivas Dasari [Wed, 21 Sep 2016 07:37:32 +0000 (13:07 +0530)]
Define a QCA vendor command to validate encryption engine

This command carries 802.11 header and payload along with key (TK) and
PN for encryption/decryption purpose. Firmware/driver encrypts/decrypts
the given data and sends to userspace as a response to the command. User
space component can validate the data received from the driver to unit
test the hardware's encryption engine.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
7 years agotests: AP tracking STA taxonomy
Jouni Malinen [Wed, 21 Sep 2016 18:22:58 +0000 (21:22 +0300)]
tests: AP tracking STA taxonomy

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
7 years agotaxonomy: Store Probe Request frames in hostapd_sta_info
Denton Gentry [Mon, 15 Aug 2016 04:42:49 +0000 (21:42 -0700)]
taxonomy: Store Probe Request frames in hostapd_sta_info

A weakness in the initial client taxonomy mechanism is from storing both
the Probe and Associate in struct sta_info. struct sta_info is created
after a client associates (or starts authentication frame exchange),
which means that any Probe Request frames sent prior to association are
not retained. The Associate Request frame has to be seen, and then
another Probe Request frame after association, before we have a
signature for the client.

Most clients send lots of Probe Request frames (lots and lots and lots
of Probes, actually), but a few do not. ChromeOS is notably sparing in
sending Probe Request frames, it can take a long time before a signature
for a ChromeOS device is available.

Store the most recent Probe Request frame in struct hostapd_sta_info
tracking list. When a struct sta_info is created, move the Probe Request
frame information from struct hostapd_sta_info to struct sta_info.

Signed-off-by: dgentry@google.com (Denton Gentry)
Signed-off-by: denny@geekhold.com (Denton Gentry)
Signed-off-by: rofrankel@google.com (Richard Frankel)
Signed-off-by: richard@frankel.tv (Richard Frankel)
7 years agoPassive Client Taxonomy
Denton Gentry [Mon, 15 Aug 2016 04:42:48 +0000 (21:42 -0700)]
Passive Client Taxonomy

Implement the signature mechanism described in the paper
"Passive Taxonomy of Wifi Clients using MLME Frame Contents"
published by Denton Gentry and Avery Pennarun.

http://research.google.com/pubs/pub45429.html
https://arxiv.org/abs/1608.01725

This involves:
1. Add a CONFIG_TAXONOMY compile option. Enabling taxonomy incurs
   a memory overhead of up to several kilobytes per associated
   station.
2. If enabled, store the Probe Request and (Re)Associate Request frame in
   struct sta_info.
3. Implement code to extract the ID of each Information Element,
   plus selected fields and bitmasks from certain IEs, into a
   descriptive text string. This is done in a new source file,
   src/ap/taxonomy.c.
4. Implement a "signature qq:rr:ss:tt:uu:vv" command
   in hostapd_cli to retrieve the signature.

Signatures take the form of a text string. For example, a signature
for the Nexus 5X is:
  wifi4|probe:0,1,127,45,191,htcap:01ef,htagg:03,htmcs:0000ffff,vhtcap:338061b2,
  vhtrxmcs:030cfffa,vhttxmcs:030cfffa,extcap:00000a0201000040|assoc:0,1,48,45,
  221(0050f2,2),191,127,htcap:01ef,htagg:03,htmcs:0000ffff,vhtcap:339071b2,
  vhtrxmcs:030cfffa,vhttxmcs:030cfffa,extcap:0000000000000040

Signed-off-by: dgentry@google.com (Denton Gentry)
Signed-off-by: denny@geekhold.com (Denton Gentry)
Signed-off-by: rofrankel@google.com (Richard Frankel)
Signed-off-by: richard@frankel.tv (Richard Frankel)
7 years agoInitialize iface->sta_seen on allocation
Jouni Malinen [Wed, 21 Sep 2016 21:31:00 +0000 (00:31 +0300)]
Initialize iface->sta_seen on allocation

Previously, struct hostapd_iface sta_seen list head was initialized only
when completing interface setup. This left a window for operation that
could potentially iterate through the list before the list head has been
initialized. While the existing code checked iface->num_sta_seen to
avoid this case, it is much cleaner to initialize the list when struct
hostapd_iface is allocated to avoid any accidental missing of the extra
checks before list iteration.

Signed-off-by: Jouni Malinen <j@w1.fi>
7 years agoP2P: Fix D-Bus persistent parameter in group started event on GO
Jouni Malinen [Tue, 20 Sep 2016 15:00:22 +0000 (18:00 +0300)]
P2P: Fix D-Bus persistent parameter in group started event on GO

When starting a P2P GO, the struct p2p_go_neg_results may use
persistent_group == 2 to indicate use of persistent reconnect. Setting
ssid->p2p_persistent_group based on this did not take into account this
special case and that ended up in D-Bus code trying to encode 2 as a
DBUS_TYPE_BOOLEAN value which results in an assert from the library. Fix
this by setting ssid->p2p_persistent_group to 0 or 1 instead of raw
params->persistent_group value without any filtering.

This is similar to an earlier fix in commit
112fdee738d28c4e8bfb66ad7202d4348c4e7771 ('P2P: Fix D-Bus persistent
parameter in group started event') that addressed another code path in
sending out this D-Bus signal.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
7 years agoRemove unused generation of Request Authenticator in Account-Request
Nick Lowe [Sun, 14 Aug 2016 14:40:11 +0000 (15:40 +0100)]
Remove unused generation of Request Authenticator in Account-Request

Do not generate an unused and invalid Request Authenticator (random
value) when constructing Accounting-Request packets. The correct Request
Authenticator is calculated subsequently in radius_msg_finish_acct()
using MD5(msg + shared secret).

Signed-off-by: Nick Lowe <nick.lowe@lugatech.com>
7 years agotests: Setup wlantest once for qosmap tests
Jonathan Afek [Wed, 13 Jul 2016 17:06:05 +0000 (20:06 +0300)]
tests: Setup wlantest once for qosmap tests

Some tests call the check_qos_map() function more than once. Make sure
each test sets up wlantest only once before the first time the function
is called.

The wlantest setup sets the channel for the wlantest interface and
executes the wlantest executable. It is more efficient to do that only
once for each test.

Signed-off-by: Jonathan Afek <jonathanx.afek@intel.com>
7 years agotests: Increase timeout for remote tests
Jonathan Afek [Wed, 13 Jul 2016 17:06:04 +0000 (20:06 +0300)]
tests: Increase timeout for remote tests

Some operations take longer time on real hardware than on hwsim. This
commit increases two timeouts so that the tests will pass on real
hardware, too.

Signed-off-by: Jonathan Afek <jonathanx.afek@intel.com>
7 years agotests: Increase connection timeouts for remote tests
Jonathan Afek [Wed, 13 Jul 2016 17:06:03 +0000 (20:06 +0300)]
tests: Increase connection timeouts for remote tests

Use increased timeouts for connect and disconnect since these operations
take a longer time on real harware than they do on hwsim.

Signed-off-by: Jonathan Afek <jonathanx.afek@intel.com>
7 years agoRevert "nl80211: Remove duplicated check in nl80211_setup_ap()"
Rafał Miłecki [Mon, 12 Sep 2016 17:28:22 +0000 (19:28 +0200)]
Revert "nl80211: Remove duplicated check in nl80211_setup_ap()"

This reverts commit 647862eb60c324015ea31293cc052558b5185ca4.

The second check of device_ap_sme looks like duplicated, but it isn't
actually. The trick is nl80211_create_monitor_interface may change that
variable value and the second evaluation may give a different result.

This definitely isn't a very clear code, but that change caused a
regression for drivers that:
1) Don't report NL80211_ATTR_DEVICE_AP_SME
2) Don't support monitor mode
3) Don't support subscribing for PROBE_REQ and/or ACTION frames
like brcmfmac. With such drivers hostapd doesn't start anymore.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
7 years agoFix typos in wpa_supplicant configuration parameter documentation
Jouni Malinen [Sat, 10 Sep 2016 18:09:36 +0000 (21:09 +0300)]
Fix typos in wpa_supplicant configuration parameter documentation

Signed-off-by: Jouni Malinen <j@w1.fi>
7 years agonl80211: Use the monitor interface only without device_ap_sme support
Sunil Dutt [Thu, 1 Sep 2016 16:44:36 +0000 (22:14 +0530)]
nl80211: Use the monitor interface only without device_ap_sme support

The places using drv->use_monitor were already skipping creation of the
monitor interface if drv->device_ap_sme == 0. This means that the
monitor interface operations would not have worked anyway and it is safe
to set drv->use_monitor to zero for all such cases. This fixes an issue
with management frame subscription not happening properly for the case
where the AP SME is in the driver and the driver supports monitor
interfaces (for other purposes).

This commit also removes the check for monitor support and the
previously used workaround that cleared drv->use_monitor in
drv->device_ap_sme == 1 case if monitor interface was not supported
since that condition cannot occur anymore.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
7 years agotests: Dynamic Interworking element update
Jouni Malinen [Thu, 8 Sep 2016 16:48:44 +0000 (19:48 +0300)]
tests: Dynamic Interworking element update

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
7 years agoFST: Fix search for peer's "other" connection
Dedy Lansky [Mon, 5 Sep 2016 11:41:00 +0000 (14:41 +0300)]
FST: Fix search for peer's "other" connection

Upon receiving FST Setup Request from some peer on some interface,
search is made to see if same peer is connected on other interface with
specific band_id. With multiple peers, bug in
fst_group_does_iface_appear_in_other_mbies() caused wrong peer address
to be returned sometimes.

Fix this with a modified, simplified search algorithm of peer's "other"
connection.

Signed-off-by: Dedy Lansky <qca_dlansky@qca.qualcomm.com>
7 years agoFix mistakes in definition of QCA vendor commands for indoor location
Lior David [Tue, 6 Sep 2016 13:16:42 +0000 (16:16 +0300)]
Fix mistakes in definition of QCA vendor commands for indoor location

Fix some mistakes in the previous commit for adding QCA vendor commands
for indoor location.

Note: The renamed enum value does not change the ABI, but the addition
of QCA_WLAN_VENDOR_ATTR_FTM_MEAS_INVALID in the beginning of enum
qca_wlan_vendor_attr_ftm_meas does renumber
QCA_WLAN_VENDOR_ATTR_FTM_MEAS_* values. The previous values were
committed yesterday and have not been used in any released code yet, so
this is a justifiable quick fix.

Signed-off-by: Lior David <qca_liord@qca.qualcomm.com>
7 years agoHandle NULL return from os_zalloc() in sta_track_add()
Joel Cunningham [Fri, 2 Sep 2016 20:38:47 +0000 (15:38 -0500)]
Handle NULL return from os_zalloc() in sta_track_add()

This adds handling for a memory allocation failure in sta_track_add().

Signed-off-by: Joel Cunningham <joel.cunningham@me.com>
7 years agoAdd QCA vendor commands/attributes for indoor location
Lior David [Wed, 29 Jun 2016 14:05:39 +0000 (17:05 +0300)]
Add QCA vendor commands/attributes for indoor location

Assign QCA vendor specific commands, attributes, and events for
supporting indoor location features.

These features include:

1. Fine timing measurement (FTM) - allows measurement of distance
between two stations. Based on IEEE P802.11-REVmc/D7.0, 11.24.6 FTM is
performed between two stations: one is an initiator, typically a client
that wants to measure distance to another AP, and one is a responder,
typically an AP which responds to measurement requests from other
clients. The responder can be configured to report its location, either
in absolute coordinates (LCI) or free-form description (LCR).

2. Angle of arrival (AOA) - allows measurement of azimuth and elevation
between two stations.

The above features can be combined to allow a station to get an accurate
indoor location.

Signed-off-by: Lior David <qca_liord@qca.qualcomm.com>
7 years agotests: FTM capability indication
Jouni Malinen [Mon, 5 Sep 2016 18:43:36 +0000 (21:43 +0300)]
tests: FTM capability indication

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
7 years agowpa_supplicant: Allow FTM functionality to be published
Lior David [Wed, 3 Aug 2016 14:53:21 +0000 (17:53 +0300)]
wpa_supplicant: Allow FTM functionality to be published

Add configuration options that control publishing of fine timing
measurement (FTM) responder and initiator functionality via bits 70, 71
of Extended Capabilities element. Typically, FTM functionality is
controlled by a location framework outside wpa_supplicant. When
framework is activated, it will use wpa_supplicant to configure the
STA/AP to publish the FTM functionality. See IEEE P802.11-REVmc/D7.0,
9.4.2.27.

Signed-off-by: Lior David <qca_liord@qca.qualcomm.com>
7 years agohostapd: Allow FTM functionality to be published
Lior David [Wed, 3 Aug 2016 14:41:53 +0000 (17:41 +0300)]
hostapd: Allow FTM functionality to be published

Add configuration options that control publishing of fine timing
measurement (FTM) responder and initiator functionality via bits 70, 71
of Extended Capabilities element. Typically, FTM functionality is
controlled by a location framework outside hostapd. When framework is
activated, it will use hostapd to configure the AP to publish the FTM
functionality. See IEEE P802.11-REVmc/D7.0, 9.4.2.27.

Signed-off-by: Lior David <qca_liord@qca.qualcomm.com>
7 years agotests: VHT with 80 MHz channel width and use_sta_nsts=1
Jouni Malinen [Mon, 5 Sep 2016 18:16:40 +0000 (21:16 +0300)]
tests: VHT with 80 MHz channel width and use_sta_nsts=1

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
7 years agohostapd: Use stations nsts capability in (Re)Association Response frame
Tamizh chelvam [Wed, 31 Aug 2016 14:15:47 +0000 (19:45 +0530)]
hostapd: Use stations nsts capability in (Re)Association Response frame

Some deployed stations incorrectly consider nsts capability in
(Re)Association Response frame as required capability instead of maximum
capability and if it is greater than station's capability then beamform
will not happen in uplink traffic.

This commit adds support for an optional workaround to use station's
nsts capability in (Re)Association Response frame if the station's nsts
is less than AP by using the use_sta_nsts=1 configuration parameter.
This configuration is introduced in this commit and it is disabled by
default.

Signed-off-by: Tamizh chelvam <c_traja@qti.qualcomm.com>
7 years agoQCA vendor subcommand for LL_STATS extension
Zhang Qian [Mon, 5 Sep 2016 08:22:38 +0000 (16:22 +0800)]
QCA vendor subcommand for LL_STATS extension

Some user space monitor wants to offload link layer statistics to
firmware. A new command QCA_NL80211_VENDOR_SUBCMD_LL_STATS_EXT and
associcated attributes are added. The monitor will use this new command
to configure monitoring paramters and get link layer statistics.
Attributes added in this change:
1. Parameters for FW to trigger the statistics report
2. Peer STA power state
3. TX failure statistics

Signed-off-by: Zhang Qian <zhangq@qti.qualcomm.com>
7 years agoD-Bus: Add ConfigFile parameter into the interface properties
Jose Blanquicet [Tue, 23 Aug 2016 12:16:00 +0000 (14:16 +0200)]
D-Bus: Add ConfigFile parameter into the interface properties

This patch aims to expose the configuration file path as an interface
property, like is done with the driver and the bridge name. Doing so,
higher layer programs become responsible to recreate interfaces with the
correct configuration file path when programs need to remove them.

Signed-off-by: Jose Blanquicet <blanquicet@gmail.com>
7 years agomka: Clean up key allocation
Sabrina Dubroca [Fri, 12 Aug 2016 13:07:35 +0000 (15:07 +0200)]
mka: Clean up key allocation

Assign cs in ieee802_1x_mka_decode_dist_sak_body and reuse it.

Cleanup of key allocation: ieee802_1x_kay_generate_new_sak() and
ieee802_1x_mka_decode_dist_sak_body() both allocate a struct key_conf,
fill it, and ask ieee802_1x_kay_init_data_key() to allocate and set up a
struct data_key. They also allocate multiple key buffers and copy the
same data around. Stop moving data from buffer to buffer, and just
allocate what we really need.

Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
7 years agomka: Get rid of struct ieee802_1x_cp_conf
Sabrina Dubroca [Fri, 12 Aug 2016 13:07:35 +0000 (15:07 +0200)]
mka: Get rid of struct ieee802_1x_cp_conf

Instead of copying from kay to a temporary struct, and then from the
struct to the sm, just copy from kay to cp.

Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
7 years agomka: Store cipher suite ID in a u64 instead of u8 pointer
Sabrina Dubroca [Fri, 12 Aug 2016 13:07:35 +0000 (15:07 +0200)]
mka: Store cipher suite ID in a u64 instead of u8 pointer

Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
7 years agomka: Make csindex unsigned
Jouni Malinen [Mon, 22 Aug 2016 18:02:40 +0000 (21:02 +0300)]
mka: Make csindex unsigned

This avoids unnecessary typecasting while still being able to compare
the value to CS_TABLE_SIZE without compiler warnings.

Signed-off-by: Jouni Malinen <j@w1.fi>
7 years agomka: Reorganize live peer creation and key server election
Sabrina Dubroca [Mon, 15 Aug 2016 09:43:42 +0000 (11:43 +0200)]
mka: Reorganize live peer creation and key server election

This modifies ieee802_1x_kay_decode_mkpdu() check for peer including me
in its peer list.

Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
7 years agomka: Share a single delete mka implementation
Sabrina Dubroca [Mon, 15 Aug 2016 09:43:42 +0000 (11:43 +0200)]
mka: Share a single delete mka implementation

Share mka deletion implementation in ieee802_1x_participant_timer() for
the cak_life and mka_life expiration cases.

Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
7 years agomka: Introduce compare_priorities()
Sabrina Dubroca [Mon, 15 Aug 2016 09:43:42 +0000 (11:43 +0200)]
mka: Introduce compare_priorities()

This takes care of priority comparison followed by MAC address
comparison if the priorities are identical.

Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
7 years agomka: Clean up ieee802_1x_kay_mkpdu_sanity_check()
Sabrina Dubroca [Mon, 15 Aug 2016 09:43:42 +0000 (11:43 +0200)]
mka: Clean up ieee802_1x_kay_mkpdu_sanity_check()

This drops one indentation level and makes the code a bit more readable.

Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
7 years agomka: Simplify ieee802_1x_mka_dist_sak_body_present()
Sabrina Dubroca [Mon, 15 Aug 2016 09:43:42 +0000 (11:43 +0200)]
mka: Simplify ieee802_1x_mka_dist_sak_body_present()

No need for an if statement to figure out Boolean return value.

Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
7 years agomka: Replace participant->kay with a local kay variable
Sabrina Dubroca [Mon, 15 Aug 2016 09:43:42 +0000 (11:43 +0200)]
mka: Replace participant->kay with a local kay variable

Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
7 years agomka: Fix typos in grammar in variable names and comments
Sabrina Dubroca [Mon, 15 Aug 2016 09:43:42 +0000 (11:43 +0200)]
mka: Fix typos in grammar in variable names and comments

Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
7 years agomka: Use named initializers for mka_body_handler[]
Sabrina Dubroca [Mon, 15 Aug 2016 09:43:42 +0000 (11:43 +0200)]
mka: Use named initializers for mka_body_handler[]

Also move the struct definition to be next to this array definition.

Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
7 years agomka: Remove unused enum mka_created_mode values
Sabrina Dubroca [Mon, 15 Aug 2016 09:43:42 +0000 (11:43 +0200)]
mka: Remove unused enum mka_created_mode values

DISTRIBUTED and CACHED were not used anywhere.

Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
7 years agomka: Remove cs_len argument from the set_current_cipher_suite functions
Sabrina Dubroca [Mon, 15 Aug 2016 09:43:42 +0000 (11:43 +0200)]
mka: Remove cs_len argument from the set_current_cipher_suite functions

This is a known constant value (CS_ID_LEN, i.e., the length of the EUI64
identifier) and does not need to be provided separately in these
function calls.

Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
7 years agomka: Clean up ieee802_1x_mka_decode_potential_peer_body()
Sabrina Dubroca [Fri, 12 Aug 2016 13:07:33 +0000 (15:07 +0200)]
mka: Clean up ieee802_1x_mka_decode_potential_peer_body()

Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
7 years agomka: Simplify ieee802_1x_mka_encode_icv_body() memory copying
Sabrina Dubroca [Fri, 12 Aug 2016 13:07:33 +0000 (15:07 +0200)]
mka: Simplify ieee802_1x_mka_encode_icv_body() memory copying

There is no need to maintain two os_memcpy() calls to cover different
cmac lengths.

Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
7 years agomka: Simplify ieee802_1x_mka_sak_use_body_present()
Sabrina Dubroca [Fri, 12 Aug 2016 13:07:33 +0000 (15:07 +0200)]
mka: Simplify ieee802_1x_mka_sak_use_body_present()

to_use_sak is a Boolean variable, so there is no need for an if
statement to figure out whether to return TRUE or FALSE.

Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
7 years agomka: Reorganize loops in number of KaY functions
Sabrina Dubroca [Fri, 12 Aug 2016 13:07:33 +0000 (15:07 +0200)]
mka: Reorganize loops in number of KaY functions

Use for loop to remove unnecessary goto use and similar cleanup to
simplify the loops in ieee802_1x_mka_i_in_peerlist(),
ieee802_1x_mka_decode_live_peer_body(), and
ieee802_1x_kay_decode_mkpdu().

Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
7 years agomka: Remove unused body_peer incrementation
Sabrina Dubroca [Fri, 12 Aug 2016 13:07:33 +0000 (15:07 +0200)]
mka: Remove unused body_peer incrementation

Each loop iteration resets body_peer in the beginning, so there is no
need to increment this pointer in the end.

Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
7 years agomka: Add reset_participant_mi() helper
Sabrina Dubroca [Fri, 12 Aug 2016 13:07:33 +0000 (15:07 +0200)]
mka: Add reset_participant_mi() helper

Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
7 years agomka: Clean up printf formats
Sabrina Dubroca [Fri, 12 Aug 2016 13:07:33 +0000 (15:07 +0200)]
mka: Clean up printf formats

Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
7 years agomka: Use named initializers for static structs
Sabrina Dubroca [Fri, 12 Aug 2016 13:07:33 +0000 (15:07 +0200)]
mka: Use named initializers for static structs

Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
7 years agomka: Add MKA_ALIGN_LENGTH macro
Sabrina Dubroca [Fri, 12 Aug 2016 13:07:33 +0000 (15:07 +0200)]
mka: Add MKA_ALIGN_LENGTH macro

Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
7 years agomka: Add helper functions for dumping and creating peer
Sabrina Dubroca [Mon, 15 Aug 2016 09:43:41 +0000 (11:43 +0200)]
mka: Add helper functions for dumping and creating peer

This allows more code reuse for creating live/potential peer and dumping
peer entries.

Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
7 years agomka: Clean up ieee802_1x_kay_get_cipher_suite() lookup function
Sabrina Dubroca [Mon, 15 Aug 2016 09:43:41 +0000 (11:43 +0200)]
mka: Clean up ieee802_1x_kay_get_cipher_suite() lookup function

Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
7 years agomka: Refactor the get_*_peer() functions
Sabrina Dubroca [Mon, 15 Aug 2016 09:43:41 +0000 (11:43 +0200)]
mka: Refactor the get_*_peer() functions

Add ieee802_1x_kay_get_potential_peer() similarly to the previously used
ieee802_1x_kay_get_live_peer() and use these helper functions more
consistently to avoid multiple implementations of peer lookups.

Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
7 years agomka: Fix a typo in mka_body_handler (mak to mka)
Sabrina Dubroca [Mon, 15 Aug 2016 09:43:41 +0000 (11:43 +0200)]
mka: Fix a typo in mka_body_handler (mak to mka)

Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
7 years agomka: Add a helper function, sci_equal(), for sci comparison
Sabrina Dubroca [Mon, 15 Aug 2016 09:43:41 +0000 (11:43 +0200)]
mka: Add a helper function, sci_equal(), for sci comparison

Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
7 years agomka: Use less bitfields in the IEEE 802.1X-2010 structs
Sabrina Dubroca [Mon, 15 Aug 2016 09:43:41 +0000 (11:43 +0200)]
mka: Use less bitfields in the IEEE 802.1X-2010 structs

This splits the u32 bitfields into u8 variables and using bitfields only
for the cases where under 8-bit fields are used.

Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
7 years agomka: Fix a typo in macsec_capbility
Sabrina Dubroca [Mon, 15 Aug 2016 09:43:41 +0000 (11:43 +0200)]
mka: Fix a typo in macsec_capbility

Spell "capability" correctly in the variable name.

Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
7 years agotests: Allow regdb missing some op classes in mbo_supp_oper_classes
Jouni Malinen [Mon, 22 Aug 2016 16:22:01 +0000 (19:22 +0300)]
tests: Allow regdb missing some op classes in mbo_supp_oper_classes

Not all installed regdb files include channels for global operating
classes 121-123, and 129.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
7 years agotests: Make FST kill_pid() more robust
Jouni Malinen [Mon, 22 Aug 2016 10:17:44 +0000 (13:17 +0300)]
tests: Make FST kill_pid() more robust

It looks like the attempt to read the process id from a PID file can
return empty data. This resulted in kill_pid() failing to kill the
process and all the following FST test cases using the extra interface
failing. While the PID file is really supposed to have a valid PID value
when we get this far, it is better to try multiple times to avoid
failing large number of test cases.

The current os_daemonize() implementation ends up calling daemon() first
and then writing the PID file from the remaining process that is running
in the background. This leaves a short race condition where an external
process that started hostapd/wpa_supplicant could end up trying to read
the PID file before it has been written.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
7 years agotests: hostapd and ctrl_iface commands when BSS not yet fully enabled
Jouni Malinen [Fri, 19 Aug 2016 13:31:03 +0000 (16:31 +0300)]
tests: hostapd and ctrl_iface commands when BSS not yet fully enabled

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
7 years agoInitialize hapd->nr_db in hostapd_alloc_bss_data()
Jouni Malinen [Fri, 19 Aug 2016 13:29:22 +0000 (16:29 +0300)]
Initialize hapd->nr_db in hostapd_alloc_bss_data()

Previously, this was initialized in hostapd_setup_bss() which made it
possible for a REMOVE_NEIGHBOR control interface command to be issued
prior to the list head pointers having been set. That resulted in a NULL
pointer dereference. Fix this by initializing the list head at the time
the data structure gets allocated.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
7 years agoFix TRACK_STA_LIST before BSS enabled
Jouni Malinen [Fri, 19 Aug 2016 13:26:48 +0000 (16:26 +0300)]
Fix TRACK_STA_LIST before BSS enabled

This hostapd control interface command could hit a NULL pointer
dereference if issued before the BSS was enabled.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
7 years agoCheck for driver initialization before doing driver operations
Jouni Malinen [Fri, 19 Aug 2016 09:24:15 +0000 (12:24 +0300)]
Check for driver initialization before doing driver operations

Number of hostapd control interface commands (e.g., STATUS-DRIVER) could
result in NULL pointer dereference when issued on not yet enabled BSS.
Fix this by checking that the driver interface has been initialized
before calling the driver_ops function.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
7 years agoradius: Sanity check for NULL pointer segfault
Eduardo Abinader [Wed, 17 Aug 2016 17:29:39 +0000 (19:29 +0200)]
radius: Sanity check for NULL pointer segfault

When the RADIUS client has not yet been fully enabled, MIB command was
segfaulting hostapd.

Signed-off-by: Eduardo Abinader <eduardoabinader@gmail.com>
7 years agoMove network add/remove operations to a common function
Roshan Pius [Tue, 19 Jul 2016 17:44:22 +0000 (10:44 -0700)]
Move network add/remove operations to a common function

All the 3 control interfaces: socket based, dbus & binder needs to
perform the same sequence of steps for network add/remove. So, move
these to a common utility method in |wpa_supplicant.c| instead of
duplicating the code everywhere.

Signed-off-by: Roshan Pius <rpius@google.com>
7 years agomesh: Report HT operation mode to kernel
Masashi Honma [Fri, 5 Aug 2016 08:35:31 +0000 (17:35 +0900)]
mesh: Report HT operation mode to kernel

Report HT operation mode to kernel to broadcast correct IE in beacon
(for example HT operation IE).

Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
7 years agomesh: Use WPA_DRIVER_MESH_CONF_FLAG_* as modification flag
Masashi Honma [Fri, 5 Aug 2016 08:35:30 +0000 (17:35 +0900)]
mesh: Use WPA_DRIVER_MESH_CONF_FLAG_* as modification flag

Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
7 years agomesh: Do NL80211_MESHCONF_* setting in single function
Masashi Honma [Fri, 5 Aug 2016 08:35:29 +0000 (17:35 +0900)]
mesh: Do NL80211_MESHCONF_* setting in single function

Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
7 years agomesh: Move max_peer_links parameter to appropriate struct
Masashi Honma [Fri, 5 Aug 2016 08:35:28 +0000 (17:35 +0900)]
mesh: Move max_peer_links parameter to appropriate struct

Accoding to the comment of struct wpa_driver_mesh_bss_params, the
max_peer_links parameter should be under that struct.

Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
7 years agotests: IAPP and multiple BSSes
Jouni Malinen [Thu, 18 Aug 2016 17:06:09 +0000 (20:06 +0300)]
tests: IAPP and multiple BSSes

This verifies IAPP socket registration from multiple hostapd interfaces.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
7 years agoIAPP: Set SO_REUSEADDR on listening socket
Petko Bordjukov [Mon, 8 Aug 2016 15:46:28 +0000 (18:46 +0300)]
IAPP: Set SO_REUSEADDR on listening socket

Make it possible for several instances of hostapd to listen on the same
network interface.

Signed-off-by: Petko Bordjukov <bordjukov@gmail.com>
7 years agoAdd init fragment for hostapd on Android
Christopher Wiley [Wed, 17 Aug 2016 17:21:01 +0000 (17:21 +0000)]
Add init fragment for hostapd on Android

This fragment defines how the Android init system should start hostapd
as a standalone service. Previously, hostapd was fork/exec'd from
Android's netd. This left hostapd with some dangling file descriptors
and a process parent minimally interested in acting as init for child
processes.

Signed-off-by: Christopher Wiley <wiley@google.com>
7 years agomesh: Simplify HT40 check code
Masashi Honma [Thu, 18 Aug 2016 01:06:44 +0000 (10:06 +0900)]
mesh: Simplify HT40 check code

The ht40 variable can only have values -1 or 1 here, so need to try to
address ht40 == 0 case.

Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
7 years agomesh: Set correct secondary channel offset if HT40 is disabled
Masashi Honma [Thu, 18 Aug 2016 01:06:43 +0000 (10:06 +0900)]
mesh: Set correct secondary channel offset if HT40 is disabled

Previously, secondary channel offset could be non zero even though
disable_ht40=1. This patch fixes it.

Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
7 years agotests: hostapd and MIB ctrl_iface command with open network
Jouni Malinen [Thu, 18 Aug 2016 07:42:56 +0000 (10:42 +0300)]
tests: hostapd and MIB ctrl_iface command with open network

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
7 years agoap: Use is_multicast_ether_addr() more
Johannes Berg [Tue, 16 Aug 2016 13:06:59 +0000 (15:06 +0200)]
ap: Use is_multicast_ether_addr() more

Various checks should use is_multicast_ether_addr() instead
of hardcoding the equivalent, change it.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
7 years agonl80211: Remove duplicated check in nl80211_setup_ap()
Eduardo Abinader [Tue, 16 Aug 2016 15:43:04 +0000 (17:43 +0200)]
nl80211: Remove duplicated check in nl80211_setup_ap()

Just removing a duplicated condition.

Signed-off-by: Eduardo Abinader <eduardoabinader@gmail.com>
7 years agotests: IEEE 802.1X + WEP reauthentication
Jouni Malinen [Tue, 16 Aug 2016 19:40:03 +0000 (22:40 +0300)]
tests: IEEE 802.1X + WEP reauthentication

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
7 years agonl80211: Fix control port protocol no-encrypt setting
Johannes Berg [Wed, 17 Aug 2016 09:40:25 +0000 (11:40 +0200)]
nl80211: Fix control port protocol no-encrypt setting

Previously, driver_nl80211 sets NL80211_ATTR_CONTROL_PORT_NO_ENCRYPT in
AP mode, to get EAPOL frames out unencrypted when using IEEE 802.1X/WEP.
However, due to the way nl80211/cfg80211 is implemented, this attribute
is ignored by the kernel if NL80211_ATTR_CONTROL_PORT_ETHERTYPE isn't
specified as well. Fix this by including
NL80211_ATTR_CONTROL_PORT_ETHERTYPE set to ETH_P_PAE. This can be done
unconditionally, since the kernel will allow ETH_P_PAE to be set even
when the driver didn't advertise support for arbitrary ethertypes.

Additionally, the params->pairwise_ciphers appear to not be set at
this point, so relax the check and allow them to be zero.

In client mode, this whole thing was missing, so add it. Again, the
pairwise suite can be WPA_CIPHER_NONE, so allow that case as well.

This fixed IEEE 802.1X/WEP EAP reauthentication and rekeying to use
unencrypted EAPOL frames which is the de facto way of implementing this
in wireless networks.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
7 years agotests: Fix ap_wps_er_http_proto max concurrent requests case
Jouni Malinen [Wed, 17 Aug 2016 09:24:59 +0000 (12:24 +0300)]
tests: Fix ap_wps_er_http_proto max concurrent requests case

Commit 2d6a526ac3885605f34df4037fc79ad330565b23 ('tests: Make
ap_wps_er_http_proto more robust') tried to work around the timeouts
here, but that was not really the best approach since the one second
timeout that was used here for connect() ended up being very close to
the limit even before the kernel change. The longer connect() time is
caused by a sequence where the listen() backlog ignores the connection
instead of accept() followed by close() within the wpa_supplicant ER
HTTP connection handling. The time to retransmit the SYN changed a bit
in the kernel from 1.0 sec to about 1.03 sec. This was enough to push
that over the one second timeout.

Fix this by using a sufficiently long timeout (10 sec) to allow SYN
retransmission to occur to recover from the listen() backlog case.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
7 years agotests: More coverage for IBSS RSN OOM
Jouni Malinen [Sat, 13 Aug 2016 18:48:04 +0000 (21:48 +0300)]
tests: More coverage for IBSS RSN OOM

Signed-off-by: Jouni Malinen <j@w1.fi>
7 years agoIBSS: Fix a memory leak on RSN error path
Jouni Malinen [Sat, 13 Aug 2016 18:29:53 +0000 (21:29 +0300)]
IBSS: Fix a memory leak on RSN error path

Signed-off-by: Jouni Malinen <j@w1.fi>
7 years agoMove disconnect command handling to a common place
Roshan Pius [Wed, 10 Aug 2016 16:35:34 +0000 (09:35 -0700)]
Move disconnect command handling to a common place

Move out the disconnect command handling from |ctrl_iface.c| to
|wpa_supplicant.c| so that it can be reused across the different
control interfaces (socket, dbus & binder).

Signed-off-by: Roshan Pius <rpius@google.com>
7 years agoOpenSSL: Fix OpenSSL 1.1.0 compatibility functions
David Benjamin [Wed, 10 Aug 2016 17:28:45 +0000 (13:28 -0400)]
OpenSSL: Fix OpenSSL 1.1.0 compatibility functions

To be consistent with OpenSSL 1.1.0, the free functions should
internally check for NULL. EVP_MD_CTX_free also was missing an
EVP_MD_CTX_cleanup, so this leaked a little.

OpenSSL 1.1.0 also has given get_rfc3526_prime_1536 a better namespace
with get_rfc3526_prime_1536 as a compatibility-only name. Use that
instead in 1.1.0.

Signed-off-by: David Benjamin <davidben@google.com>
7 years agotests: IBSS RSN group rekeying
Jouni Malinen [Sat, 13 Aug 2016 13:22:44 +0000 (16:22 +0300)]
tests: IBSS RSN group rekeying

Signed-off-by: Jouni Malinen <j@w1.fi>
7 years agoAdd group_rekey parameter for IBSS
Jouni Malinen [Sat, 13 Aug 2016 13:22:53 +0000 (16:22 +0300)]
Add group_rekey parameter for IBSS

The new network profile parameter group_rekey can now be used to specify
the group rekeying internal in seconds for IBSS.

Signed-off-by: Jouni Malinen <j@w1.fi>
7 years agohostapd: Fix parsing the das_client option
Felix Fietkau [Tue, 26 Jul 2016 11:29:37 +0000 (13:29 +0200)]
hostapd: Fix parsing the das_client option

The musl implementation of inet_aton() returns an error if there are any
characters left after the IP address. When parsing the das_client, split
the string at the whitespace separator to be able to parse the address
successfully.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
7 years agonl80211: Do not switch interface to station mode when using mesh
Felix Fietkau [Tue, 26 Jul 2016 11:29:36 +0000 (13:29 +0200)]
nl80211: Do not switch interface to station mode when using mesh

This fixes issues with adding mesh interfaces to a bridge.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
7 years agoDo not include NAS-Port attribute with AID 0
Nick Lowe [Mon, 8 Aug 2016 13:19:57 +0000 (14:19 +0100)]
Do not include NAS-Port attribute with AID 0

Do not include a NAS-Port attribute in Access-Request and
Accounting-Request packets where the Association ID (AID) is 0, i.e.,
not yet assigned or known.

Signed-off-by: Nick Lowe <nick.lowe@lugatech.com>
7 years agoatheros: Accept Public Action frames sent to Wildcard BSSID
Manish Shukla [Thu, 11 Aug 2016 13:08:30 +0000 (16:08 +0300)]
atheros: Accept Public Action frames sent to Wildcard BSSID

Previously, the check for mgmt->bssid matching own address (= BSSID)
ended up rejecting the case where Public Action frames are using
Wildcard BSSID in the Address 3 field. This could result in GAS queries
being dropped. Fix this by allowing both the own address (= AP BSSID)
and Wildcard BSSID in Action frame Address 3 field.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
7 years agoFix EAP state machine reset with offloaded roaming and authorization
Jouni Malinen [Wed, 10 Aug 2016 20:51:21 +0000 (23:51 +0300)]
Fix EAP state machine reset with offloaded roaming and authorization

If the driver indicates a roamed event with already completed
authorization, altAccept = TRUE could have resulted in the EAP state
machine ending up in the FAILURE state from the INITIALIZE state. This
is not correct behavior and similar cases were already addressed for FT
and WPA-PSK. Fix the offloaded roamed+authorized (EAP/PMKSA caching)
case by doing similar changes to EAPOL/EAP state variable updates during
association event handling.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
7 years agotests: Make ap_wps_er_http_proto more robust
Jouni Malinen [Thu, 11 Aug 2016 12:58:13 +0000 (15:58 +0300)]
tests: Make ap_wps_er_http_proto more robust

It looks like connect() for a TCP socket can time out at least with a
recent kernel. Handle that case more gracefully by ignoring that socket
while allowing the test to continue.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
7 years agotests: Make FST config tests more robust and easier to debug
Jouni Malinen [Wed, 10 Aug 2016 14:55:20 +0000 (17:55 +0300)]
tests: Make FST config tests more robust and easier to debug

It looks like it is possible for the separate started wpa_supplicant
process to remain running after a test case like fst_sta_config_default.
This would result in failures to run any following test case that uses
the wlan5 interface. Try to kill the process more thoroughly by waiting
for the PID file to show up and write more details into the logs to make
it easier to debug issues in this area.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
7 years agoQCA vendor command to get hardware capabilities
Yingying Tang [Wed, 10 Aug 2016 13:49:46 +0000 (16:49 +0300)]
QCA vendor command to get hardware capabilities

This commit introduces a new vendor sub command
QCA_NL80211_VENDOR_SUBCMD_GET_HW_CAPABILITY and the associated
attributes to get Wi-Fi hardware capabilities.

Signed-off-by: Yingying Tang <yintang@qti.qualcomm.com>
7 years agoDefine an attribute QCA_WLAN_VENDOR_ATTR_CONFIG_QPOWER
Sunil Dutt [Tue, 9 Aug 2016 04:58:35 +0000 (10:28 +0530)]
Define an attribute QCA_WLAN_VENDOR_ATTR_CONFIG_QPOWER

This can be used to enable/disable QPOWER.

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