From patchwork Mon Jun 3 06:39:46 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Antonio Quartulli X-Patchwork-Id: 2650901 Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 904E2DF24C for ; Mon, 3 Jun 2013 07:04:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751038Ab3FCHEe (ORCPT ); Mon, 3 Jun 2013 03:04:34 -0400 Received: from diserzione.investici.org ([82.221.99.153]:37498 "EHLO diserzione.investici.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750872Ab3FCHEc (ORCPT ); Mon, 3 Jun 2013 03:04:32 -0400 Received: from [82.221.99.153] (diserzione [82.221.99.153]) (Authenticated sender: ordex@autistici.org) by localhost (Postfix) with ESMTPSA id 4B3D3181344; Mon, 3 Jun 2013 06:41:47 +0000 (UTC) X-DKIM: Sendmail DKIM Filter v2.8.2 diserzione.investici.org 4B3D3181344 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=autistici.org; s=stigmate; t=1370241709; bh=ec9Zb7s11nU/a/fgf0F4niJBXPPwQ5bSYvAVozqzUq4=; h=From:To:Cc:Subject:Date:Message-Id; b=M+xLJAyV9gCqwX0Fu9VA0iUFY6O59YWQD9yjFIHESnBt6Bxpy9dOEW59WP5J3NNDD F5BVrYPGYHEOmtundvi9Qp++99lou4F2wYSDD/s6hN+C3SfnZdtlla4/j0O5UGWown cVkfR8f6VzmH0nXPMfL4tDqCCl3m681/qwXdc+WU= From: Antonio Quartulli To: Johannes Berg Cc: linux-wireless@vger.kernel.org, Antonio Quartulli Subject: [PATCH 1/2] nl80211: allow sending CMD_FRAME without specifying any frequency Date: Mon, 3 Jun 2013 08:39:46 +0200 Message-Id: <1370241587-2609-1-git-send-email-ordex@autistici.org> X-Mailer: git-send-email 1.8.1.5 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Antonio Quartulli Users may want to send a frame on the current channel without specifying it. Make mgmt_tx pass a NULL channel to mac80211 if none has been specified by the user. Signed-off-by: Antonio Quartulli --- net/wireless/nl80211.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index 31d265f..c2376c7 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c @@ -7142,6 +7142,9 @@ static int nl80211_tx_mgmt(struct sk_buff *skb, struct genl_info *info) return -EOPNOTSUPP; switch (wdev->iftype) { + case NL80211_IFTYPE_P2P_DEVICE: + if (!info->attrs[NL80211_ATTR_WIPHY_FREQ]) + return -EINVAL; case NL80211_IFTYPE_STATION: case NL80211_IFTYPE_ADHOC: case NL80211_IFTYPE_P2P_CLIENT: @@ -7149,7 +7152,6 @@ static int nl80211_tx_mgmt(struct sk_buff *skb, struct genl_info *info) case NL80211_IFTYPE_AP_VLAN: case NL80211_IFTYPE_MESH_POINT: case NL80211_IFTYPE_P2P_GO: - case NL80211_IFTYPE_P2P_DEVICE: break; default: return -EOPNOTSUPP; @@ -7177,9 +7179,16 @@ static int nl80211_tx_mgmt(struct sk_buff *skb, struct genl_info *info) no_cck = nla_get_flag(info->attrs[NL80211_ATTR_TX_NO_CCK_RATE]); - err = nl80211_parse_chandef(rdev, info, &chandef); - if (err) - return err; + /* + * get the channel if any has been specified, otherwise pass NULL to + * mac80211. The latter will use the current one + */ + chandef.chan = NULL; + if (info->attrs[NL80211_ATTR_WIPHY_FREQ]) { + err = nl80211_parse_chandef(rdev, info, &chandef); + if (err) + return err; + } if (!dont_wait_for_ack) { msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL);