2014-05-30 09:44:52

by Janusz Dziedzic

[permalink] [raw]
Subject: [PATCH] mac80211: allow tx via monitor iface when DFS

Allow send frames using monitor interface
when DFS chandef and we pass CAC (beaconing
allowed).

This fix problem when old kernel and new backports used,
in such case hostapd create/use also monitor interface.
Before this patch all frames hostapd send using monitor
were dropped when AP was configured on DFS channel.

Signed-off-by: Janusz Dziedzic <[email protected]>
---
net/mac80211/tx.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
index 5214686..a32ca9b 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -1618,12 +1618,12 @@ netdev_tx_t ieee80211_monitor_start_xmit(struct sk_buff *skb,
{
struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
struct ieee80211_chanctx_conf *chanctx_conf;
- struct ieee80211_channel *chan;
struct ieee80211_radiotap_header *prthdr =
(struct ieee80211_radiotap_header *)skb->data;
struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
struct ieee80211_hdr *hdr;
struct ieee80211_sub_if_data *tmp_sdata, *sdata;
+ struct cfg80211_chan_def chandef;
u16 len_rthdr;
int hdrlen;

@@ -1721,9 +1721,9 @@ netdev_tx_t ieee80211_monitor_start_xmit(struct sk_buff *skb,
}

if (chanctx_conf)
- chan = chanctx_conf->def.chan;
+ chandef = chanctx_conf->def;
else if (!local->use_chanctx)
- chan = local->_oper_chandef.chan;
+ chandef = local->_oper_chandef;
else
goto fail_rcu;

@@ -1743,10 +1743,11 @@ netdev_tx_t ieee80211_monitor_start_xmit(struct sk_buff *skb,
* radar detection by itself. We can do that later by adding a
* monitor flag interfaces used for AP support.
*/
- if ((chan->flags & (IEEE80211_CHAN_NO_IR | IEEE80211_CHAN_RADAR)))
+ if (!cfg80211_reg_can_beacon(local->hw.wiphy, &chandef,
+ sdata->vif.type))
goto fail_rcu;

- ieee80211_xmit(sdata, skb, chan->band);
+ ieee80211_xmit(sdata, skb, chandef.chan->band);
rcu_read_unlock();

return NETDEV_TX_OK;
--
1.7.9.5



2014-06-03 19:59:11

by Johannes Berg

[permalink] [raw]
Subject: Re: [PATCH] mac80211: allow tx via monitor iface when DFS

On Fri, 2014-05-30 at 11:44 +0200, Janusz Dziedzic wrote:

> + struct cfg80211_chan_def chandef;
> u16 len_rthdr;
> int hdrlen;
>
> @@ -1721,9 +1721,9 @@ netdev_tx_t ieee80211_monitor_start_xmit(struct sk_buff *skb,
> }
>
> if (chanctx_conf)
> - chan = chanctx_conf->def.chan;
> + chandef = chanctx_conf->def;
> else if (!local->use_chanctx)
> - chan = local->_oper_chandef.chan;
> + chandef = local->_oper_chandef;

Why are you making a copy of the chandef - wouldn't a pointer work just
as well?

johannes


2014-06-04 05:13:27

by Janusz Dziedzic

[permalink] [raw]
Subject: Re: [PATCH] mac80211: allow tx via monitor iface when DFS

On 3 June 2014 21:58, Johannes Berg <[email protected]> wrote:
> On Fri, 2014-05-30 at 11:44 +0200, Janusz Dziedzic wrote:
>
>> + struct cfg80211_chan_def chandef;
>> u16 len_rthdr;
>> int hdrlen;
>>
>> @@ -1721,9 +1721,9 @@ netdev_tx_t ieee80211_monitor_start_xmit(struct sk_buff *skb,
>> }
>>
>> if (chanctx_conf)
>> - chan = chanctx_conf->def.chan;
>> + chandef = chanctx_conf->def;
>> else if (!local->use_chanctx)
>> - chan = local->_oper_chandef.chan;
>> + chandef = local->_oper_chandef;
>
> Why are you making a copy of the chandef - wouldn't a pointer work just
> as well?
>
No special reason (chandef is quite small), should I change this to
pointer and send v2?

BR
Janusz

2014-06-04 07:03:35

by Johannes Berg

[permalink] [raw]
Subject: Re: [PATCH] mac80211: allow tx via monitor iface when DFS

On Wed, 2014-06-04 at 07:13 +0200, Janusz Dziedzic wrote:
> On 3 June 2014 21:58, Johannes Berg <[email protected]> wrote:
> > On Fri, 2014-05-30 at 11:44 +0200, Janusz Dziedzic wrote:
> >
> >> + struct cfg80211_chan_def chandef;
> >> u16 len_rthdr;
> >> int hdrlen;
> >>
> >> @@ -1721,9 +1721,9 @@ netdev_tx_t ieee80211_monitor_start_xmit(struct sk_buff *skb,
> >> }
> >>
> >> if (chanctx_conf)
> >> - chan = chanctx_conf->def.chan;
> >> + chandef = chanctx_conf->def;
> >> else if (!local->use_chanctx)
> >> - chan = local->_oper_chandef.chan;
> >> + chandef = local->_oper_chandef;
> >
> > Why are you making a copy of the chandef - wouldn't a pointer work just
> > as well?
> >
> No special reason (chandef is quite small), should I change this to
> pointer and send v2?

Yeah, I agree that it's pretty small, it just seemed odd, like you
wanted to locally modify it or something. I'd prefer a pointer here.

johannes