diff mbox

[RFC,1/2] cfg80211: Add channel flags limiting availability to OCB mode only

Message ID 1401095199.11908.6.camel@umadbro (mailing list archive)
State Not Applicable, archived
Headers show

Commit Message

Rostislav Lisovy May 26, 2014, 9:06 a.m. UTC
On Mon, 2014-05-19 at 16:51 +0200, Johannes Berg wrote:
> This patch is fine, but insufficient - you should also do something
> with
> the new flags?

That's definitely a good point. I think the biggest issue is that the
flags can't be checked only with the knowledge of the 'wiphy' but they
are related to the 'vif' type -- this prohibits checking in the
cfg80211_chandef_usable() (I assume).

Would the following be sufficient?


--
Best regards;
Rostislav Lisovy


--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Johannes Berg May 26, 2014, 9:35 a.m. UTC | #1
On Mon, 2014-05-26 at 11:06 +0200, Rostislav Lisovy wrote:
> On Mon, 2014-05-19 at 16:51 +0200, Johannes Berg wrote:
> > This patch is fine, but insufficient - you should also do something
> > with
> > the new flags?
> 
> That's definitely a good point. I think the biggest issue is that the
> flags can't be checked only with the knowledge of the 'wiphy' but they
> are related to the 'vif' type -- this prohibits checking in the
> cfg80211_chandef_usable() (I assume).
> 
> Would the following be sufficient?

Well, you'll find that if you address my comments on the other patch,
all of this discussion goes away easily.

johannes

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

--- a/net/mac80211/chan.c
+++ b/net/mac80211/chan.c
@@ -801,6 +801,10 @@  static int __ieee80211_vif_change_channel(struct ieee80211_sub_if_data *sdata,
 		*changed |= BSS_CHANGED_BANDWIDTH;
 	}
 
+	if (sdata->vif.type == NL80211_IFTYPE_OCB &&
+	    !(chandef->chan->flags & IEEE80211_CHAN_OCB_ONLY))
+		return -EINVAL;
+
 	sdata->vif.bss_conf.chandef = *chandef;
 	ctx->conf.def = *chandef;
 
@@ -1049,6 +1053,12 @@  int ieee80211_vif_change_bandwidth(struct ieee80211_sub_if_data *sdata,
 		goto out;
 	}
 
+	if (sdata->vif.type == NL80211_IFTYPE_OCB &&
+	    !(chandef->chan->flags & IEEE80211_CHAN_OCB_ONLY)) {
+		ret = -EINVAL;
+		goto out;
+	}
+
 	if (chandef->width == NL80211_CHAN_WIDTH_20_NOHT ||
 	    sdata->vif.bss_conf.chandef.width == NL80211_CHAN_WIDTH_20_NOHT) {
 		ret = -EINVAL;