hostapd: Do not terminate process on dynamic interface add failure
Limit the calls to eloop_terminate() to happen only for the initialization failure from the interfaces that we specified on the command line. This allows hostapd process to continue operating even if a dynamically added interface fails to start up. This allows the upper layer software to fix a configuration error and retry. Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
This commit is contained in:
parent
66f0bdb465
commit
2b6623ab13
3 changed files with 7 additions and 1 deletions
|
@ -693,6 +693,7 @@ int main(int argc, char *argv[])
|
||||||
* In such case, the interface will be enabled from eloop context within
|
* In such case, the interface will be enabled from eloop context within
|
||||||
* hostapd_global_run().
|
* hostapd_global_run().
|
||||||
*/
|
*/
|
||||||
|
interfaces.terminate_on_error = interfaces.count;
|
||||||
for (i = 0; i < interfaces.count; i++) {
|
for (i = 0; i < interfaces.count; i++) {
|
||||||
if (hostapd_driver_init(interfaces.iface[i]) ||
|
if (hostapd_driver_init(interfaces.iface[i]) ||
|
||||||
hostapd_setup_interface(interfaces.iface[i]))
|
hostapd_setup_interface(interfaces.iface[i]))
|
||||||
|
|
|
@ -1082,6 +1082,7 @@ int hostapd_setup_interface_complete(struct hostapd_iface *iface, int err)
|
||||||
if (err) {
|
if (err) {
|
||||||
wpa_printf(MSG_ERROR, "Interface initialization failed");
|
wpa_printf(MSG_ERROR, "Interface initialization failed");
|
||||||
hostapd_set_state(iface, HAPD_IFACE_DISABLED);
|
hostapd_set_state(iface, HAPD_IFACE_DISABLED);
|
||||||
|
if (iface->interfaces && iface->interfaces->terminate_on_error)
|
||||||
eloop_terminate();
|
eloop_terminate();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -1187,6 +1188,8 @@ int hostapd_setup_interface_complete(struct hostapd_iface *iface, int err)
|
||||||
|
|
||||||
wpa_printf(MSG_DEBUG, "%s: Setup of interface done.",
|
wpa_printf(MSG_DEBUG, "%s: Setup of interface done.",
|
||||||
iface->bss[0]->conf->iface);
|
iface->bss[0]->conf->iface);
|
||||||
|
if (iface->interfaces && iface->interfaces->terminate_on_error > 0)
|
||||||
|
iface->interfaces->terminate_on_error--;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,6 +45,8 @@ struct hapd_interfaces {
|
||||||
gid_t ctrl_iface_group;
|
gid_t ctrl_iface_group;
|
||||||
struct hostapd_iface **iface;
|
struct hostapd_iface **iface;
|
||||||
struct hostapd_dynamic_iface **dynamic_iface;
|
struct hostapd_dynamic_iface **dynamic_iface;
|
||||||
|
|
||||||
|
size_t terminate_on_error;
|
||||||
};
|
};
|
||||||
|
|
||||||
enum hostapd_chan_status {
|
enum hostapd_chan_status {
|
||||||
|
|
Loading…
Reference in a new issue