Move hostapd global callback functions into hapd_interfaces

These function pointers are going to be the same for each interface so
there is no need to keep them in struct hostapd_iface. Moving them to
struct hapd_interfaces makes it easier to add interfaces at run time.

Signed-hostap: Jouni Malinen <j@w1.fi>
This commit is contained in:
Jouni Malinen 2012-08-25 12:43:27 +03:00
parent 27b80b5b4c
commit 3776ac73b2
6 changed files with 53 additions and 39 deletions

View file

@ -113,9 +113,10 @@ int hostapd_reload_config(struct hostapd_iface *iface)
struct hostapd_config *newconf, *oldconf;
size_t j;
if (iface->config_read_cb == NULL)
if (iface->interfaces == NULL ||
iface->interfaces->config_read_cb == NULL)
return -1;
newconf = iface->config_read_cb(iface->config_fname);
newconf = iface->interfaces->config_read_cb(iface->config_fname);
if (newconf == NULL)
return -1;
@ -286,8 +287,9 @@ static void hostapd_free_hapd_data(struct hostapd_data *hapd)
*/
static void hostapd_cleanup(struct hostapd_data *hapd)
{
if (hapd->iface->ctrl_iface_deinit)
hapd->iface->ctrl_iface_deinit(hapd);
if (hapd->iface->interfaces &&
hapd->iface->interfaces->ctrl_iface_deinit)
hapd->iface->interfaces->ctrl_iface_deinit(hapd);
hostapd_free_hapd_data(hapd);
}
@ -770,8 +772,9 @@ static int hostapd_setup_bss(struct hostapd_data *hapd, int first)
}
#endif /* CONFIG_INTERWORKING */
if (hapd->iface->ctrl_iface_init &&
hapd->iface->ctrl_iface_init(hapd)) {
if (hapd->iface->interfaces &&
hapd->iface->interfaces->ctrl_iface_init &&
hapd->iface->interfaces->ctrl_iface_init(hapd)) {
wpa_printf(MSG_ERROR, "Failed to setup control interface");
return -1;
}