| From 3266d6c2cc19929c310361f00c4823c09a3ae8b4 Mon Sep 17 00:00:00 2001 |
| From: Michael-CY Lee <michael-cy.lee@mediatek.com> |
| Date: Mon, 6 May 2024 15:06:55 +0800 |
| Subject: [PATCH 64/89] mtk: mac80211: prevent STA MLD's link addr from being |
| randaomized |
| |
| STA MLD's link address should be fixed, otherwise it sends AUTH request |
| via different link address every time and causes connection issues. |
| |
| STA MLD's link address is determined by MLD address and link_id. |
| |
| Signed-off-by: Michael-CY Lee <michael-cy.lee@mediatek.com> |
| --- |
| net/mac80211/mlme.c | 16 ++++++++++------ |
| 1 file changed, 10 insertions(+), 6 deletions(-) |
| |
| diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c |
| index 4d6dfd6..1b19583 100644 |
| --- a/net/mac80211/mlme.c |
| +++ b/net/mac80211/mlme.c |
| @@ -8163,11 +8163,13 @@ void ieee80211_mgd_setup_link(struct ieee80211_link_data *link) |
| |
| ieee80211_clear_tpe(&link->conf->tpe); |
| |
| - if (sdata->u.mgd.assoc_data) |
| + if (sdata->u.mgd.assoc_data) { |
| ether_addr_copy(link->conf->addr, |
| sdata->u.mgd.assoc_data->link[link_id].addr); |
| - else if (!is_valid_ether_addr(link->conf->addr)) |
| - eth_random_addr(link->conf->addr); |
| + } else if (!is_valid_ether_addr(link->conf->addr)) { |
| + ether_addr_copy(link->conf->addr, sdata->vif.addr); |
| + link->conf->addr[4] += link_id + 1; |
| + } |
| } |
| |
| /* scan finished notification */ |
| @@ -8932,11 +8934,13 @@ int ieee80211_mgd_assoc(struct ieee80211_sub_if_data *sdata, |
| } |
| |
| link = sdata_dereference(sdata->link[i], sdata); |
| - if (link) |
| + if (link) { |
| ether_addr_copy(assoc_data->link[i].addr, |
| link->conf->addr); |
| - else |
| - eth_random_addr(assoc_data->link[i].addr); |
| + } else { |
| + ether_addr_copy(assoc_data->link[i].addr, sdata->vif.addr); |
| + assoc_data->link[i].addr[4] += i + 1; |
| + } |
| sband = local->hw.wiphy->bands[link_cbss->channel->band]; |
| |
| if (match_auth && i == assoc_link_id && link) |
| -- |
| 2.18.0 |
| |