Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mac80211: allow AP_VLAN operation on crypto controlled devices

In the current implementation, mac80211 advertises the support of
AP_VLANs based on the driver's support for AP mode; it also
blocks encrypted AP_VLAN operation on devices advertising
SW_CRYPTO_CONTROL.

The implementation seems weird in it's current form and could be
often confusing, this is because there can be drivers advertising
both SW_CRYPTO_CONTROL and AP mode support (ex: ath10k) in which case
AP_VLAN will still be supported but only in open BSS and not in
secured BSS.

When SW_CRYPTO_CONTROL is enabled, it makes more sense if the decision
to support AP_VLANs is left to the driver. Mac80211 can then allow
AP_VLAN operations depending on the driver support.

Signed-off-by: Manikanta Pubbisetty <mpubbise@codeaurora.org>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>

authored by

Manikanta Pubbisetty and committed by
Johannes Berg
db3bdcb9 19d3577e

+11 -5
+5 -3
net/mac80211/key.c
··· 126 126 127 127 static int ieee80211_key_enable_hw_accel(struct ieee80211_key *key) 128 128 { 129 - struct ieee80211_sub_if_data *sdata; 129 + struct ieee80211_sub_if_data *sdata = key->sdata; 130 130 struct sta_info *sta; 131 131 int ret = -EOPNOTSUPP; 132 132 ··· 162 162 if (sta && !sta->uploaded) 163 163 goto out_unsupported; 164 164 165 - sdata = key->sdata; 166 165 if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN) { 167 166 /* 168 167 * The driver doesn't know anything about VLAN interfaces. ··· 213 214 /* all of these we can do in software - if driver can */ 214 215 if (ret == 1) 215 216 return 0; 216 - if (ieee80211_hw_check(&key->local->hw, SW_CRYPTO_CONTROL)) 217 + if (ieee80211_hw_check(&key->local->hw, SW_CRYPTO_CONTROL)) { 218 + if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN) 219 + return 0; 217 220 return -EINVAL; 221 + } 218 222 return 0; 219 223 default: 220 224 return -EINVAL;
+6 -2
net/mac80211/main.c
··· 930 930 IEEE80211_HT_CAP_SM_PS_SHIFT; 931 931 } 932 932 933 - /* if low-level driver supports AP, we also support VLAN */ 934 - if (local->hw.wiphy->interface_modes & BIT(NL80211_IFTYPE_AP)) { 933 + /* if low-level driver supports AP, we also support VLAN. 934 + * drivers advertising SW_CRYPTO_CONTROL should enable AP_VLAN 935 + * based on their support to transmit SW encrypted packets. 936 + */ 937 + if (local->hw.wiphy->interface_modes & BIT(NL80211_IFTYPE_AP) && 938 + !ieee80211_hw_check(&local->hw, SW_CRYPTO_CONTROL)) { 935 939 hw->wiphy->interface_modes |= BIT(NL80211_IFTYPE_AP_VLAN); 936 940 hw->wiphy->software_iftypes |= BIT(NL80211_IFTYPE_AP_VLAN); 937 941 }