driver_nl80211: Add support for DRIVER RXFILTER command

Add support for this Android specific feature using WoWLAN packet
pattern triggers.

Signed-off-by: Pontus Fuchs <pontus.fuchs@tactel.se>
driver_nl80211: rx filters - add support for longer patterns

- Add support for long patterns (longer than 8 bytes)
- Separate Rx filters static configuration from code
- Add DHCP and ARP Rx filters

Signed-off-by: Eyal Shapira <eyal@wizery.com>
Signed-off-by: Assaf Azulay <assaf@ti.com>
driver_nl80211: Add and align rx filters IDs

Add more patterns (SSDP, ARP, DHCP) and align IDs to a common
vendor Android framework implementation.
Note that ARP pattern shouldn't be used as our FW
responds to ARPs by default without waking up the host.
It is added only for ID alignments purposes.

Signed-off-by: Eyal Shapira <eyal@wizery.com>
driver_nl80211: Enable only unicast RXFILTER by default

In GB the framework always enabled RXFILTER for unicast
and bcast. This seems to be missing in ICS so enable
unicast by default as this is always required.

Signed-off-by: Pontus Fuchs <pontus.fuchs@gmail.com>
Signed-off-by: Eyal Shapira <eyal@wizery.com>
nl80211: add support for drop rx filters

Enable configuring rx filters which will be
dropped even if matching another rx filter. This
can be used for generating exception filters.

Signed-off-by: Eyal Shapira <eyal@wizery.com>
wpa_supplicant: VERSION_STR_POSTFIX is now defined to 'git describe'
nl80211: fix extending shared_freq detection to AP/GO (BRCM)

Commit d3bd0f "nl80211: Extend shared_freq to handle AP/GO mode interfaces"
still discards AP/GO interfaces so effectively shared_freq
won't work on AP/GO interaces like intended.

Signed-off-by: Eyal Shapira <eyal@wizery.com>
nl80211: make rx filters config global (ANDROID)

The RX filters (wowlan) configuration is per interface
but this doesn't reflect the state in the kernel where it's
per hw device (effectively in Android global).
In JB this is more important as wpa_s uses up to 3 different
interfaces when running P2P+STA. Also, fix a minor bug
in nl80211_toggle_wowlan_trigger where the wpa_s wowlan state
changed even if configuring the kernel failed.

Signed-off-by: Eyal Shapira <eyal@wizery.com>
nl80211: support configuring RX filters dynamically (ANDROID)

The current RX filters are statically defined and can only
be enabled or disabled by the DRIVER RX-FILTER commands.
Add support to add or remove RX filters "on the fly" from
within wpa_s code so we can use this to add an RX filter matching
unicast packets going to the new P2P interface mac.
Whenever the filters change the whole list of filters needs
to be configured to the kernel.

Signed-off-by: Eyal Shapira <eyal@wizery.com>
nl80211: reconfigure RX filters whenever a new interface is added (ANDROID)

This is used to reconfigure RX filters to include a new filter whenever
the P2P group interface is added. The new filter matches any unicast
frame sent to a dest mac which matches the P2P group interface mac.
This is important as otherwise we wouldn't allow any data frames through
to this interface.

Signed-off-by: Eyal Shapira <eyal@wizery.com>
nl80211: make unicast RX filter always match STA iface mac (ANDROID)

This is part of changing the RX filters configuration to being
global and not dependent on the interface context.
RX filter #0 should point to a filter matching any unicast frame
sent to the STA (wlan0) mac. The configuration is done by
querying the mac address of the interface. As we now have
reconfiguration of filters done from the context of the p2p interface
filter #0 would get reconfigured with the P2P dev mac.
Avoid this by hard coded querying for the mac of wlan0 when
creating the pattern for RX filter #0.

Signed-off-by: Eyal Shapira <eyal@wizery.com>
P2P: cancel action frame offchan wait after recv go neg conf

The missing call to scan_action_done keeps us offchan
on the listen channel for 250ms following sending go neg resp.
In case the oper channel is different from the listen channel
and we're GO a race could lead to start beaconing while offchan.
This causes the beacons to go out on the listen channel instead
of the oper channel.

Signed-off-by: Eyal Shapira <eyal@wizery.com>
wpa_s: fix bss selection on identical SSIDs with WEP+AES/TKIP

Configuring two identical SSIDs - one with WEP-SHARED
security and one with AES/TKIP breaks any authentication
attempt with WEP-SHARED SSID.

Reason for this behavior is that during BSS selection
from the priority group wrong BSS (with AES/TKIP) was
selected. Fix this by disallowing "non-WPA/WPA2" BSS
selection with defined rsn_ie/wpa_ie.

Signed-off-by: Victor Goldenshtein <victorg@ti.com>
Avoid normal scans before sched scan if max_scan_ssids=1 (UPSTREAM)

In the case of max_scan_ssids=1 we may fallback to normal scan
if there's a single scan_ssid network. However the normal scan
can't add a wildcard SSID to the ssid list as it's limited to a single
entry. This delays getting broadcast scan results.
Always prefer to do a sched scan in such a case.

Signed-off-by: Eyal Shapira <eyal@wizery.com>
P2P: cancel action frame offchan wait after recv go neg resp (UPSTREAM)

A wait of 200ms is configured after sending the go neg request.
The go neg process can end quickly within less than 200ms. If this wait
isn't canceled it can cause the beaconing of the GO to start while
mac80211 is still off channel on the listen channel and this may cause
beaconing on the wrong channel if oper channel is different from
the listen channel.

Signed-off-by: Eyal Shapira <eyal@wizery.com>
P2P: Fix broken rx action frame handling (INTERNAL)

The root cause of the duplication lies within the Rx path in mac80211
in Johannes` patch "mac80211: accept public action frames with mismatched BSSID".
When wpa_s works with a separate group interface this creates a duplicated Rx
on both the P2P dev interface and the GO interface.

Fix the issue by canceling the duplication in wpa_s and discarding
public action frames with unmatching bssid arriving on a dedicated GO interface

[Arik - for upstream we can't do this since it can break non-mac80211
drivers. Maybe set a flag in wiphy capabilities for when the kernel driver
does this?]

Signed-off-by: Eyal Shapira <eyal@wizery.com>
hostapd: enable dynamic modification of acl policy

add APIs for dynamically changing the macaddr_acl
policy and mac addresses lists.
once changed, hostapd will deauth stations which
do not pass the new policy.

Signed-off-by: Nadim Zubidat <nadimz@ti.com>
wpa_s: don't accumulate delayed sched scan requests (UPSTREAM)

Clear any previous pending timeouts before scheduling
a new delayed sched scan.

Signed-off-by: Victor Goldenshtein <victorg@ti.com>
Do not sched scan if no enabled networks (UPSTREAM)

There is no point to sched scan when there are no enabled networks.
With some drivers initiating such an empty sched scan causes
returning of scan results with zero results. If this is repeated
it leads to clearing of wpa_s scan results.

Signed-off-by: Eyal Shapira <eyal@wizery.com>
Avoid changing state to WPA_SCANNING for sched scan (UPSTREAM)

This prevents manual scan requests from the control iface
in case of sched scan and normal scan can run concurrently.

Signed-off-by: Eyal Shapira <eyal@wizery.com>