From patchwork Fri Nov 4 10:37:58 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Berg X-Patchwork-Id: 123594 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 5278AB6F0E for ; Fri, 4 Nov 2011 21:42:04 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id 00DA217C02E; Fri, 4 Nov 2011 06:42:02 -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 pLaRMzCUsldU; Fri, 4 Nov 2011 06:42:01 -0400 (EDT) Received: from maxx.shmoo.com (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id 198C817C02F; Fri, 4 Nov 2011 06:40:22 -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 CD8F317C025 for ; Fri, 4 Nov 2011 06:40:20 -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 yvBoAWIyA4CQ for ; Fri, 4 Nov 2011 06:40:17 -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 1A27017C017 for ; Fri, 4 Nov 2011 06:39:36 -0400 (EDT) Received: by sipsolutions.net with esmtpsa (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.77) (envelope-from ) id 1RMHBP-0001HB-3K for hostap@lists.shmoo.com; Fri, 04 Nov 2011 11:39:35 +0100 Message-Id: <20111104103810.614437840@sipsolutions.net> User-Agent: quilt/0.48-1 Date: Fri, 04 Nov 2011 11:37:58 +0100 From: Johannes Berg To: hostap@lists.shmoo.com Subject: [PATCH 09/18] driver_nl80211: set offchannel-OK selectively References: <20111104103749.617144560@sipsolutions.net> Content-Disposition: inline; filename=0009-driver_nl80211-set-offchannel-OK-selectively.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 It's not really valid to send off-channel in all cases, so pass whether it should be allowed or not and don't set it in the AP case. Also, to get the right ifindex for hostapd, pass a bss pointer instead of the drv pointer. Signed-hostap: Johannes Berg --- src/drivers/driver_nl80211.c | 26 ++++++++++++++------------ 1 files changed, 14 insertions(+), 12 deletions(-) diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c index 31fd147..35185aa 100644 --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c @@ -288,10 +288,10 @@ static int wpa_driver_nl80211_mlme(struct wpa_driver_nl80211_data *drv, int local_state_change); static void nl80211_remove_monitor_interface( struct wpa_driver_nl80211_data *drv); -static int nl80211_send_frame_cmd(struct wpa_driver_nl80211_data *drv, +static int nl80211_send_frame_cmd(struct i802_bss *bss, unsigned int freq, unsigned int wait, const u8 *buf, size_t buf_len, u64 *cookie, - int no_cck); + int no_cck, int offchanok); static int wpa_driver_nl80211_probe_req_report(void *priv, int report); #ifdef HOSTAPD @@ -4350,13 +4350,13 @@ static int wpa_driver_nl80211_send_mlme(void *priv, const u8 *data, * but it works due to the single-threaded nature * of wpa_supplicant. */ - return nl80211_send_frame_cmd(drv, drv->last_mgmt_freq, 0, - data, data_len, NULL, 1); + return nl80211_send_frame_cmd(bss, drv->last_mgmt_freq, 0, + data, data_len, NULL, 1, 1); } 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); + return nl80211_send_frame_cmd(bss, drv->ap_oper_freq, 0, + data, data_len, NULL, 0, 0); } if (WLAN_FC_GET_TYPE(fc) == WLAN_FC_TYPE_MGMT && @@ -6991,11 +6991,12 @@ static int cookie_handler(struct nl_msg *msg, void *arg) } -static int nl80211_send_frame_cmd(struct wpa_driver_nl80211_data *drv, +static int nl80211_send_frame_cmd(struct i802_bss *bss, unsigned int freq, unsigned int wait, const u8 *buf, size_t buf_len, - u64 *cookie_out, int no_cck) + u64 *cookie_out, int no_cck, int offchanok) { + struct wpa_driver_nl80211_data *drv = bss->drv; struct nl_msg *msg; u64 cookie; int ret = -1; @@ -7006,11 +7007,12 @@ static int nl80211_send_frame_cmd(struct wpa_driver_nl80211_data *drv, nl80211_cmd(drv, msg, 0, NL80211_CMD_FRAME); - NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX, drv->ifindex); + NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX, bss->ifindex); NLA_PUT_U32(msg, NL80211_ATTR_WIPHY_FREQ, freq); if (wait) NLA_PUT_U32(msg, NL80211_ATTR_DURATION, wait); - NLA_PUT_FLAG(msg, NL80211_ATTR_OFFCHANNEL_TX_OK); + if (offchanok) + NLA_PUT_FLAG(msg, NL80211_ATTR_OFFCHANNEL_TX_OK); if (no_cck) NLA_PUT_FLAG(msg, NL80211_ATTR_TX_NO_CCK_RATE); @@ -7067,10 +7069,10 @@ static int wpa_driver_nl80211_send_action(void *priv, unsigned int freq, if (is_ap_interface(drv->nlmode)) ret = wpa_driver_nl80211_send_mlme(priv, buf, 24 + data_len); else - ret = nl80211_send_frame_cmd(drv, freq, wait_time, buf, + ret = nl80211_send_frame_cmd(bss, freq, wait_time, buf, 24 + data_len, &drv->send_action_cookie, - no_cck); + no_cck, 1); os_free(buf); return ret;