From patchwork Mon May 26 09:06:39 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rostislav Lisovy X-Patchwork-Id: 4240661 Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id F26C8BF90B for ; Mon, 26 May 2014 09:07:02 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1FA66201D3 for ; Mon, 26 May 2014 09:07:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 46C62201BA for ; Mon, 26 May 2014 09:07:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751628AbaEZJGq (ORCPT ); Mon, 26 May 2014 05:06:46 -0400 Received: from mail-we0-f173.google.com ([74.125.82.173]:39226 "EHLO mail-we0-f173.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751566AbaEZJGp (ORCPT ); Mon, 26 May 2014 05:06:45 -0400 Received: by mail-we0-f173.google.com with SMTP id u57so7729412wes.4 for ; Mon, 26 May 2014 02:06:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:subject:from:to:cc:date:in-reply-to:references :content-type:mime-version:content-transfer-encoding; bh=UWlKif17DfZraNrTSXnHCn89gmEeOfec5gmo75oGEZ4=; b=wkqzDDAQjAZMdBPsU2gNyNRELgAU+CsPdQkJnMmWotAKYgevy8LILXXxK+Ibe6LH9C 9hHnZakfL7gQPHmd+BBVu3EWTD4zi82hhewt4CsDc/0f8hRdwnapGEmKAXqxVDCUNrev eXvVhtF5iQfgP8HMcHNxYV6GPAwhtXNmsGDJuvQu91th8giuBArMncCR2KIqTNDTkDh5 0vNq1XfZPHn6Pz2z+ykMUA1ctBhfi/xuZwYYYtmztO12q377wOvElzZiNqqdPW45zdbf EtwhPazETl4DO1LuQfUvVRE1ZutzIzQrmub+knOmJor8O8oPmk6Wg2m+87b9JMAc9h/x higw== X-Received: by 10.194.82.9 with SMTP id e9mr27521798wjy.45.1401095203146; Mon, 26 May 2014 02:06:43 -0700 (PDT) Received: from ?IPv6:2001:718:2:1654:c570:18cc:6ee7:c246? ([2001:718:2:1654:c570:18cc:6ee7:c246]) by mx.google.com with ESMTPSA id na4sm25220046wic.21.2014.05.26.02.06.41 for (version=SSLv3 cipher=RC4-SHA bits=128/128); Mon, 26 May 2014 02:06:42 -0700 (PDT) Message-ID: <1401095199.11908.6.camel@umadbro> Subject: Re: [RFC 1/2] cfg80211: Add channel flags limiting availability to OCB mode only From: Rostislav Lisovy To: Johannes Berg Cc: "John W. Linville" , linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org, Michal Sojka , s.sander@nordsys.de, jan-niklas.meier@volkswagen.de, Rostislav Lisovy Date: Mon, 26 May 2014 11:06:39 +0200 In-Reply-To: <1400511063.4273.10.camel@jlt4.sipsolutions.net> References: <1400510945-24868-1-git-send-email-rostislav.lisovy@fel.cvut.cz> <1400510945-24868-2-git-send-email-rostislav.lisovy@fel.cvut.cz> (sfid-20140519_164914_781166_025BC930) <1400511063.4273.10.camel@jlt4.sipsolutions.net> X-Mailer: Evolution 3.6.2-0ubuntu0.1 Mime-Version: 1.0 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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;