Browse Source

nl80211: Fix use_monitor driver capability for non-mac80211 drivers

Poll command may be enough for mac80211 to figure out whether monitor
interface is to be used, but this change did not take into account
non-mac80211 drivers that support AP mode without monitor interface.
For example, ath6kl needs to get use_monitor disabled.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
Jouni Malinen 13 years ago
parent
commit
536062f274
1 changed files with 18 additions and 0 deletions
  1. 18 0
      src/drivers/driver_nl80211.c

+ 18 - 0
src/drivers/driver_nl80211.c

@@ -2269,6 +2269,7 @@ struct wiphy_info_data {
 	unsigned int device_ap_sme:1;
 	unsigned int poll_command_supported:1;
 	unsigned int data_tx_status:1;
+	unsigned int monitor_supported:1;
 };
 
 
@@ -2340,6 +2341,9 @@ static int wiphy_info_handler(struct nl_msg *msg, void *arg)
 			case NL80211_IFTYPE_P2P_CLIENT:
 				p2p_client_supported = 1;
 				break;
+			case NL80211_IFTYPE_MONITOR:
+				info->monitor_supported = 1;
+				break;
 			}
 		}
 	}
@@ -2560,6 +2564,20 @@ static int wpa_driver_nl80211_capa(struct wpa_driver_nl80211_data *drv)
 	 */
 	drv->use_monitor = !info.poll_command_supported;
 
+	if (drv->device_ap_sme && drv->use_monitor) {
+		/*
+		 * Non-mac80211 drivers may not support monitor interface.
+		 * Make sure we do not get stuck with incorrect capability here
+		 * by explicitly testing this.
+		 */
+		if (!info.monitor_supported) {
+			wpa_printf(MSG_DEBUG, "nl80211: Disable use_monitor "
+				   "with device_ap_sme since no monitor mode "
+				   "support detected");
+			drv->use_monitor = 0;
+		}
+	}
+
 	/*
 	 * If we aren't going to use monitor interfaces, but the
 	 * driver doesn't support data TX status, we won't get TX