Fix scan-cache-clearing operation to avoid unnecessary cases

wpa_drv_scan() success case was supposed to clear
wpa_s->clear_driver_scan_cache, not params->only_new_results (which
would do nothing here).

Signed-hostap: Jouni Malinen <j@w1.fi>
tests: Remove ignore_old_scan_res workaround

Now that wpa_supplicant requests the driver (cfg80211) to clear its scan
cache automatically after each BSS_FLUSH/FLUSH command, the previously
used ignore_old_scan_res workaround should not be needed for the hwsim
test cases anymore.

Signed-hostap: Jouni Malinen <j@w1.fi>
tests: Clean up and optimize gas_concurrent_scan and _connect

No need to run a full scan as the first step since it only needs to find
the AP from a known channel for the GAS operation.

Signed-hostap: Jouni Malinen <j@w1.fi>
tests: Fix unit test linking after reltime changes

librt needs to be linked in with older glibc versions.

Signed-hostap: Jouni Malinen <j@w1.fi>
Remove duplicated RX ctrl_iface hexdump

The newer wpa_dbg() print includes the same information in a more
convenient form, so remove the duplicate RX ctrl_iface hexdump in the
cases where there is no key material in the control interface commands
(the possible-key-material case is still using wpa_hexdump_ascii_key).

Signed-hostap: Jouni Malinen <j@w1.fi>
Use cleaner debug print for ctrl_iface commands with private info

Convert this to a text string instead of ASCII hexdump to make the
debug log more convenient to use.

Signed-hostap: Jouni Malinen <j@w1.fi>
Clean up ctrl_iface debug prints for monitor events

Signed-hostap: Jouni Malinen <j@w1.fi>
Ignore externally triggered scan results with scan_res_handler

wpa_s->scan_res_handler is set only for cases where a scan operation is
requested for a specific purpose. As such, this callback should only be
called when a scan result from a scan that was triggered by
wpa_supplicant is processed.

Signed-hostap: Jouni Malinen <j@w1.fi>
Add helper functions for cloning and freeing scan parameters

Signed-hostap: Jouni Malinen <j@w1.fi>
Add framework for exclusive radio operations

The new radio work item concept can be used to request time for an
operation that requires exclusive radio control, e.g., a scan. Once the
radio is available, the registered callback function will be called.
radio_work_done() must be called once the exclusive radio operation has
been completed, so that the radio is freed for other operations. The
special case of deinit=1 is used to free the context data during
interface removal. That does not allow the callback function to start
the radio operation, i.e., it needs to free the allocated resources
and return.

Signed-hostap: Jouni Malinen <j@w1.fi>
Use radio work for scan requests

Avoid concurrent scan requests by using the radio work queuing
mechanism.

Signed-hostap: Jouni Malinen <j@w1.fi>
Use radio work for P2P scan requests

Avoid concurrent P2P scan requests with any other exclusive use of the
radio by using the radio work queuing mechanism. This removes some of
the earlier workarounds that postponed scans depending on other
operations.

Signed-hostap: Jouni Malinen <j@w1.fi>
Use radio work for P2P Listen requests

Avoid concurrent P2P Listen operations with any other exclusive use of
the radio by using the radio work queuing mechanism. This removes some
of the earlier workarounds that postponed scans depending on other
operations.

Signed-hostap: Jouni Malinen <j@w1.fi>
P2P: Use radio work to protect offchannel Action frame exchanges

Signed-hostap: Jouni Malinen <j@w1.fi>
Use radio work for GAS requests

Avoid concurrent GAS operations with any other exclusive use of the
radio by using the radio work queuing mechanism. This replaces some of
the earlier constraints on concurrent operations with the more generic
wpa_radio work concept.

Signed-hostap: Jouni Malinen <j@w1.fi>
Use wpa_radio work for connection

This protects against conflicting offchannel operations during
connection (authentication, association, EAP exchanges, 4-way
handshake).

Signed-hostap: Jouni Malinen <j@w1.fi>
Remove unneeded GAS query delay on connection-in-progress

This type of protection against concurrent connection and offchannel GAS
operations is now enforced through the wpa_radio work mechanism, so this
separate protection mechanism is not needed anymore.

Signed-hostap: Jouni Malinen <j@w1.fi>
Remove unneeded scan delay on connection-in-progress

This type of protection against concurrent connection and scan
operations is now enforced through the wpa_radio work mechanism, so this
separate protection mechanism is not needed anymore.

Signed-hostap: Jouni Malinen <j@w1.fi>
tests: Verify cfg80211 connect API with concurrent operation

Signed-hostap: Jouni Malinen <j@w1.fi>
Do not start wpa_radio work during externally triggered scan

If an external program triggers a scan, wpa_supplicant does not have a
wpa_radio work item for this operation to protect against other
offchannel operations. This can result in operations failing, so try to
avoid damage by not starting any new wpa_radio work items during a scan
that was started by another process.

Signed-hostap: Jouni Malinen <j@w1.fi>