summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJouni Malinen <jouni@codeaurora.org>2019-09-11 09:03:05 -0400
committerDavid S. Miller <davem@davemloft.net>2019-09-11 09:59:26 -0400
commit3e493173b7841259a08c5c8e5cbe90adb349da7e (patch)
treeb1531badd43d0d769728ddaccf909303ed109ae2
parent3dfdecc6d1256835ac0612b2a8f7595466d66327 (diff)
mac80211: Do not send Layer 2 Update frame before authorization
The Layer 2 Update frame is used to update bridges when a station roams to another AP even if that STA does not transmit any frames after the reassociation. This behavior was described in IEEE Std 802.11F-2003 as something that would happen based on MLME-ASSOCIATE.indication, i.e., before completing 4-way handshake. However, this IEEE trial-use recommended practice document was published before RSN (IEEE Std 802.11i-2004) and as such, did not consider RSN use cases. Furthermore, IEEE Std 802.11F-2003 was withdrawn in 2006 and as such, has not been maintained amd should not be used anymore. Sending out the Layer 2 Update frame immediately after association is fine for open networks (and also when using SAE, FT protocol, or FILS authentication when the station is actually authenticated by the time association completes). However, it is not appropriate for cases where RSN is used with PSK or EAP authentication since the station is actually fully authenticated only once the 4-way handshake completes after authentication and attackers might be able to use the unauthenticated triggering of Layer 2 Update frame transmission to disrupt bridge behavior. Fix this by postponing transmission of the Layer 2 Update frame from station entry addition to the point when the station entry is marked authorized. Similarly, send out the VLAN binding update only if the STA entry has already been authorized. Signed-off-by: Jouni Malinen <jouni@codeaurora.org> Reviewed-by: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--net/mac80211/cfg.c14
-rw-r--r--net/mac80211/sta_info.c4
2 files changed, 8 insertions, 10 deletions
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index 111c400199ec..4105c97c7ba1 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -1529,7 +1529,6 @@ static int ieee80211_add_station(struct wiphy *wiphy, struct net_device *dev,
1529 struct sta_info *sta; 1529 struct sta_info *sta;
1530 struct ieee80211_sub_if_data *sdata; 1530 struct ieee80211_sub_if_data *sdata;
1531 int err; 1531 int err;
1532 int layer2_update;
1533 1532
1534 if (params->vlan) { 1533 if (params->vlan) {
1535 sdata = IEEE80211_DEV_TO_SUB_IF(params->vlan); 1534 sdata = IEEE80211_DEV_TO_SUB_IF(params->vlan);
@@ -1573,18 +1572,12 @@ static int ieee80211_add_station(struct wiphy *wiphy, struct net_device *dev,
1573 test_sta_flag(sta, WLAN_STA_ASSOC)) 1572 test_sta_flag(sta, WLAN_STA_ASSOC))
1574 rate_control_rate_init(sta); 1573 rate_control_rate_init(sta);
1575 1574
1576 layer2_update = sdata->vif.type == NL80211_IFTYPE_AP_VLAN ||
1577 sdata->vif.type == NL80211_IFTYPE_AP;
1578
1579 err = sta_info_insert_rcu(sta); 1575 err = sta_info_insert_rcu(sta);
1580 if (err) { 1576 if (err) {
1581 rcu_read_unlock(); 1577 rcu_read_unlock();
1582 return err; 1578 return err;
1583 } 1579 }
1584 1580
1585 if (layer2_update)
1586 cfg80211_send_layer2_update(sta->sdata->dev, sta->sta.addr);
1587
1588 rcu_read_unlock(); 1581 rcu_read_unlock();
1589 1582
1590 return 0; 1583 return 0;
@@ -1682,10 +1675,11 @@ static int ieee80211_change_station(struct wiphy *wiphy,
1682 sta->sdata = vlansdata; 1675 sta->sdata = vlansdata;
1683 ieee80211_check_fast_xmit(sta); 1676 ieee80211_check_fast_xmit(sta);
1684 1677
1685 if (test_sta_flag(sta, WLAN_STA_AUTHORIZED)) 1678 if (test_sta_flag(sta, WLAN_STA_AUTHORIZED)) {
1686 ieee80211_vif_inc_num_mcast(sta->sdata); 1679 ieee80211_vif_inc_num_mcast(sta->sdata);
1687 1680 cfg80211_send_layer2_update(sta->sdata->dev,
1688 cfg80211_send_layer2_update(sta->sdata->dev, sta->sta.addr); 1681 sta->sta.addr);
1682 }
1689 } 1683 }
1690 1684
1691 err = sta_apply_parameters(local, sta, params); 1685 err = sta_apply_parameters(local, sta, params);
diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c
index 95eb8220e2e4..5fb368cc2633 100644
--- a/net/mac80211/sta_info.c
+++ b/net/mac80211/sta_info.c
@@ -1979,6 +1979,10 @@ int sta_info_move_state(struct sta_info *sta,
1979 ieee80211_check_fast_xmit(sta); 1979 ieee80211_check_fast_xmit(sta);
1980 ieee80211_check_fast_rx(sta); 1980 ieee80211_check_fast_rx(sta);
1981 } 1981 }
1982 if (sta->sdata->vif.type == NL80211_IFTYPE_AP_VLAN ||
1983 sta->sdata->vif.type == NL80211_IFTYPE_AP)
1984 cfg80211_send_layer2_update(sta->sdata->dev,
1985 sta->sta.addr);
1982 break; 1986 break;
1983 default: 1987 default:
1984 break; 1988 break;