Allow AP mode configuration with VHT enabled on 2.4 GHz

hostapd_set_freq_param() rejected the 20 MHz channel case with
vht_enabled due to the existing validation step including only 5 GHz (to
be more exact, only >= 5000 MHz). While the behavior may not be fully
defined for 2.4 GHz, we can enable this based on driver capability
advertisement to fix automatic VHT selection for P2P use cases.
mac80211_hwsim advertises VHT for 2.4 GHz band and that resulted in
failures when trying to start GO on that band with vht=1 parameter.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
tests: Do not require hlr_auc_gw for HS 2.0 username/password

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
tests: Use dictionary as add_cred_values() parameter

This makes it more convenient to use this function for cases that modify
credential parameters.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
tests: HS 2.0 required roaming consortium

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
tests: HS 2.0 excluded SSID

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
eap_proxy: Re-read IMSI from proxy in Interworking functionality

Try to read the IMSI values through the eap_proxy layer for Interworking
functionality again if the value was not available at startup.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
hwsim tests: Check kernel messages for warnings/bugs

When a test passes but the kernel printed warnings, consider
the test to have failed.

Signed-hostap: Johannes Berg <johannes.berg@intel.com>
bgscan: Add global bgscan configuration

This option can be used to globally configure bgscan parameters
for all the network blocks.

Note that this configuration will not override a network block
specific bgscan settings, but will only be used in case that
the network block does not have a valid bgscan configuration.

Signed-hostap: Haim Dreyfuss <haim.dreyfuss@intel.com>
EAPOL: Fix static analyzer warnings for pac_opaque_encr_key

The allocation was not verified to complete successfully and the
allocated memory was not freed on error paths.

Signed-hostap: Adriana Reus <adriana.reus@intel.com>
wpa_supplicant: Fix updating GO beacons on WFD subelements change

When WFD Subelements are set, the IE in the Beacon frames of already
existing groups are not updated. This patch fixes this issue by setting
beacon_update to be 1 on WFD IE update.

Signed-hostap: Andrei Otcheretianski <andrei.otcheretianski@intel.com>
wpa_supplicant: Fix bug in get_shared_radio_freqs

The idx variable was mistakenly set to 0 at the beginning of the
interface iteration. This could result in the operating channel of the
interface calling the function from being removed from the returned
frequency array if other interfaces were operating.

Signed-hostap: Ilan Peer <ilan.peer@intel.com>
P2P: Fix bug in GO frequency selection

When trying to choose a frequency that can be used for GO instantiation,
properly check if there are free channels that can be used.

Signed-hostap: Ilan Peer <ilan.peer@intel.com>
P2P: Add more debug prints for frequency selection

This prints out get_shared_radio_freqs() results and related information
from P2P operations to make debug logs more helpful for figuring out
issues related to multi-channel concurrency.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
tests: Handle hostapd dying more gracefully

Catch exceptions from operations that try to remove hostapd interface
and rename the log file. If these operations fail due to socket
connection issues, hostapd has likely died or gotten stuck somewhere.
Report the test case as a failure and stop test run cleanly.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
hostapd: Do not terminate process on dynamic interface add failure

Limit the calls to eloop_terminate() to happen only for the
initialization failure from the interfaces that we specified on the
command line. This allows hostapd process to continue operating even if
a dynamically added interface fails to start up. This allows the upper
layer software to fix a configuration error and retry.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
Remove a compiler warning from -O0 build

It looks like abs() result is signed and gcc warns about this when
running a build with -O0 but not with -O2.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
drivers: Do not call hostapd_logger()

This call requires a struct hostapd_data pointer and that is not really
something that the driver wrappers should be using.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
Remove all BSSs on removal of the first one

The changes in commit 5592065850a40e235020dba79e5592b949b829b8 to allow
any BSS to be removed were a bit too early since there are still number
of areas that use the first BSS as a special case. Especially the
driver_ops API is going to require quite a bit of cleanup before removal
of the first BSS without the other BSSes of the same radio can be done
safely.

For now, force all BSSs to be removed in case the first one is removed.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
Fix removal of a BSS that has not yet been fully initialized

If a secondary BSS is removed while it is waiting for the primary BSS to
complete channel setup (e.g., due to HT co-ex scan, ACS, or DFS), the
hostapd_data instance has not yet been initialized. Fix the BSS removal
code to take this special case into account and not try to deinitialize
the hostapd_data instance that has not yet been started.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
tests: Adjust BSS add/remove test cases for primary BSS constraint

Since removal of the primary BSS is now going to remove all the BSSs
for a radio, these two test cases need changes to not trigger false
failures.

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