From: Johannes Berg Date: Tue, 16 Sep 2008 18:22:09 +0000 (+0200) Subject: cfg80211: allow set_interface without type X-Git-Tag: v2.6.28-rc1~717^2~172^2~19 X-Git-Url: http://www.pilppa.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=723b038def23ce0606754c4f598cbb96bae9a102;p=linux-2.6-omap-h63xx.git cfg80211: allow set_interface without type Which then causes no type change. Signed-off-by: Johannes Berg Signed-off-by: John W. Linville --- diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index 44771a690d5..a745932d137 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c @@ -422,19 +422,20 @@ static int nl80211_set_interface(struct sk_buff *skb, struct genl_info *info) memset(¶ms, 0, sizeof(params)); - if (info->attrs[NL80211_ATTR_IFTYPE]) { - type = nla_get_u32(info->attrs[NL80211_ATTR_IFTYPE]); - if (type > NL80211_IFTYPE_MAX) - return -EINVAL; - } else - return -EINVAL; - err = get_drv_dev_by_info_ifindex(info->attrs, &drv, &dev); if (err) return err; ifindex = dev->ifindex; + type = dev->ieee80211_ptr->iftype; dev_put(dev); + err = -EINVAL; + if (info->attrs[NL80211_ATTR_IFTYPE]) { + type = nla_get_u32(info->attrs[NL80211_ATTR_IFTYPE]); + if (type > NL80211_IFTYPE_MAX) + goto unlock; + } + if (!drv->ops->change_virtual_intf || !(drv->wiphy.interface_modes & (1 << type))) { err = -EOPNOTSUPP;