nl80211: Fix TDLS key configuration to not set TX key index

The nl80211 command for setting the TX index does not distinguish TDLS
vs. AP key and as such, the driver would not know what this set TX key
index operation is doing in the TDLS case. This could result in the TX
key index for AP being changed instead if static WEP is used in the AP
connection. Fix the issue by not setting TX key index when configuring a
TDLS key.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
P2P: Do not delay retries on failure during group formation

4-way handshake may fail under extremely noisy environment and if this
happens during P2P group formation, the 10 second extra delay added in
wpas_auth_failed() can result in running over the 15 second timeout.

Avoid this by skipping the delay mechanism in wpas_auth_failed() for the
P2P group formation case. The P2P formation timeout will take care of
stopping the attempts if the failure condition does not get resolved.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
P2P: Fix invalid remain-on-channel duration for frame TX

cfg80211 does not allow the zero duration of remain-on-channel. Instead,
use 20 ms as default waiting time when remain-on-channel is used to
schedule offchannel transmission that does not expect a response.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
TDLS: Handle transmission failures of TPK Handshake messages

A transmission failure of the TDLS Setup Request frame (TPK Handshake
M1) results in no further retries and the peer entry being left in state
where all TDLS Setup Request frames from the peer with higher address
would be rejected, thus always resulting in a failure to establish a
TDLS link. Handle the failures in transmission by disabling the link
immediately to ensure the traffic to the peer goes through the AP. This
commit also handles similar transmision failures for TPK Handshake M2
and M3 frames (TDLS Setup Response and Confirm).

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
P2P: Reject p2p_find while P2P connection is in progress

Though p2p_find is not expected during ongoing P2P connection, it is
possible that any third party application issues a p2p_find resulting in
connection failure. Address this by rejecting any p2p_find command while
connection is in progress.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
Revert "P2P: Reject p2p_find while P2P connection is in progress"

This reverts commit ce970851af76ed96d203d56c660c73ba02c99673.

It turned out that this breaks lots of use cases where p2p_find is
issued while already in p2p_listen state. As such, we cannot reject
p2p_find this easily without checking for more specific cases.

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

Everything in hostapd can be implemented efficiently without vlan_tail.

Signed-hostap: Michael Braun <michael-dev@fami-braun.de>
nl80211: Add stop AP mode event API

Stop AP command can be used by the driver as an event to indicate that
AP mode has stopped operation. WLAN driver may have encountered errors
that has forced the driver to report this event or concurrent operations
on virtual interfaces may have forced AP operation to be stopped. When
in P2P GO mode, wpa_supplicant uses this event to remove P2P group to
keep in sync with the driver state.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
bsd: Skip SIOCSIFFFLAGS ioctl when there is no change.

Don't issue SIOCSIFFLAGS if the interface is already up or already down.

Signed-hostap: Rui Paulo <rpaulo@FreeBSD.org>
bsd: Set IEEE80211_KEY_NOREPLAY in IBSS/AHDEMO mode

Signed-hostap: Rui Paulo <rpaulo@FreeBSD.org>
bsd: Compute the RSSI level

Signed-hostap: Rui Paulo <rpaulo@FreeBSD.org>
bsd: Mark the interface down before opening the routing socket

Signed-hostap: Rui Paulo <rpaulo@FreeBSD.org>
bsd: Mark define sta_set_flags() only for hostapd

Signed-hostap: Rui Paulo <rpaulo@FreeBSD.org>
bsd: Add a commit routine

Signed-hostap: Rui Paulo <rpaulo@FreeBSD.org>
WEP: Remove VLAN support from hostapd

This removes WEP with VLAN support and thus avoids increasing
complexity for tagged VLANs.

Signed-hostap: Michael Braun <michael-dev@fami-braun.de>
VLAN: Simplify no-WEP with VLAN check

No need to have a local variable and two #ifndef blocks for this.

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