All of lore.kernel.org
 help / color / mirror / Atom feed
From: "C. McPherson" <ccmcphe@verizon.net>
To: linux-wireless <linux-wireless@vger.kernel.org>
Subject: Cannot use ioctl SIOCGIWFREQ
Date: Sat, 09 Mar 2013 16:46:04 -0500	[thread overview]
Message-ID: <513BAD9C.7000408@verizon.net> (raw)

Hello:
I am running my compat-wireless with version 3.8-1 and found that when I 
issue ghe SIOCGIWFREQ ioctl while in monitor mode returns with a 
-ENODATA. I have found that the ieee80211_cfg_get_channel function in 
net/wireless/cfg.c does not account for any channel context when the 
interface is in monitor mode and any attepmpt to use the SIOCGIWFREQ 
function will error out. I have modified my local version to include a 
check for a monitor interfaces  The code block below fixes the problem:


static int ieee80211_cfg_get_channel(struct wiphy *wiphy,
                                      struct wireless_dev *wdev,
                                      struct cfg80211_chan_def *chandef)
{
         struct ieee80211_sub_if_data *sdata = 
IEEE80211_WDEV_TO_SUB_IF(wdev);
         struct ieee80211_chanctx_conf *chanctx_conf;
         struct ieee80211_local *local = wiphy_priv(wiphy);
         int ret = -ENODATA;


         if (!wdev)
                 return -EOPNOTSUPP;

         switch (wdev->iftype) {
                 case NL80211_IFTYPE_MONITOR:
                         *chandef = local->monitor_chandef;
                         ret = 0;
                         break;
                 default:
                         rcu_read_lock();
                         chanctx_conf = 
rcu_dereference(sdata->vif.chanctx_conf);
                         if (chanctx_conf) {
                                 *chandef = chanctx_conf->def;
                                 ret = 0;
                         }
                         rcu_read_unlock();
         }
         return ret;
}


Thanks
Clyde

                 reply	other threads:[~2013-03-09 22:46 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=513BAD9C.7000408@verizon.net \
    --to=ccmcphe@verizon.net \
    --cc=linux-wireless@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.