Skip to content

Commit 57e1b5f

Browse files
Jouni Malinengregkh
authored andcommitted
mac80211: Do not send Layer 2 Update frame before authorization
commit 3e49317 upstream. 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 <[email protected]> Reviewed-by: Johannes Berg <[email protected]> Signed-off-by: David S. Miller <[email protected]> Signed-off-by: Ben Hutchings <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent b06e6e5 commit 57e1b5f

File tree

2 files changed

+8
-10
lines changed

2 files changed

+8
-10
lines changed

net/mac80211/cfg.c

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1398,7 +1398,6 @@ static int ieee80211_add_station(struct wiphy *wiphy, struct net_device *dev,
13981398
struct sta_info *sta;
13991399
struct ieee80211_sub_if_data *sdata;
14001400
int err;
1401-
int layer2_update;
14021401

14031402
if (params->vlan) {
14041403
sdata = IEEE80211_DEV_TO_SUB_IF(params->vlan);
@@ -1442,18 +1441,12 @@ static int ieee80211_add_station(struct wiphy *wiphy, struct net_device *dev,
14421441
test_sta_flag(sta, WLAN_STA_ASSOC))
14431442
rate_control_rate_init(sta);
14441443

1445-
layer2_update = sdata->vif.type == NL80211_IFTYPE_AP_VLAN ||
1446-
sdata->vif.type == NL80211_IFTYPE_AP;
1447-
14481444
err = sta_info_insert_rcu(sta);
14491445
if (err) {
14501446
rcu_read_unlock();
14511447
return err;
14521448
}
14531449

1454-
if (layer2_update)
1455-
cfg80211_send_layer2_update(sta->sdata->dev, sta->sta.addr);
1456-
14571450
rcu_read_unlock();
14581451

14591452
return 0;
@@ -1551,10 +1544,11 @@ static int ieee80211_change_station(struct wiphy *wiphy,
15511544
sta->sdata = vlansdata;
15521545
ieee80211_check_fast_xmit(sta);
15531546

1554-
if (test_sta_flag(sta, WLAN_STA_AUTHORIZED))
1547+
if (test_sta_flag(sta, WLAN_STA_AUTHORIZED)) {
15551548
ieee80211_vif_inc_num_mcast(sta->sdata);
1556-
1557-
cfg80211_send_layer2_update(sta->sdata->dev, sta->sta.addr);
1549+
cfg80211_send_layer2_update(sta->sdata->dev,
1550+
sta->sta.addr);
1551+
}
15581552
}
15591553

15601554
err = sta_apply_parameters(local, sta, params);

net/mac80211/sta_info.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1899,6 +1899,10 @@ int sta_info_move_state(struct sta_info *sta,
18991899
ieee80211_check_fast_xmit(sta);
19001900
ieee80211_check_fast_rx(sta);
19011901
}
1902+
if (sta->sdata->vif.type == NL80211_IFTYPE_AP_VLAN ||
1903+
sta->sdata->vif.type == NL80211_IFTYPE_AP)
1904+
cfg80211_send_layer2_update(sta->sdata->dev,
1905+
sta->sta.addr);
19021906
break;
19031907
default:
19041908
break;

0 commit comments

Comments
 (0)