From patchwork Fri Nov 4 10:37:51 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Berg X-Patchwork-Id: 123587 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from maxx.maxx.shmoo.com (maxx.shmoo.com [205.134.188.171]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "maxx.shmoo.com", Issuer "CA Cert Signing Authority" (not verified)) by ozlabs.org (Postfix) with ESMTPS id B9524B6F8C for ; Fri, 4 Nov 2011 21:39:51 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id 06A209D228; Fri, 4 Nov 2011 06:39:49 -0400 (EDT) X-Virus-Scanned: amavisd-new at maxx.shmoo.com Received: from maxx.maxx.shmoo.com ([127.0.0.1]) by localhost (maxx.shmoo.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 4p8zkOvTI8df; Fri, 4 Nov 2011 06:39:48 -0400 (EDT) Received: from maxx.shmoo.com (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id 8151D9D2E1; Fri, 4 Nov 2011 06:39:20 -0400 (EDT) X-Original-To: mailman-post+hostap@maxx.shmoo.com Delivered-To: mailman-post+hostap@maxx.shmoo.com Received: from localhost (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id A3BEF9D2E1 for ; Fri, 4 Nov 2011 06:39:18 -0400 (EDT) X-Virus-Scanned: amavisd-new at maxx.shmoo.com Received: from maxx.maxx.shmoo.com ([127.0.0.1]) by localhost (maxx.shmoo.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id R+aWeNLjS-eG for ; Fri, 4 Nov 2011 06:39:14 -0400 (EDT) Received: from sipsolutions.net (he.sipsolutions.net [78.46.109.217]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by maxx.maxx.shmoo.com (Postfix) with ESMTPS id 123DB9D228 for ; Fri, 4 Nov 2011 06:39:11 -0400 (EDT) Received: by sipsolutions.net with esmtpsa (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.77) (envelope-from ) id 1RMHB0-0001GC-14 for hostap@lists.shmoo.com; Fri, 04 Nov 2011 11:39:10 +0100 Message-Id: <20111104103808.538221240@sipsolutions.net> User-Agent: quilt/0.48-1 Date: Fri, 04 Nov 2011 11:37:51 +0100 From: Johannes Berg To: hostap@lists.shmoo.com Subject: [PATCH 02/18] driver_nl80211: use device AP SME capability References: <20111104103749.617144560@sipsolutions.net> Content-Disposition: inline; filename=0002-driver_nl80211-use-device-AP-SME-capability.patch Mime-Version: 1.0 X-Mailer: Evolution 2.30.3 X-BeenThere: hostap@lists.shmoo.com X-Mailman-Version: 2.1.9 Precedence: list List-Id: HostAP Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: hostap-bounces@lists.shmoo.com Errors-To: hostap-bounces@lists.shmoo.com From: Johannes Berg This changes the auto-detection of whether or not the device contains the AP SME away from monitor interface addition failing to the explicit attribute in nl80211. Keep the old auto-detection for a little while so that ath6kl isn't broken right away. Signed-hostap: Johannes Berg --- src/drivers/driver_nl80211.c | 32 ++++++++++++++++++++++---------- 1 files changed, 22 insertions(+), 10 deletions(-) diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c index 2ab10ae..c125646 100644 --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c @@ -219,11 +219,11 @@ struct wpa_driver_nl80211_data { int monitor_sock; int monitor_ifidx; - int no_monitor_iface_capab; unsigned int disabled_11b_rates:1; unsigned int pending_remain_on_chan:1; unsigned int in_interface_list:1; + unsigned int device_ap_sme:1; u64 remain_on_chan_cookie; u64 send_action_cookie; @@ -1565,7 +1565,7 @@ static void nl80211_new_station_event(struct wpa_driver_nl80211_data *drv, addr = nla_data(tb[NL80211_ATTR_MAC]); wpa_printf(MSG_DEBUG, "nl80211: New station " MACSTR, MAC2STR(addr)); - if (is_ap_interface(drv->nlmode) && drv->no_monitor_iface_capab) { + if (is_ap_interface(drv->nlmode) && drv->device_ap_sme) { u8 *ies = NULL; size_t ies_len = 0; if (tb[NL80211_ATTR_IE]) { @@ -1598,7 +1598,7 @@ static void nl80211_del_station_event(struct wpa_driver_nl80211_data *drv, wpa_printf(MSG_DEBUG, "nl80211: Delete station " MACSTR, MAC2STR(addr)); - if (is_ap_interface(drv->nlmode) && drv->no_monitor_iface_capab) { + if (is_ap_interface(drv->nlmode) && drv->device_ap_sme) { drv_event_disassoc(drv->ctx, addr); return; } @@ -1877,6 +1877,7 @@ struct wiphy_info_data { struct wpa_driver_capa *capa; unsigned int error:1; + unsigned int device_ap_sme:1; }; @@ -2058,6 +2059,9 @@ broken_combination: } } + if (tb[NL80211_ATTR_DEVICE_AP_SME]) + info->device_ap_sme = 1; + return NL_SKIP; } @@ -2115,6 +2119,8 @@ static int wpa_driver_nl80211_capa(struct wpa_driver_nl80211_data *drv) drv->capa.flags |= WPA_DRIVER_FLAGS_EAPOL_TX_STATUS; drv->capa.flags |= WPA_DRIVER_FLAGS_DEAUTH_TX_STATUS; + drv->device_ap_sme = info.device_ap_sme; + return 0; } @@ -4226,7 +4232,7 @@ static int wpa_driver_nl80211_send_mlme(void *priv, const u8 *data, data, data_len, NULL, 1); } - if (drv->no_monitor_iface_capab && is_ap_interface(drv->nlmode)) { + if (drv->device_ap_sme && is_ap_interface(drv->nlmode)) { return nl80211_send_frame_cmd(drv, drv->ap_oper_freq, 0, data, data_len, NULL, 0); } @@ -5061,9 +5067,15 @@ nl80211_create_monitor_interface(struct wpa_driver_nl80211_data *drv) 0); if (drv->monitor_ifidx == -EOPNOTSUPP) { + /* + * This is backward compatibility for a few versions of + * the kernel only that didn't advertise the right + * attributes for the only driver that then supported + * AP mode w/o monitor -- ath6kl. + */ wpa_printf(MSG_DEBUG, "nl80211: Driver does not support " "monitor interface type - try to run without it"); - drv->no_monitor_iface_capab = 1; + drv->device_ap_sme = 1; } if (drv->monitor_ifidx < 0) @@ -5146,7 +5158,7 @@ static int wpa_driver_nl80211_hapd_send_eapol( int qos = flags & WPA_STA_WMM; #ifdef CONFIG_AP - if (drv->no_monitor_iface_capab) + if (drv->device_ap_sme) return nl80211_send_eapol_data(bss, addr, data, data_len, own_addr); #endif /* CONFIG_AP */ @@ -5279,7 +5291,7 @@ static int wpa_driver_nl80211_ap(struct wpa_driver_nl80211_data *drv, return -1; } - if (drv->no_monitor_iface_capab) { + if (drv->device_ap_sme) { if (wpa_driver_nl80211_probe_req_report(&drv->first_bss, 1) < 0) { wpa_printf(MSG_DEBUG, "nl80211: Failed to enable " @@ -5840,13 +5852,13 @@ static int wpa_driver_nl80211_set_mode(struct i802_bss *bss, done: if (!ret && is_ap_interface(nlmode)) { /* Setup additional AP mode functionality if needed */ - if (!drv->no_monitor_iface_capab && drv->monitor_ifidx < 0 && + if (!drv->device_ap_sme && drv->monitor_ifidx < 0 && nl80211_create_monitor_interface(drv) && - !drv->no_monitor_iface_capab) + !drv->device_ap_sme) return -1; } else if (!ret && !is_ap_interface(nlmode)) { /* Remove additional AP mode functionality */ - if (was_ap && drv->no_monitor_iface_capab) + if (was_ap && drv->device_ap_sme) wpa_driver_nl80211_probe_req_report(bss, 0); nl80211_remove_monitor_interface(drv); bss->beacon_set = 0;