Skip to content

Commit 4abb52a

Browse files
sara-sjmberg-intel
authored andcommitted
mac80211: pass bssids to elements parsing function
In multiple BSSID, we have nested IEs inside the multiple BSSID IE, that override the external ones for that specific BSS. As preparation for supporting that, pass 2 BSSIDs to the parse function, the transmitter, and the selected BSSID, so it can know which IEs to choose. If the selected BSSID is NULL, the outer ones will be applied. Change ieee80211_bss_info_update to parse elements itself, instead of receiving them parsed, so we have the relevant bss entry in hand. Signed-off-by: Sara Sharon <[email protected]> Signed-off-by: Johannes Berg <[email protected]>
1 parent 9f30861 commit 4abb52a

File tree

9 files changed

+95
-72
lines changed

9 files changed

+95
-72
lines changed

net/mac80211/ibss.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
* Copyright 2009, Johannes Berg <[email protected]>
99
* Copyright 2013-2014 Intel Mobile Communications GmbH
1010
* Copyright(c) 2016 Intel Deutschland GmbH
11+
* Copyright(c) 2018-2019 Intel Corporation
1112
*
1213
* This program is free software; you can redistribute it and/or modify
1314
* it under the terms of the GNU General Public License version 2 as
@@ -1124,8 +1125,7 @@ static void ieee80211_rx_bss_info(struct ieee80211_sub_if_data *sdata,
11241125

11251126
ieee80211_update_sta_info(sdata, mgmt, len, rx_status, elems, channel);
11261127

1127-
bss = ieee80211_bss_info_update(local, rx_status, mgmt, len, elems,
1128-
channel);
1128+
bss = ieee80211_bss_info_update(local, rx_status, mgmt, len, channel);
11291129
if (!bss)
11301130
return;
11311131

@@ -1604,7 +1604,7 @@ void ieee80211_rx_mgmt_probe_beacon(struct ieee80211_sub_if_data *sdata,
16041604
return;
16051605

16061606
ieee802_11_parse_elems(mgmt->u.probe_resp.variable, len - baselen,
1607-
false, &elems);
1607+
false, &elems, mgmt->bssid, NULL);
16081608

16091609
ieee80211_rx_bss_info(sdata, mgmt, len, rx_status, &elems);
16101610
}
@@ -1654,7 +1654,7 @@ void ieee80211_ibss_rx_queued_mgmt(struct ieee80211_sub_if_data *sdata,
16541654

16551655
ieee802_11_parse_elems(
16561656
mgmt->u.action.u.chan_switch.variable,
1657-
ies_len, true, &elems);
1657+
ies_len, true, &elems, mgmt->bssid, NULL);
16581658

16591659
if (elems.parse_error)
16601660
break;

net/mac80211/ieee80211_i.h

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* Copyright 2006-2007 Jiri Benc <[email protected]>
55
* Copyright 2007-2010 Johannes Berg <[email protected]>
66
* Copyright 2013-2015 Intel Mobile Communications GmbH
7-
* Copyright (C) 2018 Intel Corporation
7+
* Copyright (C) 2018-2019 Intel Corporation
88
*
99
* This program is free software; you can redistribute it and/or modify
1010
* it under the terms of the GNU General Public License version 2 as
@@ -1672,7 +1672,6 @@ ieee80211_bss_info_update(struct ieee80211_local *local,
16721672
struct ieee80211_rx_status *rx_status,
16731673
struct ieee80211_mgmt *mgmt,
16741674
size_t len,
1675-
struct ieee802_11_elems *elems,
16761675
struct ieee80211_channel *channel);
16771676
void ieee80211_rx_bss_put(struct ieee80211_local *local,
16781677
struct ieee80211_bss *bss);
@@ -1956,12 +1955,16 @@ static inline void ieee80211_tx_skb(struct ieee80211_sub_if_data *sdata,
19561955

19571956
u32 ieee802_11_parse_elems_crc(const u8 *start, size_t len, bool action,
19581957
struct ieee802_11_elems *elems,
1959-
u64 filter, u32 crc);
1958+
u64 filter, u32 crc, u8 *transmitter_bssid,
1959+
u8 *bss_bssid);
19601960
static inline void ieee802_11_parse_elems(const u8 *start, size_t len,
19611961
bool action,
1962-
struct ieee802_11_elems *elems)
1962+
struct ieee802_11_elems *elems,
1963+
u8 *transmitter_bssid,
1964+
u8 *bss_bssid)
19631965
{
1964-
ieee802_11_parse_elems_crc(start, len, action, elems, 0, 0);
1966+
ieee802_11_parse_elems_crc(start, len, action, elems, 0, 0,
1967+
transmitter_bssid, bss_bssid);
19651968
}
19661969

