diff options
Diffstat (limited to 'net/mac80211/cfg.c')
-rw-r--r-- | net/mac80211/cfg.c | 36 |
1 files changed, 10 insertions, 26 deletions
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c index 81087281b031..8e7ba0e62cf5 100644 --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c | |||
@@ -50,14 +50,11 @@ static int ieee80211_add_iface(struct wiphy *wiphy, char *name, | |||
50 | struct ieee80211_sub_if_data *sdata; | 50 | struct ieee80211_sub_if_data *sdata; |
51 | int err; | 51 | int err; |
52 | 52 | ||
53 | if (unlikely(local->reg_state != IEEE80211_DEV_REGISTERED)) | ||
54 | return -ENODEV; | ||
55 | |||
56 | itype = nl80211_type_to_mac80211_type(type); | 53 | itype = nl80211_type_to_mac80211_type(type); |
57 | if (itype == IEEE80211_IF_TYPE_INVALID) | 54 | if (itype == IEEE80211_IF_TYPE_INVALID) |
58 | return -EINVAL; | 55 | return -EINVAL; |
59 | 56 | ||
60 | err = ieee80211_if_add(local->mdev, name, &dev, itype, params); | 57 | err = ieee80211_if_add(local, name, &dev, itype, params); |
61 | if (err || itype != IEEE80211_IF_TYPE_MNTR || !flags) | 58 | if (err || itype != IEEE80211_IF_TYPE_MNTR || !flags) |
62 | return err; | 59 | return err; |
63 | 60 | ||
@@ -68,54 +65,41 @@ static int ieee80211_add_iface(struct wiphy *wiphy, char *name, | |||
68 | 65 | ||
69 | static int ieee80211_del_iface(struct wiphy *wiphy, int ifindex) | 66 | static int ieee80211_del_iface(struct wiphy *wiphy, int ifindex) |
70 | { | 67 | { |
71 | struct ieee80211_local *local = wiphy_priv(wiphy); | ||
72 | struct net_device *dev; | 68 | struct net_device *dev; |
73 | char *name; | ||
74 | |||
75 | if (unlikely(local->reg_state != IEEE80211_DEV_REGISTERED)) | ||
76 | return -ENODEV; | ||
77 | 69 | ||
78 | /* we're under RTNL */ | 70 | /* we're under RTNL */ |
79 | dev = __dev_get_by_index(&init_net, ifindex); | 71 | dev = __dev_get_by_index(&init_net, ifindex); |
80 | if (!dev) | 72 | if (!dev) |
81 | return 0; | 73 | return -ENODEV; |
82 | 74 | ||
83 | name = dev->name; | 75 | ieee80211_if_remove(dev); |
84 | 76 | ||
85 | return ieee80211_if_remove(local->mdev, name, -1); | 77 | return 0; |
86 | } | 78 | } |
87 | 79 | ||
88 | static int ieee80211_change_iface(struct wiphy *wiphy, int ifindex, | 80 | static int ieee80211_change_iface(struct wiphy *wiphy, int ifindex, |
89 | enum nl80211_iftype type, u32 *flags, | 81 | enum nl80211_iftype type, u32 *flags, |
90 | struct vif_params *params) | 82 | struct vif_params *params) |
91 | { | 83 | { |
92 | struct ieee80211_local *local = wiphy_priv(wiphy); | ||
93 | struct net_device *dev; | 84 | struct net_device *dev; |
94 | enum ieee80211_if_types itype; | 85 | enum ieee80211_if_types itype; |
95 | struct ieee80211_sub_if_data *sdata; | 86 | struct ieee80211_sub_if_data *sdata; |
96 | 87 | int ret; | |
97 | if (unlikely(local->reg_state != IEEE80211_DEV_REGISTERED)) | ||
98 | return -ENODEV; | ||
99 | 88 | ||
100 | /* we're under RTNL */ | 89 | /* we're under RTNL */ |
101 | dev = __dev_get_by_index(&init_net, ifindex); | 90 | dev = __dev_get_by_index(&init_net, ifindex); |
102 | if (!dev) | 91 | if (!dev) |
103 | return -ENODEV; | 92 | return -ENODEV; |
104 | 93 | ||
105 | if (netif_running(dev)) | ||
106 | return -EBUSY; | ||
107 | |||
108 | itype = nl80211_type_to_mac80211_type(type); | 94 | itype = nl80211_type_to_mac80211_type(type); |
109 | if (itype == IEEE80211_IF_TYPE_INVALID) | 95 | if (itype == IEEE80211_IF_TYPE_INVALID) |
110 | return -EINVAL; | 96 | return -EINVAL; |
111 | 97 | ||
112 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); | 98 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
113 | 99 | ||
114 | if (sdata->vif.type == IEEE80211_IF_TYPE_VLAN) | 100 | ret = ieee80211_if_change_type(sdata, itype); |
115 | return -EOPNOTSUPP; | 101 | if (ret) |
116 | 102 | return ret; | |
117 | ieee80211_if_reinit(dev); | ||
118 | ieee80211_if_set_type(dev, itype); | ||
119 | 103 | ||
120 | if (ieee80211_vif_is_mesh(&sdata->vif) && params->mesh_id_len) | 104 | if (ieee80211_vif_is_mesh(&sdata->vif) && params->mesh_id_len) |
121 | ieee80211_if_sta_set_mesh_id(&sdata->u.sta, | 105 | ieee80211_if_sta_set_mesh_id(&sdata->u.sta, |
@@ -485,7 +469,7 @@ static int ieee80211_config_beacon(struct ieee80211_sub_if_data *sdata, | |||
485 | 469 | ||
486 | kfree(old); | 470 | kfree(old); |
487 | 471 | ||
488 | return ieee80211_if_config_beacon(sdata->dev); | 472 | return ieee80211_if_config(sdata, IEEE80211_IFCC_BEACON); |
489 | } | 473 | } |
490 | 474 | ||
491 | static int ieee80211_add_beacon(struct wiphy *wiphy, struct net_device *dev, | 475 | static int ieee80211_add_beacon(struct wiphy *wiphy, struct net_device *dev, |
@@ -539,7 +523,7 @@ static int ieee80211_del_beacon(struct wiphy *wiphy, struct net_device *dev) | |||
539 | synchronize_rcu(); | 523 | synchronize_rcu(); |
540 | kfree(old); | 524 | kfree(old); |
541 | 525 | ||
542 | return ieee80211_if_config_beacon(dev); | 526 | return ieee80211_if_config(sdata, IEEE80211_IFCC_BEACON); |
543 | } | 527 | } |
544 | 528 | ||
545 | /* Layer 2 Update frame (802.2 Type 1 LLC XID Update response) */ | 529 | /* Layer 2 Update frame (802.2 Type 1 LLC XID Update response) */ |