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

Commit 3432f923 authored by Eliad Peller's avatar Eliad Peller Committed by John W. Linville
Browse files

mac80211: use min rate as basic rate for buggy APs



Some buggy APs (and even P2P_GO) don't advertise their
basic rates in the association response.

In such case, use the min supported rate as the
basic rate.

Reported-by: default avatarPontus Fuchs <pontus.fuchs@gmail.com>
Signed-off-by: default avatarEliad Peller <eliad@wizery.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent ae8e4672
Loading
Loading
Loading
Loading
+19 −0
Original line number Original line Diff line number Diff line
@@ -1485,6 +1485,7 @@ static bool ieee80211_assoc_success(struct ieee80211_work *wk,
	int i, j, err;
	int i, j, err;
	bool have_higher_than_11mbit = false;
	bool have_higher_than_11mbit = false;
	u16 ap_ht_cap_flags;
	u16 ap_ht_cap_flags;
	int min_rate = INT_MAX, min_rate_index = -1;


	/* AssocResp and ReassocResp have identical structure */
	/* AssocResp and ReassocResp have identical structure */


@@ -1551,6 +1552,10 @@ static bool ieee80211_assoc_success(struct ieee80211_work *wk,
				rates |= BIT(j);
				rates |= BIT(j);
				if (is_basic)
				if (is_basic)
					basic_rates |= BIT(j);
					basic_rates |= BIT(j);
				if (rate < min_rate) {
					min_rate = rate;
					min_rate_index = j;
				}
				break;
				break;
			}
			}
		}
		}
@@ -1568,11 +1573,25 @@ static bool ieee80211_assoc_success(struct ieee80211_work *wk,
				rates |= BIT(j);
				rates |= BIT(j);
				if (is_basic)
				if (is_basic)
					basic_rates |= BIT(j);
					basic_rates |= BIT(j);
				if (rate < min_rate) {
					min_rate = rate;
					min_rate_index = j;
				}
				break;
				break;
			}
			}
		}
		}
	}
	}


	/*
	 * some buggy APs don't advertise basic_rates. use the lowest
	 * supported rate instead.
	 */
	if (unlikely(!basic_rates) && min_rate_index >= 0) {
		printk(KERN_DEBUG "%s: No basic rates in AssocResp. "
		       "Using min supported rate instead.\n", sdata->name);
		basic_rates = BIT(min_rate_index);
	}

	sta->sta.supp_rates[wk->chan->band] = rates;
	sta->sta.supp_rates[wk->chan->band] = rates;
	sdata->vif.bss_conf.basic_rates = basic_rates;
	sdata->vif.bss_conf.basic_rates = basic_rates;