Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4abb52a4 authored by Sara Sharon's avatar Sara Sharon Committed by Johannes Berg
Browse files

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: default avatarSara Sharon <sara.sharon@intel.com>
Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
parent 9f308616
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -8,6 +8,7 @@
 * Copyright 2009, Johannes Berg <johannes@sipsolutions.net>
 * Copyright 2013-2014  Intel Mobile Communications GmbH
 * Copyright(c) 2016 Intel Deutschland GmbH
 * Copyright(c) 2018-2019 Intel Corporation
 *
 * This program is free software; you can redistribute it and/or modify
 * 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,

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

	bss = ieee80211_bss_info_update(local, rx_status, mgmt, len, elems,
					channel);
	bss = ieee80211_bss_info_update(local, rx_status, mgmt, len, channel);
	if (!bss)
		return;

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

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

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

			ieee802_11_parse_elems(
				mgmt->u.action.u.chan_switch.variable,
				ies_len, true, &elems);
				ies_len, true, &elems, mgmt->bssid, NULL);

			if (elems.parse_error)
				break;
+8 −5
Original line number Diff line number Diff line
@@ -4,7 +4,7 @@
 * Copyright 2006-2007	Jiri Benc <jbenc@suse.cz>
 * Copyright 2007-2010	Johannes Berg <johannes@sipsolutions.net>
 * Copyright 2013-2015  Intel Mobile Communications GmbH
 * Copyright (C) 2018 Intel Corporation
 * Copyright (C) 2018-2019 Intel Corporation
 *
 * This program is free software; you can redistribute it and/or modify
 * 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,
			  struct ieee80211_rx_status *rx_status,
			  struct ieee80211_mgmt *mgmt,
			  size_t len,
			  struct ieee802_11_elems *elems,
			  struct ieee80211_channel *channel);
void ieee80211_rx_bss_put(struct ieee80211_local *local,
			  struct ieee80211_bss *bss);
@@ -1956,12 +1955,16 @@ static inline void ieee80211_tx_skb(struct ieee80211_sub_if_data *sdata,

u32 ieee802_11_parse_elems_crc(const u8 *start, size_t len, bool action,
			       struct ieee802_11_elems *elems,
			       u64 filter, u32 crc);
			       u64 filter, u32 crc, u8 *transmitter_bssid,
			       u8 *bss_bssid);
static inline void ieee802_11_parse_elems(const u8 *start, size_t len,
					  bool action,
					  struct ieee802_11_elems *elems)
					  struct ieee802_11_elems *elems,
					  u8 *transmitter_bssid,
					  u8 *bss_bssid)
{
	ieee802_11_parse_elems_crc(start, len, action, elems, 0, 0);
	ieee802_11_parse_elems_crc(start, len, action, elems, 0, 0,
				   transmitter_bssid, bss_bssid);
}


+6 −4
Original line number Diff line number Diff line
/*
 * Copyright (c) 2008, 2009 open80211s Ltd.
 * Copyright (C) 2018 Intel Corporation
 * Copyright (C) 2018 - 2019 Intel Corporation
 * Authors:    Luis Carlos Cobo <luisca@cozybit.com>
 * 	       Javier Cardona <javier@cozybit.com>
 *
@@ -1106,7 +1106,8 @@ ieee80211_mesh_rx_probe_req(struct ieee80211_sub_if_data *sdata,
	if (baselen > len)
		return;

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

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

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

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

	ifmsh->chsw_ttl = elems.mesh_chansw_params_ie->mesh_ttl;
	if (!--ifmsh->chsw_ttl)
+2 −1
Original line number Diff line number Diff line
/*
 * Copyright (c) 2008, 2009 open80211s Ltd.
 * Copyright (C) 2019 Intel Corporation
 * Author:     Luis Carlos Cobo <luisca@cozybit.com>
 *
 * 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,

	baselen = (u8 *) mgmt->u.action.u.mesh_action.variable - (u8 *) mgmt;
	ieee802_11_parse_elems(mgmt->u.action.u.mesh_action.variable,
			       len - baselen, false, &elems);
			       len - baselen, false, &elems, mgmt->bssid, NULL);

	if (elems.preq) {
		if (elems.preq_len != 37)
+3 −1
Original line number Diff line number Diff line
/*
 * Copyright (c) 2008, 2009 open80211s Ltd.
 * Copyright (C) 2019 Intel Corporation
 * Author:     Luis Carlos Cobo <luisca@cozybit.com>
 *
 * 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,
		if (baselen > len)
			return;
	}
	ieee802_11_parse_elems(baseaddr, len - baselen, true, &elems);
	ieee802_11_parse_elems(baseaddr, len - baselen, true, &elems,
			       mgmt->bssid, NULL);
	mesh_process_plink_frame(sdata, mgmt, &elems, rx_status);
}
Loading