]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
hostapd: Fix PBC config method of WSC IE in Beacon/Probe Response
authorYoni Divinsky <yoni.divinsky@ti.com>
Mon, 25 Jun 2012 09:20:37 +0000 (12:20 +0300)
committerJouni Malinen <j@w1.fi>
Mon, 25 Jun 2012 09:20:37 +0000 (12:20 +0300)
In AP 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 not set.

Signed-hostap: Yoni Divinsky <yoni.divinsky@ti.com>

src/wps/wps_registrar.c

index e6ec04cf7c1cf56f44cc737589068d20b3f37e59..2c4b520947f59b65c91149045eec3974bd4502d2 100644 (file)
@@ -480,12 +480,16 @@ 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))) {
+       if ((*methods & WPS_CONFIG_VIRT_PUSHBUTTON) !=
+           WPS_CONFIG_VIRT_PUSHBUTTON &&
+           (*methods & WPS_CONFIG_PHY_PUSHBUTTON) !=
+           WPS_CONFIG_PHY_PUSHBUTTON) {
                /*
                 * Required to include virtual/physical flag, but we were not
                 * configured with push button type, so have to default to one