aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/net/cfg80211.h6
-rw-r--r--include/net/wireless.h2
-rw-r--r--net/mac80211/iface.c1
-rw-r--r--net/wireless/core.c2
-rw-r--r--net/wireless/nl80211.c6
5 files changed, 14 insertions, 3 deletions
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 9f40c4d417d7..0e85ec39b638 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -363,11 +363,13 @@ struct wiphy;
363 * wireless extensions but this is subject to reevaluation as soon as this 363 * wireless extensions but this is subject to reevaluation as soon as this
364 * code is used more widely and we have a first user without wext. 364 * code is used more widely and we have a first user without wext.
365 * 365 *
366 * @add_virtual_intf: create a new virtual interface with the given name 366 * @add_virtual_intf: create a new virtual interface with the given name,
367 * must set the struct wireless_dev's iftype.
367 * 368 *
368 * @del_virtual_intf: remove the virtual interface determined by ifindex. 369 * @del_virtual_intf: remove the virtual interface determined by ifindex.
369 * 370 *
370 * @change_virtual_intf: change type of virtual interface 371 * @change_virtual_intf: change type/configuration of virtual interface,
372 * keep the struct wireless_dev's iftype updated.
371 * 373 *
372 * @add_key: add a key with the given parameters. @mac_addr will be %NULL 374 * @add_key: add a key with the given parameters. @mac_addr will be %NULL
373 * when adding a group key. 375 * when adding a group key.
diff --git a/include/net/wireless.h b/include/net/wireless.h
index 0de7fde9f336..721efb363db7 100644
--- a/include/net/wireless.h
+++ b/include/net/wireless.h
@@ -223,9 +223,11 @@ struct wiphy {
223 * the netdev.) 223 * the netdev.)
224 * 224 *
225 * @wiphy: pointer to hardware description 225 * @wiphy: pointer to hardware description
226 * @iftype: interface type
226 */ 227 */
227struct wireless_dev { 228struct wireless_dev {
228 struct wiphy *wiphy; 229 struct wiphy *wiphy;
230 enum nl80211_iftype iftype;
229 231
230 /* private to the generic wireless code */ 232 /* private to the generic wireless code */
231 struct list_head list; 233 struct list_head list;
diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c
index a72fbebb8ea2..b5cd91e89712 100644
--- a/net/mac80211/iface.c
+++ b/net/mac80211/iface.c
@@ -625,6 +625,7 @@ static void ieee80211_setup_sdata(struct ieee80211_sub_if_data *sdata,
625 /* and set some type-dependent values */ 625 /* and set some type-dependent values */
626 sdata->vif.type = type; 626 sdata->vif.type = type;
627 sdata->dev->hard_start_xmit = ieee80211_subif_start_xmit; 627 sdata->dev->hard_start_xmit = ieee80211_subif_start_xmit;
628 sdata->wdev.iftype = type;
628 629
629 /* only monitor differs */ 630 /* only monitor differs */
630 sdata->dev->type = ARPHRD_ETHER; 631 sdata->dev->type = ARPHRD_ETHER;
diff --git a/net/wireless/core.c b/net/wireless/core.c
index 88cb73394864..d6940085d59c 100644
--- a/net/wireless/core.c
+++ b/net/wireless/core.c
@@ -384,6 +384,8 @@ static int cfg80211_netdev_notifier_call(struct notifier_block * nb,
384 384
385 rdev = wiphy_to_dev(dev->ieee80211_ptr->wiphy); 385 rdev = wiphy_to_dev(dev->ieee80211_ptr->wiphy);
386 386
387 WARN_ON(dev->ieee80211_ptr->iftype == NL80211_IFTYPE_UNSPECIFIED);
388
387 switch (state) { 389 switch (state) {
388 case NETDEV_REGISTER: 390 case NETDEV_REGISTER:
389 mutex_lock(&rdev->devlist_mtx); 391 mutex_lock(&rdev->devlist_mtx);
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index 1221d726ed50..44771a690d53 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -299,7 +299,7 @@ static int nl80211_send_iface(struct sk_buff *msg, u32 pid, u32 seq, int flags,
299 299
300 NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX, dev->ifindex); 300 NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX, dev->ifindex);
301 NLA_PUT_STRING(msg, NL80211_ATTR_IFNAME, dev->name); 301 NLA_PUT_STRING(msg, NL80211_ATTR_IFNAME, dev->name);
302 /* TODO: interface type */ 302 NLA_PUT_U32(msg, NL80211_ATTR_IFTYPE, dev->ieee80211_ptr->iftype);
303 return genlmsg_end(msg, hdr); 303 return genlmsg_end(msg, hdr);
304 304
305 nla_put_failure: 305 nla_put_failure:
@@ -453,6 +453,10 @@ static int nl80211_set_interface(struct sk_buff *skb, struct genl_info *info)
453 &flags); 453 &flags);
454 err = drv->ops->change_virtual_intf(&drv->wiphy, ifindex, 454 err = drv->ops->change_virtual_intf(&drv->wiphy, ifindex,
455 type, err ? NULL : &flags, &params); 455 type, err ? NULL : &flags, &params);
456
457 dev = __dev_get_by_index(&init_net, ifindex);
458 WARN_ON(!dev || (!err && dev->ieee80211_ptr->iftype != type));
459
456 rtnl_unlock(); 460 rtnl_unlock();
457 461
458 unlock: 462 unlock: