2008-09-22 13:25:36

by David Shwatrz

[permalink] [raw]
Subject: A question about setting Master mode and ieee80211_ioctl_siwmode() handler

Hello,
I have a short question:
I wonder how can a command like :
"iwconfig wlan0 mode Master"
should succeed ;
I did tried it on some wireless NIC, which probably does not support
master mode, and got:
"Error for wireless request "Set Mode" (8B06) :
SET failed on device wlan0 ; Invalid argument."


The reason is this:
I look at the kernel code which implements receiving the set mode IOCTL.

The method is ieee80211_ioctl_siwmode(), in net/mac80211/wext.c.

(I am looking at the last git wireless tree; it appears here below).

As far as I can see, we don't handle the "Master" mode in the case
sentence , so when we try to set the mode to Master,
by :
"iwconfig wlan0 mode Master"
we will always get to the default and exit with
"return -EINVAL"

Am I wrong here ? can somebody please explain?

static int ieee80211_ioctl_siwmode(struct net_device *dev,
struct iw_request_info *info,
__u32 *mode, char *extra)
{
struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
int type;

if (sdata->vif.type == IEEE80211_IF_TYPE_VLAN)
return -EOPNOTSUPP;

switch (*mode) {
case IW_MODE_INFRA:
type = IEEE80211_IF_TYPE_STA;
break;
case IW_MODE_ADHOC:
type = IEEE80211_IF_TYPE_IBSS;
break;
case IW_MODE_REPEAT:
type = IEEE80211_IF_TYPE_WDS;
break;
case IW_MODE_MONITOR:
type = IEEE80211_IF_TYPE_MNTR;
break;
default:
return -EINVAL;
}

return ieee80211_if_change_type(sdata, type);
}


Any ideas?
Regards,
DS


2008-09-23 18:25:38

by Andrey Yurovsky

[permalink] [raw]
Subject: Re: A question about setting Master mode and ieee80211_ioctl_siwmode() handler

Master mode is deliberately disabled at this time. You can enable it
by applying:
http://johannes.sipsolutions.net/patches/kernel/all/LATEST/004-allow-ap-vlan-modes.patch

On Mon, Sep 22, 2008 at 6:25 AM, David Shwatrz <[email protected]> wrote:
> Hello,
> I have a short question:
> I wonder how can a command like :
> "iwconfig wlan0 mode Master"
> should succeed ;
> I did tried it on some wireless NIC, which probably does not support
> master mode, and got:
> "Error for wireless request "Set Mode" (8B06) :
> SET failed on device wlan0 ; Invalid argument."
>
>
> The reason is this:
> I look at the kernel code which implements receiving the set mode IOCTL.
>
> The method is ieee80211_ioctl_siwmode(), in net/mac80211/wext.c.
>
> (I am looking at the last git wireless tree; it appears here below).
>
> As far as I can see, we don't handle the "Master" mode in the case
> sentence , so when we try to set the mode to Master,
> by :
> "iwconfig wlan0 mode Master"
> we will always get to the default and exit with
> "return -EINVAL"
>
> Am I wrong here ? can somebody please explain?
>
> static int ieee80211_ioctl_siwmode(struct net_device *dev,
> struct iw_request_info *info,
> __u32 *mode, char *extra)
> {
> struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
> int type;
>
> if (sdata->vif.type == IEEE80211_IF_TYPE_VLAN)
> return -EOPNOTSUPP;
>
> switch (*mode) {
> case IW_MODE_INFRA:
> type = IEEE80211_IF_TYPE_STA;
> break;
> case IW_MODE_ADHOC:
> type = IEEE80211_IF_TYPE_IBSS;
> break;
> case IW_MODE_REPEAT:
> type = IEEE80211_IF_TYPE_WDS;
> break;
> case IW_MODE_MONITOR:
> type = IEEE80211_IF_TYPE_MNTR;
> break;
> default:
> return -EINVAL;
> }
>
> return ieee80211_if_change_type(sdata, type);
> }
>
>
> Any ideas?
> Regards,
> DS
> --
> To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>