Fix WPA/RSN IE update on reconfig with set_generic_elem()
authorAndriy Tkachuk <andriy.v.tkachuk@globallogic.com>
Tue, 6 Apr 2010 17:44:26 +0000 (20:44 +0300)
committerJouni Malinen <j@w1.fi>
Tue, 6 Apr 2010 17:44:26 +0000 (20:44 +0300)
IF WPA/RSN parameters were changed or WPA/RSN was disabled, the
WPA/RSN IE in Beacon/Probe Response frames was only update with
set_beacon(). We need to do this with set_generic_elem(), too, to
work with all driver wrappers.

src/ap/hostapd.c

index 2c0c87d..bf60570 100644 (file)
@@ -80,13 +80,20 @@ int hostapd_reload_config(struct hostapd_iface *iface)
 
        if (hapd->conf->wpa && hapd->wpa_auth == NULL)
                hostapd_setup_wpa(hapd);
-       else if (hapd->conf->wpa)
+       else if (hapd->conf->wpa) {
+               const u8 *wpa_ie;
+               size_t wpa_ie_len;
                hostapd_reconfig_wpa(hapd);
-       else if (hapd->wpa_auth) {
+               wpa_ie = wpa_auth_get_wpa_ie(hapd->wpa_auth, &wpa_ie_len);
+               if (hostapd_set_generic_elem(hapd, wpa_ie, wpa_ie_len))
+                       wpa_printf(MSG_ERROR, "Failed to configure WPA IE for "
+                                  "the kernel driver.");
+       } else if (hapd->wpa_auth) {
                wpa_deinit(hapd->wpa_auth);
                hapd->wpa_auth = NULL;
                hostapd_set_privacy(hapd, 0);
                hostapd_setup_encryption(hapd->conf->iface, hapd);
+               hostapd_set_generic_elem(hapd, (u8 *) "", 0);
        }
 
        ieee802_11_set_beacon(hapd);