mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2026-04-29 12:28:27 +02:00
wifi: mac80211: Allow beacons to update BSS table regardless of scan
When a beacon is received use it to update the BSS table regardless of the scanning state. Do so only when there are active non-monitor interfaces. Also, while at it, in any case accept beacons only with broadcast address. Reviewed-by: Miriam Rachel Korenblit <miriam.rachel.korenblit@intel.com> Signed-off-by: Ilan Peer <ilan.peer@intel.com> Link: https://msgid.link/20240228094742.e508605f495b.I3ab24ab3543319e31165111b28bcdcc622b5cf02@changeid Signed-off-by: Johannes Berg <johannes.berg@intel.com>
This commit is contained in:
+15
-7
@@ -257,7 +257,6 @@ static bool ieee80211_scan_accept_presp(struct ieee80211_sub_if_data *sdata,
|
|||||||
void ieee80211_scan_rx(struct ieee80211_local *local, struct sk_buff *skb)
|
void ieee80211_scan_rx(struct ieee80211_local *local, struct sk_buff *skb)
|
||||||
{
|
{
|
||||||
struct ieee80211_rx_status *rx_status = IEEE80211_SKB_RXCB(skb);
|
struct ieee80211_rx_status *rx_status = IEEE80211_SKB_RXCB(skb);
|
||||||
struct ieee80211_sub_if_data *sdata1, *sdata2;
|
|
||||||
struct ieee80211_mgmt *mgmt = (void *)skb->data;
|
struct ieee80211_mgmt *mgmt = (void *)skb->data;
|
||||||
struct ieee80211_bss *bss;
|
struct ieee80211_bss *bss;
|
||||||
struct ieee80211_channel *channel;
|
struct ieee80211_channel *channel;
|
||||||
@@ -281,12 +280,6 @@ void ieee80211_scan_rx(struct ieee80211_local *local, struct sk_buff *skb)
|
|||||||
if (skb->len < min_hdr_len)
|
if (skb->len < min_hdr_len)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
sdata1 = rcu_dereference(local->scan_sdata);
|
|
||||||
sdata2 = rcu_dereference(local->sched_scan_sdata);
|
|
||||||
|
|
||||||
if (likely(!sdata1 && !sdata2))
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (test_and_clear_bit(SCAN_BEACON_WAIT, &local->scanning)) {
|
if (test_and_clear_bit(SCAN_BEACON_WAIT, &local->scanning)) {
|
||||||
/*
|
/*
|
||||||
* we were passive scanning because of radar/no-IR, but
|
* we were passive scanning because of radar/no-IR, but
|
||||||
@@ -304,10 +297,17 @@ void ieee80211_scan_rx(struct ieee80211_local *local, struct sk_buff *skb)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if (ieee80211_is_probe_resp(mgmt->frame_control)) {
|
if (ieee80211_is_probe_resp(mgmt->frame_control)) {
|
||||||
|
struct ieee80211_sub_if_data *sdata1, *sdata2;
|
||||||
struct cfg80211_scan_request *scan_req;
|
struct cfg80211_scan_request *scan_req;
|
||||||
struct cfg80211_sched_scan_request *sched_scan_req;
|
struct cfg80211_sched_scan_request *sched_scan_req;
|
||||||
u32 scan_req_flags = 0, sched_scan_req_flags = 0;
|
u32 scan_req_flags = 0, sched_scan_req_flags = 0;
|
||||||
|
|
||||||
|
sdata1 = rcu_dereference(local->scan_sdata);
|
||||||
|
sdata2 = rcu_dereference(local->sched_scan_sdata);
|
||||||
|
|
||||||
|
if (likely(!sdata1 && !sdata2))
|
||||||
|
return;
|
||||||
|
|
||||||
scan_req = rcu_dereference(local->scan_req);
|
scan_req = rcu_dereference(local->scan_req);
|
||||||
sched_scan_req = rcu_dereference(local->sched_scan_req);
|
sched_scan_req = rcu_dereference(local->sched_scan_req);
|
||||||
|
|
||||||
@@ -327,8 +327,16 @@ void ieee80211_scan_rx(struct ieee80211_local *local, struct sk_buff *skb)
|
|||||||
sched_scan_req_flags,
|
sched_scan_req_flags,
|
||||||
mgmt->da))
|
mgmt->da))
|
||||||
return;
|
return;
|
||||||
|
} else {
|
||||||
|
/* Beacons are expected only with broadcast address */
|
||||||
|
if (!is_broadcast_ether_addr(mgmt->da))
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Do not update the BSS table in case of only monitor interfaces */
|
||||||
|
if (local->open_count == local->monitors)
|
||||||
|
return;
|
||||||
|
|
||||||
bss = ieee80211_bss_info_update(local, rx_status,
|
bss = ieee80211_bss_info_update(local, rx_status,
|
||||||
mgmt, skb->len,
|
mgmt, skb->len,
|
||||||
channel);
|
channel);
|
||||||
|
|||||||
Reference in New Issue
Block a user