Commit graph

6356 commits

Author SHA1 Message Date
Jouni Malinen 7b6e81575f Clean up hostapd add_iface error path operations
If hapd_iface->bss[i] == NULL, this could have resulted in NULL pointer
dereference in the debug print. Avoid this by skipping the message in
case of NULL pointer. In addition, clear iface->bss[i] to NULL for
additional robustness even though this array gets freed immediately.

Signed-off-by: Jouni Malinen <j@w1.fi>
2014-03-02 17:15:12 +02:00
Jouni Malinen 67adcd266c WNM: Check wpa_s->current_bss more consistently
The scan result comparison routine would not make much sense without
current BSS level known, so return from the function without going
through the iteration that could have dereferenced the pointer if
wpa_s->current_bss == NULL.

Signed-off-by: Jouni Malinen <j@w1.fi>
2014-03-02 17:15:12 +02:00
Jouni Malinen 3ff8073db7 EAP-FAST: Use clear eap_get_config() result validation
This was previously checked through the eap_peer_tls_ssl_init() call
which made it difficult for static analyzers. Add an explicit check for
config == NULL into the beginnign of eap_fast_init() since this will
always result in initialization failing anyway.

Signed-off-by: Jouni Malinen <j@w1.fi>
2014-03-02 17:15:12 +02:00
Jouni Malinen a8716d13bf roboswitch: Verify that register read succeeds before comparing result
If wpa_driver_roboswitch_read() fails before such comparison, the values
that are being compared are not initialized properly and as such, there
is not much point in comparing them either.

Signed-off-by: Jouni Malinen <j@w1.fi>
2014-03-02 17:15:12 +02:00
Jouni Malinen 3d91a0470f DFS: Make sure center frequency is always initialized for VHT
This seemed to be fine on most code paths, but the code was complex
enough to make the analysis difficult (and a bit too much for static
analyzers). There is no harm in forcing these parameters to be
initialized, so do that to make sure they cannot be left uninitialized.

Signed-off-by: Jouni Malinen <j@w1.fi>
2014-03-02 17:15:12 +02:00
Jouni Malinen fa0a9f536c trace: Fix memory use on no-function name path
bfd_demangle() call could be skipped if data.function == NULL. Make sure
the already freed aname pointer cannot be used again in such a case.

Signed-off-by: Jouni Malinen <j@w1.fi>
2014-03-02 17:15:12 +02:00
Jouni Malinen d12eb581f9 test: Use more consistent NULL checking for associate ssid parameter
This was checked once against NULL, but not on the following uses.

Signed-off-by: Jouni Malinen <j@w1.fi>
2014-03-02 17:15:11 +02:00
Jouni Malinen bd27b1360f Make code path easier for static analyzers
record->type == NULL case was handled through the record->type_length
comparison. While this was correct, it is a bit difficult for static
analyzers to understand, so add an extra check for NULL to avoid false
reports on this.

Signed-off-by: Jouni Malinen <j@w1.fi>
2014-03-02 17:15:11 +02:00
Jouni Malinen 2efdbde276 tests: Verify offchannel TX using remain-on-channel
This is the older design that some drivers may still use if they do not
support offloaded offchannel TX operations.

Signed-off-by: Jouni Malinen <j@w1.fi>
2014-03-02 10:35:34 +02:00
Jouni Malinen 64abb725ba nl80211: Allow old r-o-c offchannel TX to be tested
no_offchannel_tx=1 driver parameter can now be used to force the older
remain-on-channel -based offchannel TX design to be used with
mac80211_hwsim. This can be used to increase test coverage with the
hwsim test cases.

Signed-off-by: Jouni Malinen <j@w1.fi>
2014-03-02 10:35:34 +02:00
Jouni Malinen 932be82c48 tests: Increase coverage for NAI Realm to EAP configuration
Signed-off-by: Jouni Malinen <j@w1.fi>
2014-03-02 10:35:34 +02:00
Jouni Malinen 8058412266 tests: Check roaming consortium match in all different places
A bit different code path is used to match the first three different
locations of roaming consortium OI within Beacon frame.

