]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
{nl,mac}80211: allow 4addr AP operation on crypto controlled devices
authorManikanta Pubbisetty <mpubbise@codeaurora.org>
Wed, 8 May 2019 09:25:33 +0000 (14:55 +0530)
committerKleber Sacilotto de Souza <kleber.souza@canonical.com>
Wed, 14 Aug 2019 09:18:49 +0000 (11:18 +0200)
BugLink: https://bugs.launchpad.net/bugs/1838824
commit 33d915d9e8ce811d8958915ccd18d71a66c7c495 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 db3bdcb9c3ff
("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: db3bdcb9c3ff ("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>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
include/net/cfg80211.h
net/mac80211/util.c
net/wireless/core.c
net/wireless/nl80211.c

index fb94a8bd8ab54d6ffe722da48436030be637cf70..f42ab638a7c2da9ae724be68c1579e22591d845c 100644 (file)
@@ -3220,7 +3220,8 @@ struct cfg80211_ops {
  *     on wiphy_new(), but can be changed by the driver if it has a good
  *     reason to override the default
  * @WIPHY_FLAG_4ADDR_AP: supports 4addr mode even on AP (with a single station
- *     on a VLAN interface)
+ *     on a VLAN interface). This flag also serves an extra purpose of
+ *     supporting 4ADDR AP mode on devices which do not support AP/VLAN iftype.
  * @WIPHY_FLAG_4ADDR_STATION: supports 4addr mode even as a station
  * @WIPHY_FLAG_CONTROL_PORT_PROTOCOL: This device supports setting the
  *     control port protocol ethertype. The device also honours the
index 68e4ff307e34f67fe4dec4073e8d5306e2185cf0..f20a54540c3b0d5f37730ffeb4ea4c196292e91a 100644 (file)
@@ -3385,7 +3385,9 @@ int ieee80211_check_combinations(struct ieee80211_sub_if_data *sdata,
        }
 
        /* Always allow software iftypes */
-       if (local->hw.wiphy->software_iftypes & BIT(iftype)) {
+       if (local->hw.wiphy->software_iftypes & BIT(iftype) ||
+           (iftype == NL80211_IFTYPE_AP_VLAN &&
+            local->hw.wiphy->flags & WIPHY_FLAG_4ADDR_AP)) {
                if (radar_detect)
                        return -EINVAL;
                return 0;
index 87d407935eaff79d4c5daecda1a7cc9cdd688956..45dddc491f5f1b97edc87da3f3ededc64e474563 100644 (file)
@@ -1311,8 +1311,12 @@ static int cfg80211_netdev_notifier_call(struct notifier_block *nb,
                }
                break;
        case NETDEV_PRE_UP:
-               if (!(wdev->wiphy->interface_modes & BIT(wdev->iftype)))
+               if (!(wdev->wiphy->interface_modes & BIT(wdev->iftype)) &&
+                   !(wdev->iftype == NL80211_IFTYPE_AP_VLAN &&
+                     rdev->wiphy.flags & WIPHY_FLAG_4ADDR_AP &&
+                     wdev->use_4addr))
                        return notifier_from_errno(-EOPNOTSUPP);
+
                if (rfkill_blocked(rdev->rfkill))
                        return notifier_from_errno(-ERFKILL);
                break;
index 8d89cc9cd24e76055dfa836dbdd1b8901afaf6de..0033a7e100573d0c7377ed209f7ec87de2ced0f1 100644 (file)
@@ -2951,8 +2951,7 @@ static int nl80211_new_interface(struct sk_buff *skb, struct genl_info *info)
                        return -EINVAL;
        }
 
-       if (!rdev->ops->add_virtual_intf ||
-           !(rdev->wiphy.interface_modes & (1 << type)))
+       if (!rdev->ops->add_virtual_intf)
                return -EOPNOTSUPP;
 
        if ((type == NL80211_IFTYPE_P2P_DEVICE || type == NL80211_IFTYPE_NAN ||
@@ -2971,6 +2970,11 @@ static int nl80211_new_interface(struct sk_buff *skb, struct genl_info *info)
                        return err;
        }
 
+       if (!(rdev->wiphy.interface_modes & (1 << type)) &&
+           !(type == NL80211_IFTYPE_AP_VLAN && params.use_4addr &&
+             rdev->wiphy.flags & WIPHY_FLAG_4ADDR_AP))
+               return -EOPNOTSUPP;
+
        err = nl80211_parse_mon_options(rdev, type, info, &params);
        if (err < 0)
                return err;