diff options
Diffstat (limited to 'net/wireless/util.c')
-rw-r--r-- | net/wireless/util.c | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/net/wireless/util.c b/net/wireless/util.c index 1c39d6a2e850..d0e35b7b9e35 100644 --- a/net/wireless/util.c +++ b/net/wireless/util.c | |||
@@ -1697,7 +1697,7 @@ int cfg80211_iter_combinations(struct wiphy *wiphy, | |||
1697 | for (iftype = 0; iftype < NUM_NL80211_IFTYPES; iftype++) { | 1697 | for (iftype = 0; iftype < NUM_NL80211_IFTYPES; iftype++) { |
1698 | num_interfaces += params->iftype_num[iftype]; | 1698 | num_interfaces += params->iftype_num[iftype]; |
1699 | if (params->iftype_num[iftype] > 0 && | 1699 | if (params->iftype_num[iftype] > 0 && |
1700 | !(wiphy->software_iftypes & BIT(iftype))) | 1700 | !cfg80211_iftype_allowed(wiphy, iftype, 0, 1)) |
1701 | used_iftypes |= BIT(iftype); | 1701 | used_iftypes |= BIT(iftype); |
1702 | } | 1702 | } |
1703 | 1703 | ||
@@ -1719,7 +1719,7 @@ int cfg80211_iter_combinations(struct wiphy *wiphy, | |||
1719 | return -ENOMEM; | 1719 | return -ENOMEM; |
1720 | 1720 | ||
1721 | for (iftype = 0; iftype < NUM_NL80211_IFTYPES; iftype++) { | 1721 | for (iftype = 0; iftype < NUM_NL80211_IFTYPES; iftype++) { |
1722 | if (wiphy->software_iftypes & BIT(iftype)) | 1722 | if (cfg80211_iftype_allowed(wiphy, iftype, 0, 1)) |
1723 | continue; | 1723 | continue; |
1724 | for (j = 0; j < c->n_limits; j++) { | 1724 | for (j = 0; j < c->n_limits; j++) { |
1725 | all_iftypes |= limits[j].types; | 1725 | all_iftypes |= limits[j].types; |
@@ -2072,3 +2072,26 @@ int ieee80211_get_vht_max_nss(struct ieee80211_vht_cap *cap, | |||
2072 | return max_vht_nss; | 2072 | return max_vht_nss; |
2073 | } | 2073 | } |
2074 | EXPORT_SYMBOL(ieee80211_get_vht_max_nss); | 2074 | EXPORT_SYMBOL(ieee80211_get_vht_max_nss); |
2075 | |||
2076 | bool cfg80211_iftype_allowed(struct wiphy *wiphy, enum nl80211_iftype iftype, | ||
2077 | bool is_4addr, u8 check_swif) | ||
2078 | |||
2079 | { | ||
2080 | bool is_vlan = iftype == NL80211_IFTYPE_AP_VLAN; | ||
2081 | |||
2082 | switch (check_swif) { | ||
2083 | case 0: | ||
2084 | if (is_vlan && is_4addr) | ||
2085 | return wiphy->flags & WIPHY_FLAG_4ADDR_AP; | ||
2086 | return wiphy->interface_modes & BIT(iftype); | ||
2087 | case 1: | ||
2088 | if (!(wiphy->software_iftypes & BIT(iftype)) && is_vlan) | ||
2089 | return wiphy->flags & WIPHY_FLAG_4ADDR_AP; | ||
2090 | return wiphy->software_iftypes & BIT(iftype); | ||
2091 | default: | ||
2092 | break; | ||
2093 | } | ||
2094 | |||
2095 | return false; | ||
2096 | } | ||
2097 | EXPORT_SYMBOL(cfg80211_iftype_allowed); | ||