Skip to content

Commit ccf6a15

Browse files
Manikanta Pubbisettygregkh
authored andcommitted
{nl,mac}80211: allow 4addr AP operation on crypto controlled devices
commit 33d915d upstream. As per the current design, in the case of sw crypto controlled devices, it is the device which advertises the support for AP/VLAN iftype based on it's ability to tranmsit packets encrypted in software (In VLAN functionality, group traffic generated for a specific VLAN group is always encrypted in software). Commit db3bdcb ("mac80211: allow AP_VLAN operation on crypto controlled devices") has introduced this change. Since 4addr AP operation also uses AP/VLAN iftype, this conditional way of advertising AP/VLAN support has broken 4addr AP mode operation on crypto controlled devices which do not support VLAN functionality. In the case of ath10k driver, not all firmwares have support for VLAN functionality but all can support 4addr AP operation. Because AP/VLAN support is not advertised for these devices, 4addr AP operations are also blocked. Fix this by allowing 4addr operation on devices which do not support AP/VLAN iftype but can support 4addr AP operation (decision is based on the wiphy flag WIPHY_FLAG_4ADDR_AP). Cc: stable@vger.kernel.org Fixes: db3bdcb ("mac80211: allow AP_VLAN operation on crypto controlled devices") Signed-off-by: Manikanta Pubbisetty <mpubbise@codeaurora.org> Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 0e879ef commit ccf6a15

4 files changed

Lines changed: 16 additions & 5 deletions

File tree

include/net/cfg80211.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3448,7 +3448,8 @@ struct cfg80211_ops {
34483448
* on wiphy_new(), but can be changed by the driver if it has a good
34493449
* reason to override the default
34503450
* @WIPHY_FLAG_4ADDR_AP: supports 4addr mode even on AP (with a single station
3451-
* on a VLAN interface)
3451+
* on a VLAN interface). This flag also serves an extra purpose of
3452+
* supporting 4ADDR AP mode on devices which do not support AP/VLAN iftype.
34523453
* @WIPHY_FLAG_4ADDR_STATION: supports 4addr mode even as a station
34533454
* @WIPHY_FLAG_CONTROL_PORT_PROTOCOL: This device supports setting the
34543455
* control port protocol ethertype. The device also honours the

net/mac80211/util.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3523,7 +3523,9 @@ int ieee80211_check_combinations(struct ieee80211_sub_if_data *sdata,
35233523
}
35243524

35253525
/* Always allow software iftypes */
3526-
if (local->hw.wiphy->software_iftypes & BIT(iftype)) {
3526+
if (local->hw.wiphy->software_iftypes & BIT(iftype) ||
3527+
(iftype == NL80211_IFTYPE_AP_VLAN &&
3528+
local->hw.wiphy->flags & WIPHY_FLAG_4ADDR_AP)) {
35273529
if (radar_detect)
35283530
return -EINVAL;
35293531
return 0;

net/wireless/core.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1335,8 +1335,12 @@ static int cfg80211_netdev_notifier_call(struct notifier_block *nb,
13351335
}
13361336
break;
13371337
case NETDEV_PRE_UP:
1338-
if (!(wdev->wiphy->interface_modes & BIT(wdev->iftype)))
1338+
if (!(wdev->wiphy->interface_modes & BIT(wdev->iftype)) &&
1339+
!(wdev->iftype == NL80211_IFTYPE_AP_VLAN &&
1340+
rdev->wiphy.flags & WIPHY_FLAG_4ADDR_AP &&
1341+
wdev->use_4addr))
13391342
return notifier_from_errno(-EOPNOTSUPP);
1343+
13401344
if (rfkill_blocked(rdev->rfkill))
13411345
return notifier_from_errno(-ERFKILL);
13421346
break;

net/wireless/nl80211.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3191,8 +3191,7 @@ static int nl80211_new_interface(struct sk_buff *skb, struct genl_info *info)
31913191
return -EINVAL;
31923192
}
31933193

3194-
if (!rdev->ops->add_virtual_intf ||
3195-
!(rdev->wiphy.interface_modes & (1 << type)))
3194+
if (!rdev->ops->add_virtual_intf)
31963195
return -EOPNOTSUPP;
31973196

31983197
if ((type == NL80211_IFTYPE_P2P_DEVICE || type == NL80211_IFTYPE_NAN ||
@@ -3211,6 +3210,11 @@ static int nl80211_new_interface(struct sk_buff *skb, struct genl_info *info)
32113210
return err;
32123211
}
32133212

3213+
if (!(rdev->wiphy.interface_modes & (1 << type)) &&
3214+
!(type == NL80211_IFTYPE_AP_VLAN && params.use_4addr &&
3215+
rdev->wiphy.flags & WIPHY_FLAG_4ADDR_AP))
3216+
return -EOPNOTSUPP;
3217+
32143218
err = nl80211_parse_mon_options(rdev, type, info, &params);
32153219
if (err < 0)
32163220
return err;

0 commit comments

Comments
 (0)