| 1 | --- a/src/ap/hostapd.c |
| 2 | +++ b/src/ap/hostapd.c |
| 3 | @@ -42,37 +42,8 @@ static int hostapd_setup_encryption(char |
| 4 | |
| 5 | extern int wpa_debug_level; |
| 6 | |
| 7 | - |
| 8 | -int hostapd_reload_config(struct hostapd_iface *iface) |
| 9 | +static int hostapd_reload_bss(struct hostapd_data *hapd) |
| 10 | { |
| 11 | - struct hostapd_data *hapd = iface->bss[0]; |
| 12 | - struct hostapd_config *newconf, *oldconf; |
| 13 | - size_t j; |
| 14 | - |
| 15 | - if (iface->config_read_cb == NULL) |
| 16 | - return -1; |
| 17 | - newconf = iface->config_read_cb(iface->config_fname); |
| 18 | - if (newconf == NULL) |
| 19 | - return -1; |
| 20 | - |
| 21 | - /* |
| 22 | - * Deauthenticate all stations since the new configuration may not |
| 23 | - * allow them to use the BSS anymore. |
| 24 | - */ |
| 25 | - for (j = 0; j < iface->num_bss; j++) |
| 26 | - hostapd_flush_old_stations(iface->bss[j]); |
| 27 | - |
| 28 | -#ifndef CONFIG_NO_RADIUS |
| 29 | - /* TODO: update dynamic data based on changed configuration |
| 30 | - * items (e.g., open/close sockets, etc.) */ |
| 31 | - radius_client_flush(hapd->radius, 0); |
| 32 | -#endif /* CONFIG_NO_RADIUS */ |
| 33 | - |
| 34 | - oldconf = hapd->iconf; |
| 35 | - hapd->iconf = newconf; |
| 36 | - hapd->conf = &newconf->bss[0]; |
| 37 | - iface->conf = newconf; |
| 38 | - |
| 39 | if (hostapd_setup_wpa_psk(hapd->conf)) { |
| 40 | wpa_printf(MSG_ERROR, "Failed to re-configure WPA PSK " |
| 41 | "after reloading configuration"); |
| 42 | @@ -110,10 +81,46 @@ int hostapd_reload_config(struct hostapd |
| 43 | wpa_printf(MSG_ERROR, "Could not set SSID for kernel driver"); |
| 44 | /* try to continue */ |
| 45 | } |
| 46 | + wpa_printf(MSG_DEBUG, "Reconfigured interface %s", hapd->conf->iface); |
| 47 | +} |
| 48 | + |
| 49 | +int hostapd_reload_config(struct hostapd_iface *iface) |
| 50 | +{ |
| 51 | + struct hostapd_data *hapd = iface->bss[0]; |
| 52 | + struct hostapd_config *newconf, *oldconf; |
| 53 | + size_t j; |
| 54 | + |
| 55 | + if (iface->config_read_cb == NULL) |
| 56 | + return -1; |
| 57 | + newconf = iface->config_read_cb(iface->config_fname); |
| 58 | + if (newconf == NULL) |
| 59 | + return -1; |
| 60 | + |
| 61 | + /* |
| 62 | + * Deauthenticate all stations since the new configuration may not |
| 63 | + * allow them to use the BSS anymore. |
| 64 | + */ |
| 65 | + for (j = 0; j < iface->num_bss; j++) |
| 66 | + hostapd_flush_old_stations(iface->bss[j]); |
| 67 | + |
| 68 | +#ifndef CONFIG_NO_RADIUS |
| 69 | + /* TODO: update dynamic data based on changed configuration |
| 70 | + * items (e.g., open/close sockets, etc.) */ |
| 71 | + radius_client_flush(hapd->radius, 0); |
| 72 | +#endif /* CONFIG_NO_RADIUS */ |
| 73 | + |
| 74 | + oldconf = hapd->iconf; |
| 75 | + iface->conf = newconf; |
| 76 | + |
| 77 | + for (j = 0; j < iface->num_bss; j++) { |
| 78 | + hapd = iface->bss[j]; |
| 79 | + hapd->iconf = newconf; |
| 80 | + hapd->conf = &newconf->bss[j]; |
| 81 | + hostapd_reload_bss(hapd); |
| 82 | + } |
| 83 | |
| 84 | hostapd_config_free(oldconf); |
| 85 | |
| 86 | - wpa_printf(MSG_DEBUG, "Reconfigured interface %s", hapd->conf->iface); |
| 87 | |
| 88 | return 0; |
| 89 | } |
| 90 | |