aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEyal Shapira <eyal@wizery.com>2012-09-12 02:30:00 +0300
committerEyal Shapira <eyal@wizery.com>2012-09-13 02:53:38 +0300
commitd4ae515851ff23bb8d0e79ebf629fe88c40646f1 (patch)
tree5bf546c25e4244bc2c4fc0aaab6e5528f620a7e1 /src
parent5d3dfd23c978a9a74194ab881617dff3e70a94b5 (diff)
downloadexternal_wpa_supplicant_8_ti-d4ae515851ff23bb8d0e79ebf629fe88c40646f1.zip
external_wpa_supplicant_8_ti-d4ae515851ff23bb8d0e79ebf629fe88c40646f1.tar.gz
external_wpa_supplicant_8_ti-d4ae515851ff23bb8d0e79ebf629fe88c40646f1.tar.bz2
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>
Diffstat (limited to 'src')
-rw-r--r--src/drivers/driver_nl80211.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
index d29095e..e0bf84f 100644
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -207,6 +207,10 @@ struct i802_bss {
struct nl80211_wiphy_data *wiphy_data;
struct dl_list wiphy_list;
+
+#ifdef ANDROID
+ int rx_filter_idx;
+#endif
};
struct wpa_driver_nl80211_data {
@@ -3011,6 +3015,9 @@ static void * wpa_driver_nl80211_init(void *ctx, const char *ifname,
bss = &drv->first_bss;
bss->drv = drv;
os_strlcpy(bss->ifname, ifname, sizeof(bss->ifname));
+#ifdef ANDROID
+ bss->rx_filter_idx = -1;
+#endif
drv->monitor_ifidx = -1;
drv->monitor_sock = -1;
drv->eapol_tx_sock = -1;
@@ -7961,6 +7968,10 @@ static int wpa_driver_nl80211_if_add(void *priv, enum wpa_driver_if_type type,
struct i802_bss *bss = priv;
struct wpa_driver_nl80211_data *drv = bss->drv;
int ifidx;
+#ifdef ANDROID
+ int filter_idx;
+#endif
+
#ifdef HOSTAPD
struct i802_bss *new_bss = NULL;
@@ -8021,6 +8032,26 @@ static int wpa_driver_nl80211_if_add(void *priv, enum wpa_driver_if_type type,
}
#endif /* CONFIG_P2P */
+#if defined(ANDROID) && !defined(HOSTAPD)
+ static u8 eth_addr_mask[] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
+
+ filter_idx = nl80211_register_rx_filter(bss, "unicast",
+ if_addr, ETH_ALEN,
+ eth_addr_mask,
+ NL80211_WOWLAN_ACTION_ALLOW);
+ if (filter_idx < 0) {
+ nl80211_remove_iface(drv, ifidx);
+ return -1;
+ }
+
+ if (bss->rx_filter_idx != -1)
+ wpa_printf(MSG_WARNING, "nl80211: Rx filter is already "
+ "configured when it shouldn't be (idx=%d)",
+ bss->rx_filter_idx);
+
+ bss->rx_filter_idx = filter_idx;
+#endif /* ANDROID && !HOSTAPD */
+
#ifdef HOSTAPD
if (bridge &&
i802_check_bridge(drv, new_bss, bridge, ifname) < 0) {
@@ -8093,6 +8124,10 @@ static int wpa_driver_nl80211_if_remove(void *priv,
nl80211_remove_iface(drv, ifindex);
+#ifdef ANDROID
+ nl80211_unregister_rx_filter(bss, bss->rx_filter_idx);
+#endif
+
#ifdef HOSTAPD
if (type != WPA_IF_AP_BSS)
return 0;