Skip to content

Commit

Permalink
mac80211: set basic-rate to lowest of band
Browse files Browse the repository at this point in the history
To keep compatibility, mesh settigns have to match the previous default.

In order to do so, set the mesh basic-rate to the lowest rate of the
frequency band.

Signed-off-by: David Bauer <[email protected]>
  • Loading branch information
blocktrron committed Jan 9, 2025
1 parent 791e39f commit b8966b0
Showing 1 changed file with 36 additions and 13 deletions.
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
From: David Bauer <[email protected]>
Date: Tue, 7 Jan 2025 00:49:41 +0100
Subject: net: mac80211: always pretend 1 Mbit/s as mesh basic rate
Subject: net: mac80211: always pretend lowest rate as mesh basic rate

In order to be backwards-compatible, pretend to have 1 Mbit/s 802.11b as
basic rate regardless of the actual setting. This is required to keep
compatibility with other non-patched mesh neighbors.
In order to be backwards-compatible, pretend to have the lowest
basic-rate of the band as basic rate regardless of the actual
setting. This is required to keep compatibility with other
non-patched mesh neighbors.

Signed-off-by: David Bauer <[email protected]>

diff --git a/package/kernel/mac80211/patches/subsys/996-net-mac80211-always-pretend-1-Mbit-s-as-mesh-basic-r.patch b/package/kernel/mac80211/patches/subsys/996-net-mac80211-always-pretend-1-Mbit-s-as-mesh-basic-r.patch
new file mode 100644
index 0000000000000000000000000000000000000000..becb17317abb9782d4827a38c232b58939246ae1
index 0000000000000000000000000000000000000000..730709ecb002e3696c0ec53dd5b8cfa48fe7a881
--- /dev/null
+++ b/package/kernel/mac80211/patches/subsys/996-net-mac80211-always-pretend-1-Mbit-s-as-mesh-basic-r.patch
@@ -0,0 +1,44 @@
@@ -0,0 +1,66 @@
+From 70c1812fa170ee35cdc576c886bed4bfaae1d23c Mon Sep 17 00:00:00 2001
+From: David Bauer <[email protected]>
+Date: Tue, 7 Jan 2025 00:47:33 +0100
Expand All @@ -30,31 +31,53 @@ index 0000000000000000000000000000000000000000..becb17317abb9782d4827a38c232b589
+
+--- a/net/mac80211/mesh.c
++++ b/net/mac80211/mesh.c
+@@ -1093,7 +1093,7 @@ ieee80211_mesh_build_beacon(struct ieee8
+@@ -954,6 +954,7 @@ ieee80211_mesh_build_beacon(struct ieee8
+ struct ieee80211_sub_if_data *sdata;
+ int hdr_len = offsetofend(struct ieee80211_mgmt, u.beacon);
+ u32 rate_flags;
++ u32 br_bitfield;
+
+ sdata = container_of(ifmsh, struct ieee80211_sub_if_data, u.mesh);
+
+@@ -1086,8 +1087,16 @@ ieee80211_mesh_build_beacon(struct ieee8
+ }
+ rcu_read_unlock();
+
++ if (sband->band == IEEE80211_BAND_2GHZ) {
++ br_bitfield = BIT(0);
++ } else if (sband->band == IEEE80211_BAND_5GHZ) {
++ br_bitfield = BIT(4);
++ } else {
++ br_bitfield = sdata->vif.bss_conf.basic_rates;
++ }
++
+ if (ieee80211_put_srates_elem(skb, sband,
+- sdata->vif.bss_conf.basic_rates,
++ BIT(0),
++ br_bitfield,
+ rate_flags, 0, WLAN_EID_SUPP_RATES) ||
+ mesh_add_ds_params_ie(sdata, skb))
+ goto out_free;
+@@ -1106,7 +1106,7 @@ ieee80211_mesh_build_beacon(struct ieee8
+@@ -1100,7 +1109,7 @@ ieee80211_mesh_build_beacon(struct ieee8
+ bcn->tail = bcn->head + bcn->head_len;
+
+ if (ieee80211_put_srates_elem(skb, sband,
+- sdata->vif.bss_conf.basic_rates,
++ BIT(0),
++ br_bitfield,
+ rate_flags, 0, WLAN_EID_EXT_SUPP_RATES) ||
+ mesh_add_rsn_ie(sdata, skb) ||
+ mesh_add_ht_cap_ie(sdata, skb) ||
+--- a/net/mac80211/mesh_plink.c
++++ b/net/mac80211/mesh_plink.c
+@@ -283,6 +283,7 @@ static int mesh_plink_frame_tx(struct ie
+ rate_flags =
+@@ -284,6 +284,12 @@ static int mesh_plink_frame_tx(struct ie
+ ieee80211_chandef_rate_flags(&sdata->vif.bss_conf.chanreq.oper);
+ basic_rates = sdata->vif.bss_conf.basic_rates;
++ basic_rates = BIT(0); /* mandatory rate */
+
++ if (sband->band == IEEE80211_BAND_2GHZ) {
++ basic_rates = BIT(0); /* mandatory rate */
++ } else if (sband->band == IEEE80211_BAND_5GHZ) {
++ basic_rates = BIT(4); /* mandatory rate */
++ }
++
+ if (ieee80211_put_srates_elem(skb, sband, basic_rates,
+ rate_flags, 0,
+ WLAN_EID_SUPP_RATES) ||

0 comments on commit b8966b0

Please sign in to comment.