19671970

net/mac80211/mesh.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* Copyright (c) 2008, 2009 open80211s Ltd.
3-
* Copyright (C) 2018 Intel Corporation
3+
* Copyright (C) 2018 - 2019 Intel Corporation
44
* Authors: Luis Carlos Cobo <[email protected]>
55
* Javier Cardona <[email protected]>
66
*
@@ -1106,7 +1106,8 @@ ieee80211_mesh_rx_probe_req(struct ieee80211_sub_if_data *sdata,
11061106
if (baselen > len)
11071107
return;
11081108

1109-
ieee802_11_parse_elems(pos, len - baselen, false, &elems);
1109+
ieee802_11_parse_elems(pos, len - baselen, false, &elems, mgmt->bssid,
1110+
NULL);
11101111

11111112
if (!elems.mesh_id)
11121113
return;
@@ -1170,7 +1171,7 @@ static void ieee80211_mesh_rx_bcn_presp(struct ieee80211_sub_if_data *sdata,
11701171
return;
11711172

11721173
ieee802_11_parse_elems(mgmt->u.probe_resp.variable, len - baselen,
1173-
false, &elems);
1174+
false, &elems, mgmt->bssid, NULL);
11741175

11751176
/* ignore non-mesh or secure / unsecure mismatch */
11761177
if ((!elems.mesh_id || !elems.mesh_config) ||
@@ -1306,7 +1307,8 @@ static void mesh_rx_csa_frame(struct ieee80211_sub_if_data *sdata,
13061307
pos = mgmt->u.action.u.chan_switch.variable;
13071308
baselen = offsetof(struct ieee80211_mgmt,
13081309
u.action.u.chan_switch.variable);
1309-
ieee802_11_parse_elems(pos, len - baselen, true, &elems);
1310+
ieee802_11_parse_elems(pos, len - baselen, true, &elems,
1311+
mgmt->bssid, NULL);
13101312

13111313
ifmsh->chsw_ttl = elems.mesh_chansw_params_ie->mesh_ttl;
13121314
if (!--ifmsh->chsw_ttl)

net/mac80211/mesh_hwmp.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/*
22
* Copyright (c) 2008, 2009 open80211s Ltd.
3+
* Copyright (C) 2019 Intel Corporation
34
* Author: Luis Carlos Cobo <[email protected]>
45
*
56
* This program is free software; you can redistribute it and/or modify
@@ -926,7 +927,7 @@ void mesh_rx_path_sel_frame(struct ieee80211_sub_if_data *sdata,
926927

927928
baselen = (u8 *) mgmt->u.action.u.mesh_action.variable - (u8 *) mgmt;
928929
ieee802_11_parse_elems(mgmt->u.action.u.mesh_action.variable,
929-
len - baselen, false, &elems);
930+
len - baselen, false, &elems, mgmt->bssid, NULL);
930931

931932
if (elems.preq) {
932933
if (elems.preq_len != 37)

net/mac80211/mesh_plink.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/*
22
* Copyright (c) 2008, 2009 open80211s Ltd.
3+
* Copyright (C) 2019 Intel Corporation
34
* Author: Luis Carlos Cobo <[email protected]>
45
*
56
* This program is free software; you can redistribute it and/or modify
@@ -1214,6 +1215,7 @@ void mesh_rx_plink_frame(struct ieee80211_sub_if_data *sdata,
12141215
if (baselen > len)
12151216
return;
12161217
}
1217-
ieee802_11_parse_elems(baseaddr, len - baselen, true, &elems);
1218+
ieee802_11_parse_elems(baseaddr, len - baselen, true, &elems,
1219+
mgmt->bssid, NULL);
12181220
mesh_process_plink_frame(sdata, mgmt, &elems, rx_status);
12191221
}

net/mac80211/mlme.c

Lines changed: 26 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2762,7 +2762,8 @@ static void ieee80211_auth_challenge(struct ieee80211_sub_if_data *sdata,
27622762
u32 tx_flags = 0;
27632763

27642764
pos = mgmt->u.auth.variable;
2765-
ieee802_11_parse_elems(pos, len - (pos - (u8 *) mgmt), false, &elems);
2765+
ieee802_11_parse_elems(pos, len - (pos - (u8 *)mgmt), false, &elems,
2766+
mgmt->bssid, auth_data->bss->bssid);
27662767
if (!elems.challenge)
27672768
return;
27682769
auth_data->expected_transaction = 4;
@@ -3130,7 +3131,8 @@ static bool ieee80211_assoc_success(struct ieee80211_sub_if_data *sdata,
31303131
}
31313132

31323133
pos = mgmt->u.assoc_resp.variable;
3133-
ieee802_11_parse_elems(pos, len - (pos - (u8 *) mgmt), false, &elems);
3134+
ieee802_11_parse_elems(pos, len - (pos - (u8 *)mgmt), false, &elems,
3135+
mgmt->bssid, assoc_data->bss->bssid);
31343136

31353137
if (!elems.supp_rates) {
31363138
sdata_info(sdata, "no SuppRates element in AssocResp\n");
@@ -3167,7 +3169,9 @@ static bool ieee80211_assoc_success(struct ieee80211_sub_if_data *sdata,
31673169
return false;
31683170

31693171
ieee802_11_parse_elems(bss_ies->data, bss_ies->len,
3170-
false, &bss_elems);
3172+
false, &bss_elems,
3173+
mgmt->bssid,
3174+
assoc_data->bss->bssid);
31713175
if (assoc_data->wmm &&
31723176
!elems.wmm_param && bss_elems.wmm_param) {
31733177
elems.wmm_param = bss_elems.wmm_param;
@@ -3464,7 +3468,8 @@ static void ieee80211_rx_mgmt_assoc_resp(struct ieee80211_sub_if_data *sdata,
34643468
return;
34653469

34663470
pos = mgmt->u.assoc_resp.variable;
3467-
ieee802_11_parse_elems(pos, len - (pos - (u8 *) mgmt), false, &elems);
3471+
ieee802_11_parse_elems(pos, len - (pos - (u8 *)mgmt), false, &elems,
3472+
mgmt->bssid, assoc_data->bss->bssid);
34683473

34693474
if (status_code == WLAN_STATUS_ASSOC_REJECTED_TEMPORARILY &&
34703475
elems.timeout_int &&
@@ -3521,8 +3526,7 @@ static void ieee80211_rx_mgmt_assoc_resp(struct ieee80211_sub_if_data *sdata,
35213526

35223527
static void ieee80211_rx_bss_info(struct ieee80211_sub_if_data *sdata,
35233528
struct ieee80211_mgmt *mgmt, size_t len,
3524-
struct ieee80211_rx_status *rx_status,
3525-
struct ieee802_11_elems *elems)
3529+
struct ieee80211_rx_status *rx_status)
35263530
{
35273531
struct ieee80211_local *local = sdata->local;
35283532
struct ieee80211_bss *bss;
@@ -3534,8 +3538,7 @@ static void ieee80211_rx_bss_info(struct ieee80211_sub_if_data *sdata,
35343538
if (!channel)
35353539
return;
35363540

3537-
bss = ieee80211_bss_info_update(local, rx_status, mgmt, len, elems,
3538-
channel);
3541+
bss = ieee80211_bss_info_update(local, rx_status, mgmt, len, channel);
35393542
if (bss) {
35403543
sdata->vif.bss_conf.beacon_rate = bss->beacon_rate;
35413544
ieee80211_rx_bss_put(local, bss);
@@ -3550,7 +3553,6 @@ static void ieee80211_rx_mgmt_probe_resp(struct ieee80211_sub_if_data *sdata,
35503553
struct ieee80211_if_managed *ifmgd;
35513554
struct ieee80211_rx_status *rx_status = (void *) skb->cb;
35523555
size_t baselen, len = skb->len;
3553-
struct ieee802_11_elems elems;
35543556

35553557
ifmgd = &sdata->u.mgd;
35563558

@@ -3563,10 +3565,7 @@ static void ieee80211_rx_mgmt_probe_resp(struct ieee80211_sub_if_data *sdata,
35633565
if (baselen > len)
35643566
return;
35653567

3566-
ieee802_11_parse_elems(mgmt->u.probe_resp.variable, len - baselen,
3567-
false, &elems);
3568-
3569-
ieee80211_rx_bss_info(sdata, mgmt, len, rx_status, &elems);
3568+
ieee80211_rx_bss_info(sdata, mgmt, len, rx_status);
35703569

35713570
if (ifmgd->associated &&
35723571
ether_addr_equal(mgmt->bssid, ifmgd->associated->bssid))
@@ -3736,9 +3735,11 @@ static void ieee80211_rx_mgmt_beacon(struct ieee80211_sub_if_data *sdata,
37363735
if (ifmgd->assoc_data && ifmgd->assoc_data->need_beacon &&
37373736
ether_addr_equal(mgmt->bssid, ifmgd->assoc_data->bss->bssid)) {
37383737
ieee802_11_parse_elems(mgmt->u.beacon.variable,
3739-
len - baselen, false, &elems);
3738+
len - baselen, false, &elems,
3739+
mgmt->bssid,
3740+
ifmgd->assoc_data->bss->bssid);
37403741

3741-
ieee80211_rx_bss_info(sdata, mgmt, len, rx_status, &elems);
3742+
ieee80211_rx_bss_info(sdata, mgmt, len, rx_status);
37423743
if (elems.tim && !elems.parse_error) {
37433744
const struct ieee80211_tim_ie *tim_ie = elems.tim;
37443745
ifmgd->dtim_period = tim_ie->dtim_period;
@@ -3787,7 +3788,8 @@ static void ieee80211_rx_mgmt_beacon(struct ieee80211_sub_if_data *sdata,
37873788
ncrc = crc32_be(0, (void *)&mgmt->u.beacon.beacon_int, 4);
37883789
ncrc = ieee802_11_parse_elems_crc(mgmt->u.beacon.variable,
37893790
len - baselen, false, &elems,
3790-
care_about_ies, ncrc);
3791+
care_about_ies, ncrc,
3792+
mgmt->bssid, bssid);
37913793

37923794
if (ieee80211_hw_check(&local->hw, PS_NULLFUNC_STACK) &&
37933795
ieee80211_check_tim(elems.tim, elems.tim_len, ifmgd->aid)) {
@@ -3871,7 +3873,7 @@ static void ieee80211_rx_mgmt_beacon(struct ieee80211_sub_if_data *sdata,
38713873
ifmgd->beacon_crc = ncrc;
38723874
ifmgd->beacon_crc_valid = true;
38733875

3874-
ieee80211_rx_bss_info(sdata, mgmt, len, rx_status, &elems);
3876+
ieee80211_rx_bss_info(sdata, mgmt, len, rx_status);
38753877

38763878
ieee80211_sta_process_chanswitch(sdata, rx_status->mactime,
38773879
rx_status->device_timestamp,
@@ -3992,9 +3994,10 @@ void ieee80211_sta_rx_queued_mgmt(struct ieee80211_sub_if_data *sdata,
39923994
if (ies_len < 0)
39933995
break;
39943996

3997+
/* CSA IE cannot be overridden, no need for BSSID */
39953998
ieee802_11_parse_elems(
39963999
mgmt->u.action.u.chan_switch.variable,
3997-
ies_len, true, &elems);
4000+
ies_len, true, &elems, mgmt->bssid, NULL);
39984001

39994002
if (elems.parse_error)
40004003
break;
@@ -4011,9 +4014,13 @@ void ieee80211_sta_rx_queued_mgmt(struct ieee80211_sub_if_data *sdata,
40114014
if (ies_len < 0)
40124015
break;
40134016

4017+
/*
4018+
* extended CSA IE can't be overridden, no need for
4019+
* BSSID
4020+
*/
40144021
ieee802_11_parse_elems(
40154022
mgmt->u.action.u.ext_chan_switch.variable,
4016-
ies_len, true, &elems);
4023+
ies_len, true, &elems, mgmt->bssid, NULL);
40174024

40184025
if (elems.parse_error)
40194026
break;

0 commit comments

Comments
 (0)