Patchwork hostapd: fix pbc config method of WSC IE in beacon

login
register
mail settings
Submitter Yoni Divinsky
Date June 25, 2012, 6:32 a.m.
Message ID <1340605924-12832-1-git-send-email-yoni.divinsky@ti.com>
Download mbox | patch
Permalink /patch/166942/
State Accepted
Commit 9148ae58d04ac9baed3d56a70ce594492dab3769
Headers show

Comments

Yoni Divinsky - June 25, 2012, 6:32 a.m.
In softAP which supports WPSv2 with only virtual push
button, when PBC is called, the WSC IE should include
selected Registrar Configuration Methods attribute
with the bit of the physical push button no set.

Signed-hostap: Yoni Divinsky <yoni.divinsky@ti.com>
---
 src/wps/wps_registrar.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
Jouni Malinen - June 25, 2012, 9:24 a.m.
On Mon, Jun 25, 2012 at 09:32:04AM +0300, Yoni Divinsky wrote:
> In softAP which supports WPSv2 with only virtual push
> button, when PBC is called, the WSC IE should include
> selected Registrar Configuration Methods attribute
> with the bit of the physical push button no set.

Thanks, applied with a similar changes in the following condition:

> diff --git a/src/wps/wps_registrar.c b/src/wps/wps_registrar.c
> @@ -480,9 +480,11 @@ static void wps_set_pushbutton(u16 *methods, u16 conf_methods)
>  {
>  	*methods |= WPS_CONFIG_PUSHBUTTON;
>  #ifdef CONFIG_WPS2
> -	if (conf_methods & WPS_CONFIG_VIRT_PUSHBUTTON)
> +	if ((conf_methods & WPS_CONFIG_VIRT_PUSHBUTTON) ==
> +	    WPS_CONFIG_VIRT_PUSHBUTTON)
>  		*methods |= WPS_CONFIG_VIRT_PUSHBUTTON;
> -	if (conf_methods & WPS_CONFIG_PHY_PUSHBUTTON)
> +	if ((conf_methods & WPS_CONFIG_PHY_PUSHBUTTON) ==
> +	    WPS_CONFIG_PHY_PUSHBUTTON)
>  		*methods |= WPS_CONFIG_PHY_PUSHBUTTON;
>  	if (!(*methods & (WPS_CONFIG_VIRT_PUSHBUTTON |
>  			  WPS_CONFIG_PHY_PUSHBUTTON))) {

That last if statement is used to enforce WSC 2.0 compliant value and
while it may not really hit in practice due to other workaround
implementation in configuration, it would be good to keep this
consistent with the first two if statements. As such, I changed it to
follow the same style to check the multi-bit defines.

Patch

diff --git a/src/wps/wps_registrar.c b/src/wps/wps_registrar.c
index e6ec04c..3b53ce8 100644
--- a/src/wps/wps_registrar.c
+++ b/src/wps/wps_registrar.c
@@ -480,9 +480,11 @@  static void wps_set_pushbutton(u16 *methods, u16 conf_methods)
 {
 	*methods |= WPS_CONFIG_PUSHBUTTON;
 #ifdef CONFIG_WPS2
-	if (conf_methods & WPS_CONFIG_VIRT_PUSHBUTTON)
+	if ((conf_methods & WPS_CONFIG_VIRT_PUSHBUTTON) ==
+	    WPS_CONFIG_VIRT_PUSHBUTTON)
 		*methods |= WPS_CONFIG_VIRT_PUSHBUTTON;
-	if (conf_methods & WPS_CONFIG_PHY_PUSHBUTTON)
+	if ((conf_methods & WPS_CONFIG_PHY_PUSHBUTTON) ==
+	    WPS_CONFIG_PHY_PUSHBUTTON)
 		*methods |= WPS_CONFIG_PHY_PUSHBUTTON;
 	if (!(*methods & (WPS_CONFIG_VIRT_PUSHBUTTON |
 			  WPS_CONFIG_PHY_PUSHBUTTON))) {