diff options
author | Felix Fietkau <nbd@openwrt.org> | 2012-04-23 13:49:03 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2012-04-24 14:54:28 -0400 |
commit | 7e3ed02c6e65a0cb4c9259c0d34740305d9aa5e7 (patch) | |
tree | 47a2a239639feaafd89729224d9e26492bb4eccd /net/mac80211/cfg.c | |
parent | 030ef8f8a59c77d44cadeded6d3a5a12557774f4 (diff) |
mac80211: fix num_mcast_sta counting issues
Moving a STA to an AP VLAN prevents num_mcast_sta from being decremented
once the STA leaves, because sta->sdata changes. Fix this by checking
for AP VLANs as well.
Also exclude 4-addr VLAN stations from num_mcast_sta - remote 4-addr
stations ignore 3-address multicast frames anyway. In a typical bridge
configuration they receive the same packets as 4-address unicast.
This patch also fixes clearing the sdata->u.vlan.sta pointer when the
STA is removed from a 4-addr VLAN.
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/mac80211/cfg.c')
-rw-r--r-- | net/mac80211/cfg.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c index 510a745c3108..70b2af2315a6 100644 --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c | |||
@@ -1005,6 +1005,9 @@ static int ieee80211_change_station(struct wiphy *wiphy, | |||
1005 | } | 1005 | } |
1006 | 1006 | ||
1007 | if (params->vlan && params->vlan != sta->sdata->dev) { | 1007 | if (params->vlan && params->vlan != sta->sdata->dev) { |
1008 | bool prev_4addr = false; | ||
1009 | bool new_4addr = false; | ||
1010 | |||
1008 | vlansdata = IEEE80211_DEV_TO_SUB_IF(params->vlan); | 1011 | vlansdata = IEEE80211_DEV_TO_SUB_IF(params->vlan); |
1009 | 1012 | ||
1010 | if (vlansdata->vif.type != NL80211_IFTYPE_AP_VLAN && | 1013 | if (vlansdata->vif.type != NL80211_IFTYPE_AP_VLAN && |
@@ -1020,9 +1023,25 @@ static int ieee80211_change_station(struct wiphy *wiphy, | |||
1020 | } | 1023 | } |
1021 | 1024 | ||
1022 | rcu_assign_pointer(vlansdata->u.vlan.sta, sta); | 1025 | rcu_assign_pointer(vlansdata->u.vlan.sta, sta); |
1026 | new_4addr = true; | ||
1027 | } | ||
1028 | |||
1029 | if (sta->sdata->vif.type == NL80211_IFTYPE_AP_VLAN && | ||
1030 | sta->sdata->u.vlan.sta) { | ||
1031 | rcu_assign_pointer(sta->sdata->u.vlan.sta, NULL); | ||
1032 | prev_4addr = true; | ||
1023 | } | 1033 | } |
1024 | 1034 | ||
1025 | sta->sdata = vlansdata; | 1035 | sta->sdata = vlansdata; |
1036 | |||
1037 | if (sta->sta_state == IEEE80211_STA_AUTHORIZED && | ||
1038 | prev_4addr != new_4addr) { | ||
1039 | if (new_4addr) | ||
1040 | atomic_dec(&sta->sdata->bss->num_mcast_sta); | ||
1041 | else | ||
1042 | atomic_inc(&sta->sdata->bss->num_mcast_sta); | ||
1043 | } | ||
1044 | |||
1026 | ieee80211_send_layer2_update(sta); | 1045 | ieee80211_send_layer2_update(sta); |
1027 | } | 1046 | } |
1028 | 1047 | ||