[PATCH 3/4] hostapd: Reset hapd->interface_add properly

Michal Kazior michal.kazior
Wed May 28 02:57:11 PDT 2014


The variable is updated when calling hostapd_if_add() so it makes sense
to do the same thing when calling hostapd_if_remove().

Signed-off-by: Michal Kazior <michal.kazior at tieto.com>
---
 src/ap/hostapd.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/src/ap/hostapd.c b/src/ap/hostapd.c
index f5657d6..d6f937c 100644
--- a/src/ap/hostapd.c
+++ b/src/ap/hostapd.c
@@ -277,10 +277,13 @@ static void hostapd_free_hapd_data(struct hostapd_data *hapd)
 
 	authsrv_deinit(hapd);
 
-	if (hapd->interface_added &&
-	    hostapd_if_remove(hapd, WPA_IF_AP_BSS, hapd->conf->iface)) {
-		wpa_printf(MSG_WARNING, "Failed to remove BSS interface %s",
-			   hapd->conf->iface);
+	if (hapd->interface_added) {
+		hapd->interface_added = 0;
+		if (hostapd_if_remove(hapd, WPA_IF_AP_BSS, hapd->conf->iface)) {
+			wpa_printf(MSG_WARNING, "Failed to remove BSS interface %s",
+				   hapd->conf->iface);
+			hapd->interface_added = 1;
+		}
 	}
 
 	os_free(hapd->probereq_cb);
-- 
1.8.5.3




More information about the Hostap mailing list