nl80211: Fix deauth/disassoc for AP mode SME-in-driver case

When the driver (or firmware) implements AP mode SME, the use of raw
management frame TX functions is not working properly at the moment. As
an initial step, convert these AP mode operations to use
NL80211_CMD_DEL_STATION and do not claim that driver provides TX status
for deauth/disassoc frames. While this does not address all use cases
(e.g., reason code is not specified in the command), this fixes number
of issues where the station does not get disconnected properly.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
wlantest: Update STA info based on WPA/RSN IE in EAPOL-Key 2/4

The WPA/RSN IE in EAPOL-Key 2/4 is more reliable than the one in
(Re)Association Request frame. Update the STA info base don the
EAPOL-Key frame so that the correct cipher information is used
even if the (Re)Association Request frame is missing or corrupted
in the capture.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
P2P: Validate p2p_oper_channel in p2p_group_add

If the p2p_group_add command does not specify the operating channel,
make sure the operating channel set in the configuration file meets
the P2P requirements in the same way as is done with the frequency
specified as the command parameter.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
P2P: Do not use group idle timeout during provisioning

Use the normal group formation timeout during the provisioning phase to
avoid terminating this process too early due to group idle timeout.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
Sync with include/linux/nl80211.h from wireless-testing.git

Signed-hostap: Jouni Malinen <j@w1.fi>
wpa_supplicant: Add provision to configure inactivity period in AP mode

This patch adds a configuration in network block, ap_max_inactivity, for
station's inactivity period when in AP mode. The time period is
configured in seconds, by default 300 seconds.

Signed-hostap: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>
nl80211: Make use of driver's capability to detect inactive stations

When drivers advertise their capability to free up inactive
stations based on ap_max_inactivity, send the inactivity period
timeout to driver in NL80211_ATTR_INACTIVITY_TIMEOUT. This
introduces a WPA_DRIVER_FLAGS (WPA_DRIVER_FLAGS_INACTIVITY_TIMER)
so that the inactivity period will be sent only when this capability
bit is set.

Signed-hostap: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>
Fix eapol_test build without CONFIG_PCSC=y

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
Stop sched_scan if requested to run full scan

This allows the ctrl_iface SCAN command to be used to run through a scan
to collect full scan results when sched_scan is in progress. sched_scan
will be re-started automatically after the full scan.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
P2P: Add support for preferred channel list

p2p_pref_chan configuration parameter can now be used to set the
list of preferred channel for P2P GO Negotiation. This will be used
in the priority order if the peer does not support the channel we
are trying to use as the GO (configured operating channel or the
best 2.4 GHz/5 GHz channel) for the case where a forced channel is
not used.

p2p_pref_chan=<op class:channel>,...

For example:
p2p_pref_chan=81:1,81:2,81:3,81:4,81:5,81:6

This would configure 2.4 GHz channels 1-6 as the preferred ones with
channel 1 the most preferred option.

These configuration parameters can be set in wpa_supplicant.conf and
dynamically updated with "wpa_cli set <param> <value>".

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
Add wps_cancel for hostapd_cli

Implement wps_cancel for hostapd similarly to how it was already
supported in wpa_supplicant AP mode.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
TDLS: Add support for TDLS frame RX with bridge interfaces

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
Clear previous BSSID on explicit disconnection request

There is no need to use reassociation instead of association in a case
the previous connection was explicitly disconnected.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
Interworking: Disconnect before trying interworking reconnection

Make the connection change on Interworking network selection cases
clearer by forcing the previous association to be dropped before trying
to start a new one.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
Interworking: Add realm to the anonymous identity from realm

If the username part in the credential does not include a realm,
generate one automatically based on the configured realm information.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
Allow background scan period to be configured

A network block specific background scan period can now be configured
for drivers that implement internal background scan mechanism for
roaming and BSS selection.

Signed-hostap: Bala Shanmugam <bkamatch@qca.qualcomm.com>
P2P: Use P2P Device ID attribute if Device Info not available

The "BSS p2p_dev_addr=address" command uses p2p_parse_dev_addr() to
figure out the P2P Device Address of the GO from scan results. This used
to work only if the P2P IE was received from Probe Response frames since
only those include the P2P Device Info attribute. Make this work with
Beacon frames, too, by using P2P Device ID attribute if the P2P Device
Info attribute is not present.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
debug: Add option to log to Linux tracing

Add the option (-T) to wpa_supplicant to log all debug messages into the
kernel tracing, allowing to aggregate kernel debugging with
wpa_supplicant debugging and recording all with trace-cmd.

Since tracing has relatively low overhead and can be filtered
afterwards, record all messages regardless of log level. However, it
will honor the -K option and not record key material by default.

Signed-hostap: Johannes Berg <johannes.berg@intel.com>
Clean up: Replace standard lib methods with os.h ones

Some of the standard lib functions being used directly are redefined in
src/utils/os.h thus providing an abstraction. Change code to use os_*
functions instead of directly using the lib functions.

Signed-hostap: Nirav Shah <nirav.j2.shah@intel.com>
Signed-hostap: Angie Chinchilla <angie.v.chinchilla@intel.com>
nl80211: Report signal strength from nl80211

Report signal strength from nl80211 events to the higher layers.

Signed-hostap: Johannes Berg <johannes.berg@intel.com>