Skip to content

Commit

Permalink
net: mac80211: force backwards compatible basic rates
Browse files Browse the repository at this point in the history
Force backwards-compatible basic-rates on the mesh interface.
This is required to maintain backwards-compatible with older
Gluon releases.

Signed-off-by: David Bauer <[email protected]>
  • Loading branch information
blocktrron committed Jan 9, 2025
1 parent 791e39f commit 9de2626
Show file tree
Hide file tree
Showing 2 changed files with 67 additions and 17 deletions.
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
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: force backwards compatible basic rates

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.
Force backwards-compatible basic-rates on the mesh interface.
This is required to maintain backwards-compatible with older
Gluon releases.

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..202797407c9aa5eaf76c0acb63c1bb9a33aeba2e
--- /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
+Subject: [PATCH] net: mac80211: always pretend 1 Mbit/s as mesh basic rate
+Subject: [PATCH] net: mac80211: force backwards compatible basic rates
+
+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.
+Force backwards-compatible basic-rates on the mesh interface.
+This is required to maintain backwards-compatible with older
+Gluon releases.
+
+Signed-off-by: David Bauer <[email protected]>
+---
Expand All @@ -30,31 +30,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) | BIT(6) | BIT(8);
++ } 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) | BIT(6) | BIT(8); /* mandatory rate */
++ }
++
+ if (ieee80211_put_srates_elem(skb, sband, basic_rates,
+ rate_flags, 0,
+ WLAN_EID_SUPP_RATES) ||
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,34 @@ VIF without wpa_supplicant.

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
index 202797407c9aa5eaf76c0acb63c1bb9a33aeba2e..ef5988dcca1c368935ab41789a1beeecabb62bc7 100644
--- 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
@@ -26,9 +26,9 @@ Signed-off-by: David Bauer <[email protected]>
}
rcu_read_unlock();

-+ if (sband->band == IEEE80211_BAND_2GHZ) {
++ if (sband->band == NL80211_BAND_2GHZ) {
+ br_bitfield = BIT(0);
-+ } else if (sband->band == IEEE80211_BAND_5GHZ) {
++ } else if (sband->band == NL80211_BAND_5GHZ) {
+ br_bitfield = BIT(4) | BIT(6) | BIT(8);
+ } else {
+ br_bitfield = sdata->vif.bss_conf.basic_rates;
@@ -55,9 +55,9 @@ Signed-off-by: David Bauer <[email protected]>
ieee80211_chandef_rate_flags(&sdata->vif.bss_conf.chanreq.oper);
basic_rates = sdata->vif.bss_conf.basic_rates;

-+ if (sband->band == IEEE80211_BAND_2GHZ) {
++ if (sband->band == NL80211_BAND_2GHZ) {
+ basic_rates = BIT(0); /* mandatory rate */
-+ } else if (sband->band == IEEE80211_BAND_5GHZ) {
++ } else if (sband->band == NL80211_BAND_5GHZ) {
+ basic_rates = BIT(4) | BIT(6) | BIT(8); /* mandatory rate */
+ }
+
diff --git a/package/network/config/wifi-scripts/files/lib/netifd/wireless/mac80211.sh b/package/network/config/wifi-scripts/files/lib/netifd/wireless/mac80211.sh
index 368885246a73b14153ffe3c7d83627f873111742..5b5a7fabda896c978b685b89163a36bae33fcdb6 100755
--- a/package/network/config/wifi-scripts/files/lib/netifd/wireless/mac80211.sh
Expand Down

0 comments on commit 9de2626

Please sign in to comment.