diff options
author | David S. Miller <davem@davemloft.net> | 2009-02-03 15:41:58 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-02-03 15:41:58 -0500 |
commit | 1725d409caba16ea5fc694bd50e95e79e8ced11a (patch) | |
tree | 688fe26dd4ceda5364692f0ce307aadb6f04f331 /net/mac80211/cfg.c | |
parent | b3ff29d2ccfe3af065a9b393699a8fbf2abd1b15 (diff) | |
parent | b8abde45d7d6ab9e8ceced9b5990eeb1149d0b97 (diff) |
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-next-2.6
Diffstat (limited to 'net/mac80211/cfg.c')
-rw-r--r-- | net/mac80211/cfg.c | 139 |
1 files changed, 137 insertions, 2 deletions
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c index 9d4e4d846ec1..a1a1344c5c4b 100644 --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c | |||
@@ -133,6 +133,9 @@ static int ieee80211_add_key(struct wiphy *wiphy, struct net_device *dev, | |||
133 | case WLAN_CIPHER_SUITE_CCMP: | 133 | case WLAN_CIPHER_SUITE_CCMP: |
134 | alg = ALG_CCMP; | 134 | alg = ALG_CCMP; |
135 | break; | 135 | break; |
136 | case WLAN_CIPHER_SUITE_AES_CMAC: | ||
137 | alg = ALG_AES_CMAC; | ||
138 | break; | ||
136 | default: | 139 | default: |
137 | return -EINVAL; | 140 | return -EINVAL; |
138 | } | 141 | } |
@@ -275,6 +278,17 @@ static int ieee80211_get_key(struct wiphy *wiphy, struct net_device *dev, | |||
275 | else | 278 | else |
276 | params.cipher = WLAN_CIPHER_SUITE_WEP104; | 279 | params.cipher = WLAN_CIPHER_SUITE_WEP104; |
277 | break; | 280 | break; |
281 | case ALG_AES_CMAC: | ||
282 | params.cipher = WLAN_CIPHER_SUITE_AES_CMAC; | ||
283 | seq[0] = key->u.aes_cmac.tx_pn[5]; | ||
284 | seq[1] = key->u.aes_cmac.tx_pn[4]; | ||
285 | seq[2] = key->u.aes_cmac.tx_pn[3]; | ||
286 | seq[3] = key->u.aes_cmac.tx_pn[2]; | ||
287 | seq[4] = key->u.aes_cmac.tx_pn[1]; | ||
288 | seq[5] = key->u.aes_cmac.tx_pn[0]; | ||
289 | params.seq = seq; | ||
290 | params.seq_len = 6; | ||
291 | break; | ||
278 | } | 292 | } |
279 | 293 | ||
280 | params.key = key->conf.key; | 294 | params.key = key->conf.key; |
@@ -304,6 +318,22 @@ static int ieee80211_config_default_key(struct wiphy *wiphy, | |||
304 | return 0; | 318 | return 0; |
305 | } | 319 | } |
306 | 320 | ||
321 | static int ieee80211_config_default_mgmt_key(struct wiphy *wiphy, | ||
322 | struct net_device *dev, | ||
323 | u8 key_idx) | ||
324 | { | ||
325 | struct ieee80211_sub_if_data *sdata; | ||
326 | |||
327 | rcu_read_lock(); | ||
328 | |||
329 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); | ||
330 | ieee80211_set_default_mgmt_key(sdata, key_idx); | ||
331 | |||
332 | rcu_read_unlock(); | ||
333 | |||
334 | return 0; | ||
335 | } | ||
336 | |||
307 | static void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo) | 337 | static void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo) |
308 | { | 338 | { |
309 | struct ieee80211_sub_if_data *sdata = sta->sdata; | 339 | struct ieee80211_sub_if_data *sdata = sta->sdata; |
@@ -493,7 +523,8 @@ static int ieee80211_config_beacon(struct ieee80211_sub_if_data *sdata, | |||
493 | 523 | ||
494 | kfree(old); | 524 | kfree(old); |
495 | 525 | ||
496 | return ieee80211_if_config(sdata, IEEE80211_IFCC_BEACON); | 526 | return ieee80211_if_config(sdata, IEEE80211_IFCC_BEACON | |
527 | IEEE80211_IFCC_BEACON_ENABLED); | ||
497 | } | 528 | } |
498 | 529 | ||
499 | static int ieee80211_add_beacon(struct wiphy *wiphy, struct net_device *dev, | 530 | static int ieee80211_add_beacon(struct wiphy *wiphy, struct net_device *dev, |
@@ -553,7 +584,7 @@ static int ieee80211_del_beacon(struct wiphy *wiphy, struct net_device *dev) | |||
553 | synchronize_rcu(); | 584 | synchronize_rcu(); |
554 | kfree(old); | 585 | kfree(old); |
555 | 586 | ||
556 | return ieee80211_if_config(sdata, IEEE80211_IFCC_BEACON); | 587 | return ieee80211_if_config(sdata, IEEE80211_IFCC_BEACON_ENABLED); |
557 | } | 588 | } |
558 | 589 | ||
559 | /* Layer 2 Update frame (802.2 Type 1 LLC XID Update response) */ | 590 | /* Layer 2 Update frame (802.2 Type 1 LLC XID Update response) */ |
@@ -630,6 +661,10 @@ static void sta_apply_parameters(struct ieee80211_local *local, | |||
630 | sta->flags &= ~WLAN_STA_WME; | 661 | sta->flags &= ~WLAN_STA_WME; |
631 | if (params->station_flags & STATION_FLAG_WME) | 662 | if (params->station_flags & STATION_FLAG_WME) |
632 | sta->flags |= WLAN_STA_WME; | 663 | sta->flags |= WLAN_STA_WME; |
664 | |||
665 | sta->flags &= ~WLAN_STA_MFP; | ||
666 | if (params->station_flags & STATION_FLAG_MFP) | ||
667 | sta->flags |= WLAN_STA_MFP; | ||
633 | spin_unlock_bh(&sta->lock); | 668 | spin_unlock_bh(&sta->lock); |
634 | } | 669 | } |
635 | 670 | ||
@@ -1141,6 +1176,102 @@ static int ieee80211_set_channel(struct wiphy *wiphy, | |||
1141 | return ieee80211_hw_config(local, IEEE80211_CONF_CHANGE_CHANNEL); | 1176 | return ieee80211_hw_config(local, IEEE80211_CONF_CHANGE_CHANNEL); |
1142 | } | 1177 | } |
1143 | 1178 | ||
1179 | static int set_mgmt_extra_ie_sta(struct ieee80211_if_sta *ifsta, u8 subtype, | ||
1180 | u8 *ies, size_t ies_len) | ||
1181 | { | ||
1182 | switch (subtype) { | ||
1183 | case IEEE80211_STYPE_PROBE_REQ >> 4: | ||
1184 | kfree(ifsta->ie_probereq); | ||
1185 | ifsta->ie_probereq = ies; | ||
1186 | ifsta->ie_probereq_len = ies_len; | ||
1187 | return 0; | ||
1188 | case IEEE80211_STYPE_PROBE_RESP >> 4: | ||
1189 | kfree(ifsta->ie_proberesp); | ||
1190 | ifsta->ie_proberesp = ies; | ||
1191 | ifsta->ie_proberesp_len = ies_len; | ||
1192 | return 0; | ||
1193 | case IEEE80211_STYPE_AUTH >> 4: | ||
1194 | kfree(ifsta->ie_auth); | ||
1195 | ifsta->ie_auth = ies; | ||
1196 | ifsta->ie_auth_len = ies_len; | ||
1197 | return 0; | ||
1198 | case IEEE80211_STYPE_ASSOC_REQ >> 4: | ||
1199 | kfree(ifsta->ie_assocreq); | ||
1200 | ifsta->ie_assocreq = ies; | ||
1201 | ifsta->ie_assocreq_len = ies_len; | ||
1202 | return 0; | ||
1203 | case IEEE80211_STYPE_REASSOC_REQ >> 4: | ||
1204 | kfree(ifsta->ie_reassocreq); | ||
1205 | ifsta->ie_reassocreq = ies; | ||
1206 | ifsta->ie_reassocreq_len = ies_len; | ||
1207 | return 0; | ||
1208 | case IEEE80211_STYPE_DEAUTH >> 4: | ||
1209 | kfree(ifsta->ie_deauth); | ||
1210 | ifsta->ie_deauth = ies; | ||
1211 | ifsta->ie_deauth_len = ies_len; | ||
1212 | return 0; | ||
1213 | case IEEE80211_STYPE_DISASSOC >> 4: | ||
1214 | kfree(ifsta->ie_disassoc); | ||
1215 | ifsta->ie_disassoc = ies; | ||
1216 | ifsta->ie_disassoc_len = ies_len; | ||
1217 | return 0; | ||
1218 | } | ||
1219 | |||
1220 | return -EOPNOTSUPP; | ||
1221 | } | ||
1222 | |||
1223 | static int ieee80211_set_mgmt_extra_ie(struct wiphy *wiphy, | ||
1224 | struct net_device *dev, | ||
1225 | struct mgmt_extra_ie_params *params) | ||
1226 | { | ||
1227 | struct ieee80211_sub_if_data *sdata; | ||
1228 | u8 *ies; | ||
1229 | size_t ies_len; | ||
1230 | int ret = -EOPNOTSUPP; | ||
1231 | |||
1232 | if (params->ies) { | ||
1233 | ies = kmemdup(params->ies, params->ies_len, GFP_KERNEL); | ||
1234 | if (ies == NULL) | ||
1235 | return -ENOMEM; | ||
1236 | ies_len = params->ies_len; | ||
1237 | } else { | ||
1238 | ies = NULL; | ||
1239 | ies_len = 0; | ||
1240 | } | ||
1241 | |||
1242 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); | ||
1243 | |||
1244 | switch (sdata->vif.type) { | ||
1245 | case NL80211_IFTYPE_STATION: | ||
1246 | case NL80211_IFTYPE_ADHOC: | ||
1247 | ret = set_mgmt_extra_ie_sta(&sdata->u.sta, params->subtype, | ||
1248 | ies, ies_len); | ||
1249 | break; | ||
1250 | default: | ||
1251 | ret = -EOPNOTSUPP; | ||
1252 | break; | ||
1253 | } | ||
1254 | |||
1255 | if (ret) | ||
1256 | kfree(ies); | ||
1257 | return ret; | ||
1258 | } | ||
1259 | |||
1260 | #ifdef CONFIG_PM | ||
1261 | static int ieee80211_suspend(struct wiphy *wiphy) | ||
1262 | { | ||
1263 | return __ieee80211_suspend(wiphy_priv(wiphy)); | ||
1264 | } | ||
1265 | |||
1266 | static int ieee80211_resume(struct wiphy *wiphy) | ||
1267 | { | ||
1268 | return __ieee80211_resume(wiphy_priv(wiphy)); | ||
1269 | } | ||
1270 | #else | ||
1271 | #define ieee80211_suspend NULL | ||
1272 | #define ieee80211_resume NULL | ||
1273 | #endif | ||
1274 | |||
1144 | struct cfg80211_ops mac80211_config_ops = { | 1275 | struct cfg80211_ops mac80211_config_ops = { |
1145 | .add_virtual_intf = ieee80211_add_iface, | 1276 | .add_virtual_intf = ieee80211_add_iface, |
1146 | .del_virtual_intf = ieee80211_del_iface, | 1277 | .del_virtual_intf = ieee80211_del_iface, |
@@ -1149,6 +1280,7 @@ struct cfg80211_ops mac80211_config_ops = { | |||
1149 | .del_key = ieee80211_del_key, | 1280 | .del_key = ieee80211_del_key, |
1150 | .get_key = ieee80211_get_key, | 1281 | .get_key = ieee80211_get_key, |
1151 | .set_default_key = ieee80211_config_default_key, | 1282 | .set_default_key = ieee80211_config_default_key, |
1283 | .set_default_mgmt_key = ieee80211_config_default_mgmt_key, | ||
1152 | .add_beacon = ieee80211_add_beacon, | 1284 | .add_beacon = ieee80211_add_beacon, |
1153 | .set_beacon = ieee80211_set_beacon, | 1285 | .set_beacon = ieee80211_set_beacon, |
1154 | .del_beacon = ieee80211_del_beacon, | 1286 | .del_beacon = ieee80211_del_beacon, |
@@ -1169,4 +1301,7 @@ struct cfg80211_ops mac80211_config_ops = { | |||
1169 | .change_bss = ieee80211_change_bss, | 1301 | .change_bss = ieee80211_change_bss, |
1170 | .set_txq_params = ieee80211_set_txq_params, | 1302 | .set_txq_params = ieee80211_set_txq_params, |
1171 | .set_channel = ieee80211_set_channel, | 1303 | .set_channel = ieee80211_set_channel, |
1304 | .set_mgmt_extra_ie = ieee80211_set_mgmt_extra_ie, | ||
1305 | .suspend = ieee80211_suspend, | ||
1306 | .resume = ieee80211_resume, | ||
1172 | }; | 1307 | }; |