The latest update of hostapd broke brcmfmac due to upstream regression.
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
--- /dev/null
+From 23dc11dfbd8e78a2450120e9afc83c1d32a8e683 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
+Date: Mon, 12 Sep 2016 19:02:34 +0200
+Subject: [PATCH] Revert "nl80211: Remove duplicated check in
+ nl80211_setup_ap()"
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+This reverts commit 647862eb60c324015ea31293cc052558b5185ca4.
+
+The second check of device_ap_sme looks like duplicated, but it isn't
+actually. The trick is nl80211_create_monitor_interface may change that
+variable value and the second evaluation may give a different result.
+
+This definitely isn't a very clear code, but that change caused a
+regression for drivers that:
+1) Don't report NL80211_ATTR_DEVICE_AP_SME
+2) Don't support monitor mode
+3) Don't support subscribing for PROBE_REQ and/or ACTION frames
+like brcmfmac. With such drivers hostapd doesn't start anymore.
+
+Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
+---
+ src/drivers/driver_nl80211.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+--- a/src/drivers/driver_nl80211.c
++++ b/src/drivers/driver_nl80211.c
+@@ -4434,7 +4434,8 @@ static int nl80211_setup_ap(struct i802_
+ "nl80211: Failed to subscribe for mgmt frames from SME driver - trying to run without it");
+
+ if (!drv->device_ap_sme && drv->use_monitor &&
+- nl80211_create_monitor_interface(drv))
++ nl80211_create_monitor_interface(drv) &&
++ !drv->device_ap_sme)
+ return -1;
+
+ if (drv->device_ap_sme &&
if (drv->eapol_sock >= 0) {
eloop_unregister_read_sock(drv->eapol_sock);
-@@ -4462,8 +4467,7 @@ static void nl80211_teardown_ap(struct i
+@@ -4463,8 +4468,7 @@ static void nl80211_teardown_ap(struct i
nl80211_remove_monitor_interface(drv);
else
nl80211_mgmt_unsubscribe(bss, "AP teardown");
}
-@@ -6472,8 +6476,6 @@ static int wpa_driver_nl80211_if_remove(
+@@ -6473,8 +6477,6 @@ static int wpa_driver_nl80211_if_remove(
} else {
wpa_printf(MSG_DEBUG, "nl80211: First BSS - reassign context");
nl80211_teardown_ap(bss);
nl80211_destroy_bss(bss);
if (!bss->added_if)
i802_set_iface_flags(bss, 0);
-@@ -6835,8 +6837,7 @@ static int wpa_driver_nl80211_deinit_ap(
+@@ -6836,8 +6838,7 @@ static int wpa_driver_nl80211_deinit_ap(
struct wpa_driver_nl80211_data *drv = bss->drv;
if (!is_ap_interface(drv->nlmode))
return -1;
/*
* If the P2P GO interface was dynamically added, then it is
-@@ -6855,8 +6856,7 @@ static int wpa_driver_nl80211_stop_ap(vo
+@@ -6856,8 +6857,7 @@ static int wpa_driver_nl80211_stop_ap(vo
struct wpa_driver_nl80211_data *drv = bss->drv;
if (!is_ap_interface(drv->nlmode))
return -1;
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
-@@ -4721,7 +4721,7 @@ static int wpa_driver_nl80211_ibss(struc
+@@ -4722,7 +4722,7 @@ static int wpa_driver_nl80211_ibss(struc
struct wpa_driver_associate_params *params)
{
struct nl_msg *msg;
int count = 0;
wpa_printf(MSG_DEBUG, "nl80211: Join IBSS (ifindex=%d)", drv->ifindex);
-@@ -4748,6 +4748,37 @@ retry:
+@@ -4749,6 +4749,37 @@ retry:
nl80211_put_beacon_int(msg, params->beacon_int))
goto fail;
* bssid_hint - BSSID of a proposed AP
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
-@@ -4779,6 +4779,22 @@ retry:
+@@ -4780,6 +4780,22 @@ retry:
nla_put_u32(msg, NL80211_ATTR_MCAST_RATE, params->mcast_rate);
}