diff mbox series

Hostapd does not update WPS credentials on SIGHUP

Message ID fdadce6eddc483bb5f4cd1a6a343e046@oktetlabs.ru
State Changes Requested
Headers show
Series Hostapd does not update WPS credentials on SIGHUP | expand

Commit Message

Dmitry Koroban Aug. 20, 2020, 10:46 a.m. UTC
Faced this issue on v2.6, but 2.10 seems to have it too.
Steps to reproduce:
1. Start hostapd with WPS enabled
2. Change passphrase in hostapd.conf
3. Send SIGHUP to hostapd
4. Try to connect client using wps_pbc
5. Client receives old passphrase and cannot connect


Signed-off-by: Dmitry Koroban <dkoroban at oktetlabs.ru>

hapd->conf->iface);
  }

Comments

Jouni Malinen Oct. 11, 2020, 5:14 p.m. UTC | #1
On Thu, Aug 20, 2020 at 01:46:57PM +0300, Dmitry Koroban wrote:
> Faced this issue on v2.6, but 2.10 seems to have it too.
> Steps to reproduce:
> 1. Start hostapd with WPS enabled
> 2. Change passphrase in hostapd.conf
> 3. Send SIGHUP to hostapd
> 4. Try to connect client using wps_pbc
> 5. Client receives old passphrase and cannot connect

> diff --git a/src/ap/hostapd.c b/src/ap/hostapd.c
> @@ -163,6 +163,9 @@ static void hostapd_reload_bss(struct hostapd_data
> *hapd)
>                 wpa_printf(MSG_ERROR, "Could not set SSID for kernel
> driver");
>                 /* try to continue */
>         }
> +       /* Update WPS credentials */
> +       hostapd_deinit_wps(hapd);
> +       hostapd_init_wps(hapd, hapd->conf);
>         wpa_printf(MSG_DEBUG, "Reconfigured interface %s",
> hapd->conf->iface);

There is a call to hostapd_update_wps() just before this context and
that function is the place to update whatever needs to be updated for
WPS. It would be cleaner to do this type of restarting of WPS there in
case WPS was started before reconfiguration instead of hardcoding
deinit/init to happen after that update function is executed.
Andrej Shadura Feb. 12, 2021, 9:53 a.m. UTC | #2
Hi,

On Sun, 11 Oct 2020, at 19:14, Jouni Malinen wrote:
> On Thu, Aug 20, 2020 at 01:46:57PM +0300, Dmitry Koroban wrote:
> > Faced this issue on v2.6, but 2.10 seems to have it too.
> > Steps to reproduce:
> > 1. Start hostapd with WPS enabled
> > 2. Change passphrase in hostapd.conf
> > 3. Send SIGHUP to hostapd
> > 4. Try to connect client using wps_pbc
> > 5. Client receives old passphrase and cannot connect
 
> There is a call to hostapd_update_wps() just before this context and
> that function is the place to update whatever needs to be updated for
> WPS. It would be cleaner to do this type of restarting of WPS there in
> case WPS was started before reconfiguration instead of hardcoding
> deinit/init to happen after that update function is executed.

Has there been any follow-up on this, maybe an alternative implementation? I don’t see anything on the mailing list, but maybe I’m looking in a wrong place?
Raphaël Mélotte Feb. 12, 2021, 10:33 a.m. UTC | #3
On 2/12/21 10:53 AM, Andrej Shadura wrote:
> Hi,
> 
> On Sun, 11 Oct 2020, at 19:14, Jouni Malinen wrote:
>> On Thu, Aug 20, 2020 at 01:46:57PM +0300, Dmitry Koroban wrote:
>>> Faced this issue on v2.6, but 2.10 seems to have it too.
>>> Steps to reproduce:
>>> 1. Start hostapd with WPS enabled
>>> 2. Change passphrase in hostapd.conf
>>> 3. Send SIGHUP to hostapd
>>> 4. Try to connect client using wps_pbc
>>> 5. Client receives old passphrase and cannot connect
>   
>> There is a call to hostapd_update_wps() just before this context and
>> that function is the place to update whatever needs to be updated for
>> WPS. It would be cleaner to do this type of restarting of WPS there in
>> case WPS was started before reconfiguration instead of hardcoding
>> deinit/init to happen after that update function is executed.
> 
> Has there been any follow-up on this, maybe an alternative implementation? I don’t see anything on the mailing list, but maybe I’m looking in a wrong place?
> 

Hi,

This should be fixed on master starting from 
'f95ccc102a6e55bb2543ba68164d6a007a188b25'.

The related patches on the mailing list are:
https://lists.infradead.org/pipermail/hostap/2021-February/039299.html
https://lists.infradead.org/pipermail/hostap/2020-December/039205.html

Kind regards,

Raphaël
diff mbox series

Patch

diff --git a/src/ap/hostapd.c b/src/ap/hostapd.c
index b37f49f9a..9c78785c6 100644
--- a/src/ap/hostapd.c
+++ b/src/ap/hostapd.c
@@ -163,6 +163,9 @@  static void hostapd_reload_bss(struct hostapd_data 
*hapd)
                 wpa_printf(MSG_ERROR, "Could not set SSID for kernel 
driver");
                 /* try to continue */
         }
+       /* Update WPS credentials */
+       hostapd_deinit_wps(hapd);
+       hostapd_init_wps(hapd, hapd->conf);
         wpa_printf(MSG_DEBUG, "Reconfigured interface %s",