diff options
Diffstat (limited to 'net/mac80211/cfg.c')
-rw-r--r-- | net/mac80211/cfg.c | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c index 03fe6d1cff42..00e31b488adc 100644 --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c | |||
@@ -170,6 +170,38 @@ static int ieee80211_add_key(struct wiphy *wiphy, struct net_device *dev, | |||
170 | } | 170 | } |
171 | } | 171 | } |
172 | 172 | ||
173 | switch (sdata->vif.type) { | ||
174 | case NL80211_IFTYPE_STATION: | ||
175 | if (sdata->u.mgd.mfp != IEEE80211_MFP_DISABLED) | ||
176 | key->conf.flags |= IEEE80211_KEY_FLAG_RX_MGMT; | ||
177 | break; | ||
178 | case NL80211_IFTYPE_AP: | ||
179 | case NL80211_IFTYPE_AP_VLAN: | ||
180 | /* Keys without a station are used for TX only */ | ||
181 | if (key->sta && test_sta_flag(key->sta, WLAN_STA_MFP)) | ||
182 | key->conf.flags |= IEEE80211_KEY_FLAG_RX_MGMT; | ||
183 | break; | ||
184 | case NL80211_IFTYPE_ADHOC: | ||
185 | /* no MFP (yet) */ | ||
186 | break; | ||
187 | case NL80211_IFTYPE_MESH_POINT: | ||
188 | #ifdef CONFIG_MAC80211_MESH | ||
189 | if (sdata->u.mesh.security != IEEE80211_MESH_SEC_NONE) | ||
190 | key->conf.flags |= IEEE80211_KEY_FLAG_RX_MGMT; | ||
191 | break; | ||
192 | #endif | ||
193 | case NL80211_IFTYPE_WDS: | ||
194 | case NL80211_IFTYPE_MONITOR: | ||
195 | case NL80211_IFTYPE_P2P_DEVICE: | ||
196 | case NL80211_IFTYPE_UNSPECIFIED: | ||
197 | case NUM_NL80211_IFTYPES: | ||
198 | case NL80211_IFTYPE_P2P_CLIENT: | ||
199 | case NL80211_IFTYPE_P2P_GO: | ||
200 | /* shouldn't happen */ | ||
201 | WARN_ON_ONCE(1); | ||
202 | break; | ||
203 | } | ||
204 | |||
173 | err = ieee80211_key_link(key, sdata, sta); | 205 | err = ieee80211_key_link(key, sdata, sta); |
174 | if (err) | 206 | if (err) |
175 | ieee80211_key_free(sdata->local, key); | 207 | ieee80211_key_free(sdata->local, key); |