diff mbox

Revert "nl80211: Remove duplicated check in nl80211_setup_ap()"

Message ID 20160912172822.10879-1-zajec5@gmail.com
State Accepted
Headers show

Commit Message

Rafał Miłecki Sept. 12, 2016, 5:28 p.m. UTC
From: Rafał Miłecki <rafal@milecki.pl>

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(-)

Comments

Jouni Malinen Sept. 17, 2016, 7:51 p.m. UTC | #1
On Mon, Sep 12, 2016 at 07:28:22PM +0200, Rafał Miłecki wrote:
> 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.

Thanks, applied.
diff mbox

Patch

diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
index 8d43c69..24154b9 100644
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -4434,7 +4434,8 @@  static int nl80211_setup_ap(struct i802_bss *bss)
 				   "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 &&