tests: Verify HS 2.0 OSEN connection

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
tests: Verify invalid required_roaming_consortium values

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
tests: wpa_supplicant ctrl_iface config parser

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
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>
tests: Verify req_conn_capab as cred parameter

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
Interworking: Fix last-network preference to not override priority

Commit 3d910ef497b11e149cf41e772670f7a7fe3a1e19 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>
Interworking: Fix already-connected check to verify network priority

Commit d28f4e44f10a8549d969e5434f7d4d16f462dfcc 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>
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>
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>
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>
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>
tests: Verify HS 2.0 AP connection with non-HS 2.0 station

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
tests: Verify HS 2.0 cred selection based on priority

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
tests: Verify HS 2.0 connection status values

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
tests: Verify that home operator is preferred over roaming operator

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
HS 2.0R2: Fix temporary network disabling in Deauth Req case

Commits 7ef6947993d4b09dea6797b96f34dbcfed57d90e and
533536d82ac63512c31ff0bae403d437392d34e0 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>
atheros: Add support for OSEN

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
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>
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>
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>