Skip to content

Commit

Permalink
mac80211 : Fix setting ad-hoc mode and non-ibss channel
Browse files Browse the repository at this point in the history
Patch fixes the kernel trace when user tries to set
ad-hoc mode on non IBSS channel.
e.g iwconfig wlan0 chan 36 mode ad-hoc

Signed-off-by: Abhijeet Kolekar <abhijeet.kolekar@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
  • Loading branch information
Abhijeet Kolekar authored and John W. Linville committed Nov 25, 2008
1 parent e91af0a commit 3dd3b79
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions net/mac80211/wext.c
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,7 @@ static int ieee80211_ioctl_siwmode(struct net_device *dev,
__u32 *mode, char *extra)
{
struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
struct ieee80211_local *local = sdata->local;
int type;

if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN)
Expand All @@ -281,6 +282,13 @@ static int ieee80211_ioctl_siwmode(struct net_device *dev,
type = NL80211_IFTYPE_STATION;
break;
case IW_MODE_ADHOC:
/* Setting ad-hoc mode on non ibss channel is not
* supported.
*/
if (local->oper_channel &&
(local->oper_channel->flags & IEEE80211_CHAN_NO_IBSS))
return -EOPNOTSUPP;

type = NL80211_IFTYPE_ADHOC;
break;
case IW_MODE_REPEAT:
Expand Down

0 comments on commit 3dd3b79

Please sign in to comment.