From patchwork Sat Jan 22 00:11:38 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Fertser X-Patchwork-Id: 497091 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p0M0CoaS017519 for ; Sat, 22 Jan 2011 00:12:50 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754918Ab1AVAMo (ORCPT ); Fri, 21 Jan 2011 19:12:44 -0500 Received: from mail-ew0-f46.google.com ([209.85.215.46]:54759 "EHLO mail-ew0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754889Ab1AVAMn (ORCPT ); Fri, 21 Jan 2011 19:12:43 -0500 Received: by ewy5 with SMTP id 5so1227954ewy.19 for ; Fri, 21 Jan 2011 16:12:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:from:to:cc:subject:date:message-id:x-mailer; bh=z1ewGnCqLmFv8lnR3dq2tWu/oHnpMNJyc7EtB7mcry0=; b=v1xYzicnodtRzctpACmQ8Z1v7+2VY1I2OqQDnSJZDqabWn2K4z9Mu++BmbMK/qVvfX in7+Xz+4SWxp+spNJ89GfseeFSCiJXqGL21aFVHX74vgD/1ai4teaSDvVJ2FU19t94cI /AIt2MmZerQJ8+fYOsUvBCoDgZrYa8HUlwzpU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer; b=Yx+KhplIOv0fhfrPsCvLI3hQq78uBf5iuwGYGhwPvPWP7d8EtsPqOmUbCl/GsYGhJZ lSJ4r7MU9QpSswGyGnzSN5cZWTDCi7Noj1wslJCqEgujvFs1DgPg0sO9W4jVi9M/rTuI 54YNoG2rhx7qhrs1vdY0kZYZ3LF02i3cl8Vfg= Received: by 10.213.105.74 with SMTP id s10mr1797972ebo.48.1295655162539; Fri, 21 Jan 2011 16:12:42 -0800 (PST) Received: from localhost (home-pool-189-232.com2com.ru [195.98.189.232]) by mx.google.com with ESMTPS id t50sm7934684eeh.0.2011.01.21.16.12.40 (version=TLSv1/SSLv3 cipher=RC4-MD5); Fri, 21 Jan 2011 16:12:41 -0800 (PST) From: Paul Fertser To: linux-wireless@vger.kernel.org Cc: "Thomas d'Otreppe" , Richard Farina , Paul Fertser Subject: [RFC][PATCH] cfg80211: report monitor interface channel via wext when possible Date: Sat, 22 Jan 2011 03:11:38 +0300 Message-Id: <1295655098-17534-1-git-send-email-fercerpav@gmail.com> X-Mailer: git-send-email 1.7.2.2 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Sat, 22 Jan 2011 00:12:50 +0000 (UTC) diff --git a/net/wireless/chan.c b/net/wireless/chan.c index 17cd0c0..869e764 100644 --- a/net/wireless/chan.c +++ b/net/wireless/chan.c @@ -81,6 +81,7 @@ int cfg80211_set_freq(struct cfg80211_registered_device *rdev, enum nl80211_channel_type channel_type) { struct ieee80211_channel *chan; + struct wireless_dev *passed_wdev = wdev; int result; if (wdev && wdev->iftype == NL80211_IFTYPE_MONITOR) @@ -128,8 +129,8 @@ int cfg80211_set_freq(struct cfg80211_registered_device *rdev, if (result) return result; - if (wdev) - wdev->channel = chan; + if (passed_wdev) + passed_wdev->channel = chan; return 0; } diff --git a/net/wireless/wext-compat.c b/net/wireless/wext-compat.c index 3e5dbd4..aa637e6 100644 --- a/net/wireless/wext-compat.c +++ b/net/wireless/wext-compat.c @@ -819,6 +819,8 @@ int cfg80211_wext_giwfreq(struct net_device *dev, struct iw_freq *freq, char *extra) { struct wireless_dev *wdev = dev->ieee80211_ptr; + struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy); + int result; switch (wdev->iftype) { case NL80211_IFTYPE_STATION: @@ -828,6 +830,16 @@ int cfg80211_wext_giwfreq(struct net_device *dev, default: if (!wdev->channel) return -EINVAL; + /* The actual working channel might have been changed, verify it + * by re-setting pretending we want to set channel for a monitor + * interface */ + result = rdev->ops->set_channel(&rdev->wiphy, NULL, + wdev->channel, + NL80211_CHAN_NO_HT); + if (result) { + wdev->channel = NULL; + return -EINVAL; + } freq->m = wdev->channel->center_freq; freq->e = 6; return 0;