diff mbox

nl80211: Expand max value of NL80211_MESHCONF_HT_OPMODE command

Message ID 1468927556-4703-1-git-send-email-masashi.honma@gmail.com (mailing list archive)
State Superseded
Delegated to: Johannes Berg
Headers show

Commit Message

Masashi Honma July 19, 2016, 11:25 a.m. UTC
Previously, the max value of NL80211_MESHCONF_HT_OPMODE was 16.
But it causes EINVAL when IEEE80211_HT_OP_MODE_PROTECTION_NONHT_MIXED
and IEEE80211_HT_OP_MODE_NON_HT_STA_PRSNT bit is enabled.
So this patch expands the max value.

Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
---
 net/wireless/nl80211.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Comments

Johannes Berg Aug. 2, 2016, 7:43 a.m. UTC | #1
On Tue, 2016-07-19 at 20:25 +0900, Masashi Honma wrote:
> Previously, the max value of NL80211_MESHCONF_HT_OPMODE was 16.
> But it causes EINVAL when IEEE80211_HT_OP_MODE_PROTECTION_NONHT_MIXED
> and IEEE80211_HT_OP_MODE_NON_HT_STA_PRSNT bit is enabled.
> So this patch expands the max value.
> 
> Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
> ---
>  net/wireless/nl80211.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
> index 46417f9..8a00e50 100644
> --- a/net/wireless/nl80211.c
> +++ b/net/wireless/nl80211.c
> @@ -5471,7 +5471,10 @@ do {						
> 			    \
>  	FILL_IN_MESH_PARAM_IF_SET(tb, cfg, rssi_threshold, -255, 0,
>  				  mask,
> NL80211_MESHCONF_RSSI_THRESHOLD,
>  				  nl80211_check_s32);
> -	FILL_IN_MESH_PARAM_IF_SET(tb, cfg, ht_opmode, 0, 16,
> +	FILL_IN_MESH_PARAM_IF_SET(tb, cfg, ht_opmode, 0,
> +				  IEEE80211_HT_OP_MODE_PROTECTION |
> +				  IEEE80211_HT_OP_MODE_NON_GF_STA_PRSNT |
> +				  IEEE80211_HT_OP_MODE_NON_HT_STA_PRSNT,
>  				  mask, NL80211_MESHCONF_HT_OPMODE,
>  				  nl80211_check_u16);
> 
Hmm. So first of all, it looks like the old value was wrong because 16
would have been an allowed value, which doesn't make sense - 15 was
likely the maximum that should've been allowed?

You're now changing it to 23, which makes some sense, but is kinda
strange. It allows setting the unused bit 0x8 by itself or in
combination with any protection and/or the NON_GF bit, but not in
combination with the NON_HT bit.

It seems that perhaps this should rather check the value against a
bitmap of allowed bits, which would be exactly the ones you add in this
patch?

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
Masashi Honma Aug. 2, 2016, 11:40 a.m. UTC | #2
On 2016年08月02日 16:43, Johannes Berg wrote:
> You're now changing it to 23, which makes some sense, but is kinda
> strange. It allows setting the unused bit 0x8 by itself or in
> combination with any protection and/or the NON_GF bit, but not in
> combination with the NON_HT bit.

Thanks. This is reasonable. I will implement bitwise checks.

Masashi Honma.
--
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

diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index 46417f9..8a00e50 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -5471,7 +5471,10 @@  do {									    \
 	FILL_IN_MESH_PARAM_IF_SET(tb, cfg, rssi_threshold, -255, 0,
 				  mask, NL80211_MESHCONF_RSSI_THRESHOLD,
 				  nl80211_check_s32);
-	FILL_IN_MESH_PARAM_IF_SET(tb, cfg, ht_opmode, 0, 16,
+	FILL_IN_MESH_PARAM_IF_SET(tb, cfg, ht_opmode, 0,
+				  IEEE80211_HT_OP_MODE_PROTECTION |
+				  IEEE80211_HT_OP_MODE_NON_GF_STA_PRSNT |
+				  IEEE80211_HT_OP_MODE_NON_HT_STA_PRSNT,
 				  mask, NL80211_MESHCONF_HT_OPMODE,
 				  nl80211_check_u16);
 	FILL_IN_MESH_PARAM_IF_SET(tb, cfg, dot11MeshHWMPactivePathToRootTimeout,