390-nl-mac-80211-allow-4addr-AP-operation-on-crypto-cont.patch 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. From 3ad31f4efe9674a8bda057c79995a9468281e77f Mon Sep 17 00:00:00 2001
  2. From: Manikanta Pubbisetty <[email protected]>
  3. Date: Wed, 21 Nov 2018 16:33:48 +0530
  4. Subject: [PATCH] {nl,mac}80211: allow 4addr AP operation on crypto controlled
  5. devices
  6. As per the current design, for sw crypto controlled devices, it is
  7. the device which has to advertise the support for AP/VLAN iftype
  8. based on it's capability to tranmsit packets encrypted in software
  9. (In VLAN functionality, group traffic generated for a specific
  10. VLAN group is always encrypted in software). Commit db3bdcb9c3ff
  11. ("mac80211: allow AP_VLAN operation on crypto controlled devices")
  12. has introduced this change.
  13. Since 4addr AP operation also uses AP/VLAN iftype, this conditional
  14. way of advertising AP/VLAN support has broken 4addr AP mode operation on
  15. crypto controlled devices which do not support VLAN functionality.
  16. For example:
  17. In the case of ath10k driver, not all firmwares have support for VLAN
  18. functionality but all can support 4addr AP operation. Because AP/VLAN
  19. support is not advertised for these devices, 4addr AP operations are
  20. also blocked.
  21. Fix this by allowing 4addr opertion on devices which do not advertise
  22. AP/VLAN iftype but which can support 4addr operation (the desicion is
  23. taken based on the wiphy flag WIPHY_FLAG_4ADDR_AP).
  24. Fixes: Commit db3bdcb9c3ff ("mac80211: allow AP_VLAN operation on
  25. crypto controlled devices")
  26. Signed-off-by: Manikanta Pubbisetty <[email protected]>
  27. ---
  28. include/net/cfg80211.h | 3 ++-
  29. net/mac80211/util.c | 4 +++-
  30. net/wireless/core.c | 9 +++++++--
  31. net/wireless/nl80211.c | 10 ++++++++--
  32. 4 files changed, 20 insertions(+), 6 deletions(-)
  33. --- a/include/net/cfg80211.h
  34. +++ b/include/net/cfg80211.h
  35. @@ -3457,7 +3457,8 @@ struct cfg80211_ops {
  36. * on wiphy_new(), but can be changed by the driver if it has a good
  37. * reason to override the default
  38. * @WIPHY_FLAG_4ADDR_AP: supports 4addr mode even on AP (with a single station
  39. - * on a VLAN interface)
  40. + * on a VLAN interface). This flag also serves an extra purpose of
  41. + * supporting 4ADDR AP mode on devices which do not support AP/VLAN iftype.
  42. * @WIPHY_FLAG_4ADDR_STATION: supports 4addr mode even as a station
  43. * @WIPHY_FLAG_CONTROL_PORT_PROTOCOL: This device supports setting the
  44. * control port protocol ethertype. The device also honours the
  45. --- a/net/mac80211/util.c
  46. +++ b/net/mac80211/util.c
  47. @@ -3626,7 +3626,9 @@ int ieee80211_check_combinations(struct
  48. }
  49. /* Always allow software iftypes */
  50. - if (local->hw.wiphy->software_iftypes & BIT(iftype)) {
  51. + if (local->hw.wiphy->software_iftypes & BIT(iftype) ||
  52. + (iftype == NL80211_IFTYPE_AP_VLAN &&
  53. + local->hw.wiphy->flags & WIPHY_FLAG_4ADDR_AP)) {
  54. if (radar_detect)
  55. return -EINVAL;
  56. return 0;
  57. --- a/net/wireless/core.c
  58. +++ b/net/wireless/core.c
  59. @@ -1351,8 +1351,13 @@ static int cfg80211_netdev_notifier_call
  60. }
  61. break;
  62. case NETDEV_PRE_UP:
  63. - if (!(wdev->wiphy->interface_modes & BIT(wdev->iftype)))
  64. - return notifier_from_errno(-EOPNOTSUPP);
  65. + if (!(wdev->wiphy->interface_modes & BIT(wdev->iftype))) {
  66. + if (!(wdev->iftype == NL80211_IFTYPE_AP_VLAN &&
  67. + rdev->wiphy.flags & WIPHY_FLAG_4ADDR_AP &&
  68. + wdev->use_4addr))
  69. + return notifier_from_errno(-EOPNOTSUPP);
  70. + }
  71. +
  72. if (rfkill_blocked(rdev->rfkill))
  73. return notifier_from_errno(-ERFKILL);
  74. break;
  75. --- a/net/wireless/nl80211.c
  76. +++ b/net/wireless/nl80211.c
  77. @@ -3194,8 +3194,7 @@ static int nl80211_new_interface(struct
  78. return -EINVAL;
  79. }
  80. - if (!rdev->ops->add_virtual_intf ||
  81. - !(rdev->wiphy.interface_modes & (1 << type)))
  82. + if (!rdev->ops->add_virtual_intf)
  83. return -EOPNOTSUPP;
  84. if ((type == NL80211_IFTYPE_P2P_DEVICE || type == NL80211_IFTYPE_NAN ||
  85. @@ -3214,6 +3213,13 @@ static int nl80211_new_interface(struct
  86. return err;
  87. }
  88. + if (!(rdev->wiphy.interface_modes & (1 << type))) {
  89. + if (!(type == NL80211_IFTYPE_AP_VLAN &&
  90. + rdev->wiphy.flags & WIPHY_FLAG_4ADDR_AP &&
  91. + params.use_4addr))
  92. + return -EOPNOTSUPP;
  93. + }
  94. +
  95. err = nl80211_parse_mon_options(rdev, type, info, &params);
  96. if (err < 0)
  97. return err;