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

From: Rostislav Lisovy
Date: Mon May 26 2014 - 05:06:51 EST


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?

--- 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;

--
Best regards;
Rostislav Lisovy


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/