Skip to content

Commit 3e49317

Browse files
Jouni Malinendavem330
authored andcommitted
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 <[email protected]> Reviewed-by: Johannes Berg <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 3dfdecc commit 3e49317

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
@@ -1529,7 +1529,6 @@ static int ieee80211_add_station(struct wiphy *wiphy, struct net_device *dev,
15291529
struct sta_info *sta;
15301530
struct ieee80211_sub_if_data *sdata;
15311531
int err;
1532-
int layer2_update;
15331532

15341533
if (params->vlan) {
15351534
sdata = IEEE80211_DEV_TO_SUB_IF(params->vlan);
@@ -1573,18 +1572,12 @@ static int ieee80211_add_station(struct wiphy *wiphy, struct net_device *dev,
15731572
test_sta_flag(sta, WLAN_STA_ASSOC))
15741573
rate_control_rate_init(sta);
15751574

1576-
layer2_update = sdata->vif.type == NL80211_IFTYPE_AP_VLAN ||
1577-
sdata->vif.type == NL80211_IFTYPE_AP;
1578-
15791575
err = sta_info_insert_rcu(sta);
15801576
if (err) {
15811577
rcu_read_unlock();
15821578
return err;
15831579
}
15841580

1585-
if (layer2_update)
1586-
cfg80211_send_layer2_update(sta->sdata->dev, sta->sta.addr);
1587-
15881581
rcu_read_unlock();
15891582

15901583
return 0;
@@ -1682,10 +1675,11 @@ static int ieee80211_change_station(struct wiphy *wiphy,
16821675
sta->sdata = vlansdata;
16831676
ieee80211_check_fast_xmit(sta);
16841677

1685-
if (test_sta_flag(sta, WLAN_STA_AUTHORIZED))
1678+
if (test_sta_flag(sta, WLAN_STA_AUTHORIZED)) {
16861679
ieee80211_vif_inc_num_mcast(sta->sdata);
1687-
1688-
cfg80211_send_layer2_update(sta->sdata->dev, sta->sta.addr);
1680+
cfg80211_send_layer2_update(sta->sdata->dev,
1681+
sta->sta.addr);
1682+
}
16891683
}
16901684

16911685
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
@@ -1979,6 +1979,10 @@ int sta_info_move_state(struct sta_info *sta,
19791979
ieee80211_check_fast_xmit(sta);
19801980
ieee80211_check_fast_rx(sta);
19811981
}
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);
19821986
break;
19831987
default:
19841988
break;

0 commit comments

Comments
 (0)