* [PATCH] mac80211: Disallow changing chan type on monitor when CHAN_MODE_FIXED
@ 2012-06-12 11:06 Pontus Fuchs
2012-06-12 11:08 ` Johannes Berg
0 siblings, 1 reply; 5+ messages in thread
From: Pontus Fuchs @ 2012-06-12 11:06 UTC (permalink / raw)
To: johannes, linville; +Cc: linux-wireless, Pontus Fuchs
If you add a monitor interface in paralell to a normal interface
mac80211 will let you to change the channel type on the monitor
interface even if you are connected. Add an explicit check to
disallow this.
Signed-off-by: Pontus Fuchs <pontus.fuchs@gmail.com>
---
net/mac80211/cfg.c | 12 +++++++-----
1 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index 498c94e..9f673bf 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -677,7 +677,8 @@ static int ieee80211_get_station(struct wiphy *wiphy, struct net_device *dev,
static int ieee80211_set_channel(struct wiphy *wiphy,
struct net_device *netdev,
struct ieee80211_channel *chan,
- enum nl80211_channel_type channel_type)
+ enum nl80211_channel_type channel_type,
+ bool is_monitor)
{
struct ieee80211_local *local = wiphy_priv(wiphy);
struct ieee80211_sub_if_data *sdata = NULL;
@@ -689,7 +690,8 @@ static int ieee80211_set_channel(struct wiphy *wiphy,
case CHAN_MODE_HOPPING:
return -EBUSY;
case CHAN_MODE_FIXED:
- if (local->oper_channel != chan)
+ if (local->oper_channel != chan ||
+ (is_monitor && local->_oper_channel_type != channel_type))
return -EBUSY;
if (!sdata && local->_oper_channel_type == channel_type)
return 0;
@@ -713,7 +715,7 @@ static int ieee80211_set_monitor_channel(struct wiphy *wiphy,
struct ieee80211_channel *chan,
enum nl80211_channel_type channel_type)
{
- return ieee80211_set_channel(wiphy, NULL, chan, channel_type);
+ return ieee80211_set_channel(wiphy, NULL, chan, channel_type, true);
}
static int ieee80211_set_probe_resp(struct ieee80211_sub_if_data *sdata,
@@ -831,7 +833,7 @@ static int ieee80211_start_ap(struct wiphy *wiphy, struct net_device *dev,
return -EALREADY;
err = ieee80211_set_channel(wiphy, dev, params->channel,
- params->channel_type);
+ params->channel_type, false);
if (err)
return err;
@@ -1607,7 +1609,7 @@ static int ieee80211_join_mesh(struct wiphy *wiphy, struct net_device *dev,
return err;
err = ieee80211_set_channel(wiphy, dev, setup->channel,
- setup->channel_type);
+ setup->channel_type, false);
if (err)
return err;
--
1.7.5.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] mac80211: Disallow changing chan type on monitor when CHAN_MODE_FIXED
2012-06-12 11:06 [PATCH] mac80211: Disallow changing chan type on monitor when CHAN_MODE_FIXED Pontus Fuchs
@ 2012-06-12 11:08 ` Johannes Berg
2012-06-12 11:20 ` Pontus Fuchs
0 siblings, 1 reply; 5+ messages in thread
From: Johannes Berg @ 2012-06-12 11:08 UTC (permalink / raw)
To: Pontus Fuchs; +Cc: linville, linux-wireless
On Tue, 2012-06-12 at 13:06 +0200, Pontus Fuchs wrote:
> If you add a monitor interface in paralell to a normal interface
> mac80211 will let you to change the channel type on the monitor
> interface even if you are connected. Add an explicit check to
> disallow this.
Is this against 3.5, and is it really needed there? It's a corner case
to start with.
johannes
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] mac80211: Disallow changing chan type on monitor when CHAN_MODE_FIXED
2012-06-12 11:08 ` Johannes Berg
@ 2012-06-12 11:20 ` Pontus Fuchs
2012-06-12 11:33 ` Johannes Berg
0 siblings, 1 reply; 5+ messages in thread
From: Pontus Fuchs @ 2012-06-12 11:20 UTC (permalink / raw)
To: Johannes Berg; +Cc: linville, linux-wireless
On 2012-06-12 13:08, Johannes Berg wrote:
> If you add a monitor interface in paralell to a normal interface
> mac80211 will let you to change the channel type on the monitor
> interface even if you are connected. Add an explicit check to
> disallow this.
> Is this against 3.5, and is it really needed there? It's a corner case
> to start with.
It's against wireless-next. It's a real corner case indeed. With the
wireshark toolbar I create monitors on demand for all phy's so I
see it quite often myself. If it needs fixing is up to you to decide :)
Cheers,
Pontus
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] mac80211: Disallow changing chan type on monitor when CHAN_MODE_FIXED
2012-06-12 11:20 ` Pontus Fuchs
@ 2012-06-12 11:33 ` Johannes Berg
2012-06-12 12:15 ` Pontus Fuchs
0 siblings, 1 reply; 5+ messages in thread
From: Johannes Berg @ 2012-06-12 11:33 UTC (permalink / raw)
To: Pontus Fuchs; +Cc: linville, linux-wireless
On Tue, 2012-06-12 at 13:20 +0200, Pontus Fuchs wrote:
> On 2012-06-12 13:08, Johannes Berg wrote:
> > If you add a monitor interface in paralell to a normal interface
> > mac80211 will let you to change the channel type on the monitor
> > interface even if you are connected. Add an explicit check to
> > disallow this.
> > Is this against 3.5, and is it really needed there? It's a corner case
> > to start with.
> It's against wireless-next.
Right, sorry, I was looking at the wrong code :(
> It's a real corner case indeed. With the
> wireshark toolbar I create monitors on demand for all phy's so I
> see it quite often myself. If it needs fixing is up to you to decide :)
Yeah, like we discussed, maybe it should or should not be allowed? With
the new changes Michal is doing it'll probably be disallowed anyway?
I'll apply it, but can you rediff and remove the "is_monitor" argument,
since dev == NULL is equivalent? :)
johannes
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] mac80211: Disallow changing chan type on monitor when CHAN_MODE_FIXED
2012-06-12 11:33 ` Johannes Berg
@ 2012-06-12 12:15 ` Pontus Fuchs
0 siblings, 0 replies; 5+ messages in thread
From: Pontus Fuchs @ 2012-06-12 12:15 UTC (permalink / raw)
To: Johannes Berg; +Cc: linville, linux-wireless
On 2012-06-12 13:33, Johannes Berg wrote:
> Yeah, like we discussed, maybe it should or should not be allowed? With
> the new changes Michal is doing it'll probably be disallowed anyway?
>
> I'll apply it, but can you rediff and remove the "is_monitor" argument,
> since dev == NULL is equivalent? :)
Thanks, that's a lot smarter. I was confused by the old code. V2 sent.
Cheers,
Pontus
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2012-06-12 12:15 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-06-12 11:06 [PATCH] mac80211: Disallow changing chan type on monitor when CHAN_MODE_FIXED Pontus Fuchs
2012-06-12 11:08 ` Johannes Berg
2012-06-12 11:20 ` Pontus Fuchs
2012-06-12 11:33 ` Johannes Berg
2012-06-12 12:15 ` Pontus Fuchs
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).