diff --git a/src/ap/hostapd.c b/src/ap/hostapd.c index a04307cb8..9306f50e5 100644 --- a/src/ap/hostapd.c +++ b/src/ap/hostapd.c @@ -300,11 +300,13 @@ static void hostapd_free_hapd_data(struct hostapd_data *hapd) */ static void hostapd_cleanup(struct hostapd_data *hapd) { - wpa_printf(MSG_DEBUG, "%s(%s)", __func__, hapd->conf->iface); + wpa_printf(MSG_DEBUG, "%s(hapd=%p (%s))", __func__, hapd, + hapd->conf->iface); if (hapd->iface->interfaces && hapd->iface->interfaces->ctrl_iface_deinit) hapd->iface->interfaces->ctrl_iface_deinit(hapd); hostapd_free_hapd_data(hapd); + hapd->started = 0; } @@ -621,6 +623,16 @@ static int hostapd_setup_bss(struct hostapd_data *hapd, int first) char force_ifname[IFNAMSIZ]; u8 if_addr[ETH_ALEN]; + wpa_printf(MSG_DEBUG, "%s(hapd=%p (%s), first=%d)", + __func__, hapd, hapd->conf->iface, first); + + if (hapd->started) { + wpa_printf(MSG_ERROR, "%s: Interface %s was already started", + __func__, hapd->conf->iface); + return -1; + } + hapd->started = 1; + if (!first || first == -1) { if (hostapd_mac_comp_empty(hapd->conf->bssid) == 0) { /* Allocate the next available BSSID. */ diff --git a/src/ap/hostapd.h b/src/ap/hostapd.h index e39a1fdb9..1887531f9 100644 --- a/src/ap/hostapd.h +++ b/src/ap/hostapd.h @@ -102,6 +102,7 @@ struct hostapd_data { struct hostapd_config *iconf; struct hostapd_bss_config *conf; int interface_added; /* virtual interface added for this BSS */ + unsigned int started:1; u8 own_addr[ETH_ALEN];