Signed-off-by: Jouni Malinen <j@w1.fi>
2014-03-02 10:35:34 +02:00
Jouni Malinen 97de642ae3 tests: HS 2.0 OSU and icon fetch
Signed-off-by: Jouni Malinen <j@w1.fi>
2014-03-02 10:35:34 +02:00
Jouni Malinen 75f6134dd4 tests: GAS comeback protocol testing
Signed-off-by: Jouni Malinen <j@w1.fi>
2014-03-02 10:35:34 +02:00
Jouni Malinen c61e5a822c tests: Verify TEMP-DISABLED flag in HS 2.0 deauth req
Signed-off-by: Jouni Malinen <j@w1.fi>
2014-03-02 10:35:34 +02:00
Jouni Malinen 16ab63f4dd tests: Check Interworking already-connected with all credential types
Signed-off-by: Jouni Malinen <j@w1.fi>
2014-03-02 10:35:34 +02:00
Jouni Malinen e2afdef223 tests: Verify excluded_ssid with all credential types
Signed-off-by: Jouni Malinen <j@w1.fi>
2014-03-02 10:35:34 +02:00
Jouni Malinen 0b651713bf tests: Speed up INTERWORKING_SELECT cases with freq parameter
This removes unnecessary full scan from couple of test cases that missed
this optimization.

Signed-off-by: Jouni Malinen <j@w1.fi>
2014-03-02 10:35:34 +02:00
Jouni Malinen a3dd04781c tests: Increase req_conn_capab coverage
Signed-off-by: Jouni Malinen <j@w1.fi>
2014-03-02 10:35:34 +02:00
Jouni Malinen 9714fbcdcc tests: HS 2.0 minimum bandwidth policy
Signed-off-by: Jouni Malinen <j@w1.fi>
2014-03-02 10:35:33 +02:00
Jouni Malinen 0fc743f24e tests: Add more coverage for SET_NETWORK parsing
Signed-off-by: Jouni Malinen <j@w1.fi>
2014-03-02 10:35:33 +02:00
Jouni Malinen 14bef66d66 tests: Server certificate with both client and server EKU
Signed-off-by: Jouni Malinen <j@w1.fi>
2014-03-02 10:35:33 +02:00
Jouni Malinen 1221639d45 tests: HS 2.0 network selection with username vs. SIM credential
Signed-off-by: Jouni Malinen <j@w1.fi>
2014-03-02 10:35:33 +02:00
Jouni Malinen 9d756af73e tests: Verify RADIUS functionality over IPv6
Signed-off-by: Jouni Malinen <j@w1.fi>
2014-03-02 10:35:33 +02:00
Jouni Malinen fa72a880ed P2P: Fix validation on Invitation Request error path
It was possible for the error path to try to use P2P Group ID attribute
even if one was not included in the message. This could result in
dereferencing a NULL pointer, so re-check the pointer before copying the
data.

Signed-off-by: Jouni Malinen <j@w1.fi>
2014-03-02 10:35:33 +02:00
Jouni Malinen ca412c7a38 Remove unreachable return statement
Signed-off-by: Jouni Malinen <j@w1.fi>
2014-03-02 10:35:33 +02:00
Jouni Malinen 2af4d87fc3 GAS: Fix additional comeback delay with status code 95
The special case of non-zero status code used in a GAS Comeback Response
frame to indicate that additional delay is needed before the response is
available was not working properly. This case needs to allow the status
code check to be bypassed for the comeback case prior to having received
any response data.

Signed-off-by: Jouni Malinen <j@w1.fi>
2014-03-01 17:06:20 +02:00
Jouni Malinen 07d462c7b7 Interworking: Remove unused password setting for SIM credential
The simulated SIM/USIM case uses a separate milenage cred parameter, so
this cred password parameter was unused for this credential type.

Signed-off-by: Jouni Malinen <j@w1.fi>
2014-03-01 17:06:20 +02:00
Jouni Malinen 3141b82c16 Add OSEN to proto config field writer
This was forgotten from the OSEN addition where it was parsed, but not
written to a network block.

Signed-off-by: Jouni Malinen <j@w1.fi>
2014-03-01 10:49:18 +02:00
Jouni Malinen b908c50a81 Clear hostapd bss entry to NULL on add-interface-failure
It looks like leaving behind the freed pointed at the end of the array
could end up in a crash triggered by double free in some cases.

