Commit 0e956c132f822d414a4ce84726ac1d1294364581

Authored by Thadeu Lima de Souza Cascardo
Committed by John W. Linville
1 parent 2f5265e6e7

nl80211: does not allow NEW_STATION and DEL_STATION for mesh

As discussed in linux-wireless mailing list, adding and removing
stations for mesh topologies is not necessary. Since doing it triggers
bugs, the sugestion was to simply disable it.

Tested using a custom iw command "station new". Works only after using
hostapd. "station del" command also works.

Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@holoscopio.com>
Cc: Johannes Berg <johannes@sipsolutions.net>
Cc: Simon Raffeiner <sturmflut@lieberbiber.de>
Cc: Andrey Yurovsky <andrey@cozybit.com>
Cc: Javier Cardona <javier@cozybit.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>

Showing 1 changed file with 13 additions and 36 deletions Side-by-side Diff

net/wireless/nl80211.c
... ... @@ -2010,6 +2010,9 @@
2010 2010 if (!info->attrs[NL80211_ATTR_STA_SUPPORTED_RATES])
2011 2011 return -EINVAL;
2012 2012  
  2013 + if (!info->attrs[NL80211_ATTR_STA_AID])
  2014 + return -EINVAL;
  2015 +
2013 2016 mac_addr = nla_data(info->attrs[NL80211_ATTR_MAC]);
2014 2017 params.supported_rates =
2015 2018 nla_data(info->attrs[NL80211_ATTR_STA_SUPPORTED_RATES]);
... ... @@ -2018,11 +2021,9 @@
2018 2021 params.listen_interval =
2019 2022 nla_get_u16(info->attrs[NL80211_ATTR_STA_LISTEN_INTERVAL]);
2020 2023  
2021   - if (info->attrs[NL80211_ATTR_STA_AID]) {
2022   - params.aid = nla_get_u16(info->attrs[NL80211_ATTR_STA_AID]);
2023   - if (!params.aid || params.aid > IEEE80211_MAX_AID)
2024   - return -EINVAL;
2025   - }
  2024 + params.aid = nla_get_u16(info->attrs[NL80211_ATTR_STA_AID]);
  2025 + if (!params.aid || params.aid > IEEE80211_MAX_AID)
  2026 + return -EINVAL;
2026 2027  
2027 2028 if (info->attrs[NL80211_ATTR_HT_CAPABILITY])
2028 2029 params.ht_capa =
... ... @@ -2037,6 +2038,12 @@
2037 2038 if (err)
2038 2039 goto out_rtnl;
2039 2040  
  2041 + if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_AP &&
  2042 + dev->ieee80211_ptr->iftype != NL80211_IFTYPE_AP_VLAN) {
  2043 + err = -EINVAL;
  2044 + goto out;
  2045 + }
  2046 +
2040 2047 err = get_vlan(info, rdev, &params.vlan);
2041 2048 if (err)
2042 2049 goto out;
... ... @@ -2044,35 +2051,6 @@
2044 2051 /* validate settings */
2045 2052 err = 0;
2046 2053  
2047   - switch (dev->ieee80211_ptr->iftype) {
2048   - case NL80211_IFTYPE_AP:
2049   - case NL80211_IFTYPE_AP_VLAN:
2050   - /* all ok but must have AID */
2051   - if (!params.aid)
2052   - err = -EINVAL;
2053   - break;
2054   - case NL80211_IFTYPE_MESH_POINT:
2055   - /* disallow things mesh doesn't support */
2056   - if (params.vlan)
2057   - err = -EINVAL;
2058   - if (params.aid)
2059   - err = -EINVAL;
2060   - if (params.ht_capa)
2061   - err = -EINVAL;
2062   - if (params.listen_interval >= 0)
2063   - err = -EINVAL;
2064   - if (params.supported_rates)
2065   - err = -EINVAL;
2066   - if (params.sta_flags_mask)
2067   - err = -EINVAL;
2068   - break;
2069   - default:
2070   - err = -EINVAL;
2071   - }
2072   -
2073   - if (err)
2074   - goto out;
2075   -
2076 2054 if (!rdev->ops->add_station) {
2077 2055 err = -EOPNOTSUPP;
2078 2056 goto out;
... ... @@ -2113,8 +2091,7 @@
2113 2091 goto out_rtnl;
2114 2092  
2115 2093 if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_AP &&
2116   - dev->ieee80211_ptr->iftype != NL80211_IFTYPE_AP_VLAN &&
2117   - dev->ieee80211_ptr->iftype != NL80211_IFTYPE_MESH_POINT) {
  2094 + dev->ieee80211_ptr->iftype != NL80211_IFTYPE_AP_VLAN) {
2118 2095 err = -EINVAL;
2119 2096 goto out;
2120 2097 }