Skip to content

Commit a5d3cbd

Browse files
nbd168jmberg-intel
authored andcommitted
mac80211: fix enabling 4-address mode on a sta vif after assoc
Notify the driver about the 4-address mode change and also send a nulldata packet to the AP to notify it about the change Fixes: 1ff4e8f ("mac80211: notify the driver when a sta uses 4-address mode") Signed-off-by: Felix Fietkau <nbd@nbd.name> Link: https://lore.kernel.org/r/20210702050111.47546-1-nbd@nbd.name Signed-off-by: Johannes Berg <johannes.berg@intel.com>
1 parent 1a79155 commit a5d3cbd

File tree

3 files changed

+23
-2
lines changed

3 files changed

+23
-2
lines changed

net/mac80211/cfg.c

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,8 @@ static int ieee80211_change_iface(struct wiphy *wiphy,
152152
struct vif_params *params)
153153
{
154154
struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
155+
struct ieee80211_local *local = sdata->local;
156+
struct sta_info *sta;
155157
int ret;
156158

157159
ret = ieee80211_if_change_type(sdata, type);
@@ -162,7 +164,24 @@ static int ieee80211_change_iface(struct wiphy *wiphy,
162164
RCU_INIT_POINTER(sdata->u.vlan.sta, NULL);
163165
ieee80211_check_fast_rx_iface(sdata);
164166
} else if (type == NL80211_IFTYPE_STATION && params->use_4addr >= 0) {
167+
struct ieee80211_if_managed *ifmgd = &sdata->u.mgd;
168+
169+
if (params->use_4addr == ifmgd->use_4addr)
170+
return 0;
171+
165172
sdata->u.mgd.use_4addr = params->use_4addr;
173+
if (!ifmgd->associated)
174+
return 0;
175+
176+
mutex_lock(&local->sta_mtx);
177+
sta = sta_info_get(sdata, ifmgd->bssid);
178+
if (sta)
179+
drv_sta_set_4addr(local, sdata, &sta->sta,
180+
params->use_4addr);
181+
mutex_unlock(&local->sta_mtx);
182+
183+
if (params->use_4addr)
184+
ieee80211_send_4addr_nullfunc(local, sdata);
166185
}
167186

168187
if (sdata->vif.type == NL80211_IFTYPE_MONITOR) {

net/mac80211/ieee80211_i.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2201,6 +2201,8 @@ void ieee80211_dynamic_ps_timer(struct timer_list *t);
22012201
void ieee80211_send_nullfunc(struct ieee80211_local *local,
22022202
struct ieee80211_sub_if_data *sdata,
22032203
bool powersave);
2204+
void ieee80211_send_4addr_nullfunc(struct ieee80211_local *local,
2205+
struct ieee80211_sub_if_data *sdata);
22042206
void ieee80211_sta_tx_notify(struct ieee80211_sub_if_data *sdata,
22052207
struct ieee80211_hdr *hdr, bool ack, u16 tx_time);
22062208

net/mac80211/mlme.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1095,8 +1095,8 @@ void ieee80211_send_nullfunc(struct ieee80211_local *local,
10951095
ieee80211_tx_skb(sdata, skb);
10961096
}
10971097

1098-
static void ieee80211_send_4addr_nullfunc(struct ieee80211_local *local,
1099-
struct ieee80211_sub_if_data *sdata)
1098+
void ieee80211_send_4addr_nullfunc(struct ieee80211_local *local,
1099+
struct ieee80211_sub_if_data *sdata)
11001100
{
11011101
struct sk_buff *skb;
11021102
struct ieee80211_hdr *nullfunc;

0 commit comments

Comments
 (0)