2012-04-29 13:44:30

by Felix Fietkau

[permalink] [raw]
Subject: [PATCH 3.4] mac80211: fix AP mode EAP tx for VLAN stations

EAP frames for stations in an AP VLAN are sent on the main AP interface
to avoid race conditions wrt. moving stations.
For that to work properly, sta_info_get_bss must be used instead of
sta_info_get when sending EAP packets.
Previously this was only done for cooked monitor injected packets, so
this patch adds a check for tx->skb->protocol to the same place.

Signed-off-by: Felix Fietkau <[email protected]>
Cc: [email protected]
---
net/mac80211/tx.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
index 44001c7..d67d36f 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -1159,7 +1159,8 @@ ieee80211_tx_prepare(struct ieee80211_sub_if_data *sdata,
tx->sta = rcu_dereference(sdata->u.vlan.sta);
if (!tx->sta && sdata->dev->ieee80211_ptr->use_4addr)
return TX_DROP;
- } else if (info->flags & IEEE80211_TX_CTL_INJECTED) {
+ } else if (info->flags & IEEE80211_TX_CTL_INJECTED ||
+ tx->sdata->control_port_protocol == tx->skb->protocol) {
tx->sta = sta_info_get_bss(sdata, hdr->addr1);
}
if (!tx->sta)
--
1.7.3.2



2012-05-02 17:00:21

by Johannes Berg

[permalink] [raw]
Subject: Re: [PATCH 3.4] mac80211: fix AP mode EAP tx for VLAN stations

On Sun, 2012-04-29 at 15:44 +0200, Felix Fietkau wrote:
> EAP frames for stations in an AP VLAN are sent on the main AP interface
> to avoid race conditions wrt. moving stations.
> For that to work properly, sta_info_get_bss must be used instead of
> sta_info_get when sending EAP packets.
> Previously this was only done for cooked monitor injected packets, so
> this patch adds a check for tx->skb->protocol to the same place.
>
> Signed-off-by: Felix Fietkau <[email protected]>
> Cc: [email protected]
> ---
> net/mac80211/tx.c | 3 ++-
> 1 files changed, 2 insertions(+), 1 deletions(-)
>
> diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
> index 44001c7..d67d36f 100644
> --- a/net/mac80211/tx.c
> +++ b/net/mac80211/tx.c
> @@ -1159,7 +1159,8 @@ ieee80211_tx_prepare(struct ieee80211_sub_if_data *sdata,
> tx->sta = rcu_dereference(sdata->u.vlan.sta);
> if (!tx->sta && sdata->dev->ieee80211_ptr->use_4addr)
> return TX_DROP;
> - } else if (info->flags & IEEE80211_TX_CTL_INJECTED) {
> + } else if (info->flags & IEEE80211_TX_CTL_INJECTED ||
> + tx->sdata->control_port_protocol == tx->skb->protocol) {
> tx->sta = sta_info_get_bss(sdata, hdr->addr1);

Just the protocol check is probably sufficient, don't we set it for
injected frames anyway?

johannes