Signed-off-by: Jouni Malinen <j@w1.fi>
2014-03-01 00:38:04 +02:00
Kyeyoon Park 0052ce499a atheros: Add support for OSEN
Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
2014-03-01 00:38:04 +02:00
Jouni Malinen 06c7b7f0b5 HS 2.0R2: Fix temporary network disabling in Deauth Req case
Commits 7ef6947993 and
533536d82a added this temporarily
disabling case, but those commits were merged in without having been
converted to the new os_reltime design used for ssid->disabled_until.
Consequently, they ended up disabling the network for 44 years or so too
long time (depending on what values the relative timestamp had
accummulated so far). Fix this by using relative timestamps
consistently.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
2014-02-28 00:29:34 +02:00
Jouni Malinen cfa57df68d tests: Verify that home operator is preferred over roaming operator
Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
2014-02-27 19:34:34 +02:00
Jouni Malinen 10b3cc6791 tests: Verify HS 2.0 connection status values
Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
2014-02-27 19:26:50 +02:00
Jouni Malinen eaff34588c tests: Verify HS 2.0 cred selection based on priority
Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
2014-02-27 19:23:14 +02:00
Jouni Malinen a1281b9f45 tests: Verify HS 2.0 AP connection with non-HS 2.0 station
Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
2014-02-27 19:04:56 +02:00
Jouni Malinen 180cd73dc8 tests: Optimize ap_wps_init_through_wps_config
Wait a bit between WPS_CONFIG command and the first scan. This can avoid
an extra five second wait due to having to scan again if the initial
scan operations happens to be quick enough to happen before the AP has
updated its configuration.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
2014-02-27 18:01:32 +02:00
Jouni Malinen c5c2d942c5 P2P: Cancel offchannel TX wait on PD Response TX status
PD Response is sent out using a 200 ms offchannel wait, but that wait
was not cancelled on TX status report. This could result in offchannel
operation being left waiting unnecessarily long. Fix this by making the
P2P_NO_PENDING_ACTION case in Action TX callback cancel the wait if a
pending wait is marked (and mark this for PD Response).

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
2014-02-27 16:38:27 +02:00
Sunil Dutt Undekari 1578796a31 TDLS: Work around interop issues with supported operating class
It looks like some deployed devices may send an invalid supported
operating class element (length = 0) in TDLS Setup messages. With
cfg80211, this results in the NL80211_CMD_SET_STATION command failing
due to an invalid argument (cfg80211 mandates supported operating
classes information to have a length of 2..253 octets).

Work around this interop issue by ignoring the Supported Operating Class
element if it has invalid length.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
2014-02-27 16:38:14 +02:00
Jouni Malinen a96066a5d3 tests: Verify cred vs. network block priority selection
This verifies that 'INTERWORKING_SELECT auto' is able to pick the
correct network based on priority configuration when connected to a
lower priority network.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
2014-02-27 14:17:31 +02:00
Jouni Malinen b7fb98f072 Interworking: Fix already-connected check to verify network priority
Commit d28f4e44f1 optimized Interworking
network selection in a case where the operation is run while already
connected to the selected network by skipping the reconnection. However,
this did not take into account that a higher priority network may have
shown up in the new scan results.

Fix this by checking whether network selection based on the latest scan
results (the ones from the interworking_select operation) would result
in a network with higher priority being selected. If so, skip the
optimization and force normal network connection (which will select this
newly found higher priority network). This fixes cases where a
non-Hotspot 2.0 network with higher priority (e.g., home network) shows
up while connected to a Hotspot 2.0 network with lower priority.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
2014-02-27 14:06:23 +02:00
Jouni Malinen 7c373ac267 Interworking: Fix last-network preference to not override priority
Commit 3d910ef497 tried to make
last-network selection behave more consistently with Interworking
network selection preferences. However, it did not take into account
that other network block may have higher priority. In such cases, the
last added network from Interworking network selection should actually
not be selected for the next connection. Fix this by limiting the
last-network preference to work only within a priority class.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
2014-02-27 13:47:23 +02:00
Jouni Malinen 1815317906 tests: Verify req_conn_capab as cred parameter
Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
2014-02-27 00:49:52 +02:00
Jouni Malinen f54e92433e HS 2.0R2: Fix req_conn_capab example
Protocol field needs to be separated properly from te port number list.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
2014-02-27 00:43:58 +02:00
Jouni Malinen 2ded0539c2 tests: wpa_supplicant ctrl_iface config parser
Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
2014-02-26 18:48:12 +02:00
Jouni Malinen af70a09332 tests: Verify invalid required_roaming_consortium values
Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
2014-02-26 18:35:43 +02:00
Jouni Malinen 9e709315d9 tests: Verify HS 2.0 OSEN connection
Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
2014-02-26 18:10:08 +02:00
Jouni Malinen 5e32f8256f tests: Verify HS 2.0R2 deauthentication request
Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
2014-02-26 01:24:25 +02:00
Jouni Malinen 5f1e31cfc8 tests: Add update_identifier to one of the HS 2.0 test cases
This allows debug logs to be used to verify byte order in the
PPS MO ID fields.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2014-02-26 01:24:25 +02:00
Jouni Malinen 1965cc3aa8 tests: Verify HS 2.0 excluded AP reporting
Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
2014-02-26 01:24:25 +02:00