[PATCH] dbus: Do not bring down the primary interface when remove the wpa_supplicant created virtual AP interface

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



If use dbus command CreateInterface to create a virtual AP interface,
deleting this interface using dbus command RemoveInterface will also
bring down the primary interface.

wpa_supplicant never uses MBSSID when creating AP interface in
wpa_driver_nl80211_if_add, so it should not go through the MBSSID
tear down procedure in wpa_driver_nl80211_if_remove. The virtual AP
resources init and deinit are well handled in wpa_driver_nl80211_init
and wpa_driver_nl80211_deinit.

Collapse the interface type to WPA_IF_STATION to skip the MBSSID
cleanup procedure. This is inline with ctrl_iface. Add comments before
the code to avoid confusion.

Signed-off-by: Jintao Lin <jintaolin@xxxxxxxxxxxx>
---
 wpa_supplicant/ctrl_iface.c             |  7 ++++++-
 wpa_supplicant/dbus/dbus_new_handlers.c | 13 ++++++++-----
 wpa_supplicant/wpa_supplicant_i.h       |  1 -
 3 files changed, 14 insertions(+), 7 deletions(-)

diff --git a/wpa_supplicant/ctrl_iface.c b/wpa_supplicant/ctrl_iface.c
index 6e878be96..fd548cecb 100644
--- a/wpa_supplicant/ctrl_iface.c
+++ b/wpa_supplicant/ctrl_iface.c
@@ -11906,8 +11906,11 @@ static int wpa_supplicant_global_iface_add(struct wpa_global *global,
 	return 0;
 
 fail:
-	if (create_iface)
+	if (create_iface) {
+		// wpa_supplicant does not create MBSSID AP,
+		// collapse to WPA_IF_STATION to avoid MBSSID clean up in driver.
 		wpa_drv_if_remove(global->ifaces, WPA_IF_STATION, iface.ifname);
+	}
 	return -1;
 }
 
@@ -11929,6 +11932,8 @@ static int wpa_supplicant_global_iface_remove(struct wpa_global *global,
 	if (!ret && delete_iface) {
 		wpa_printf(MSG_DEBUG, "CTRL_IFACE deleting the interface '%s'",
 			   cmd);
+		// wpa_supplicant does not create MBSSID AP,
+		// collapse to WPA_IF_STATION to avoid MBSSID clean up in driver.
 		ret = wpa_drv_if_remove(global->ifaces, WPA_IF_STATION, cmd);
 	}
 	return ret;
diff --git a/wpa_supplicant/dbus/dbus_new_handlers.c b/wpa_supplicant/dbus/dbus_new_handlers.c
index 7afd4006b..6e940b633 100644
--- a/wpa_supplicant/dbus/dbus_new_handlers.c
+++ b/wpa_supplicant/dbus/dbus_new_handlers.c
@@ -856,8 +856,6 @@ DBusMessage * wpas_dbus_handler_create_interface(DBusMessage *message,
 			const char *path = wpa_s->dbus_new_path;
 
 			wpa_s->added_vif = create_iface;
-			wpa_s->added_vif_type = create_iface? if_type :
-				WPA_IF_MAX;
 			reply = dbus_message_new_method_return(message);
 			dbus_message_append_args(reply, DBUS_TYPE_OBJECT_PATH,
 						 &path, DBUS_TYPE_INVALID);
@@ -865,9 +863,12 @@ DBusMessage * wpas_dbus_handler_create_interface(DBusMessage *message,
 			reply = wpas_dbus_error_unknown_error(
 				message,
 				"wpa_supplicant couldn't grab this interface.");
-			if (create_iface)
-				wpa_drv_if_remove(global->ifaces, if_type,
+			if (create_iface) {
+				// wpa_supplicant does not create MBSSID AP, collapse to
+				// WPA_IF_STATION to avoid MBSSID clean up in driver.
+				wpa_drv_if_remove(global->ifaces, WPA_IF_STATION,
 						  ifname);
+			}
 		}
 	}
 
@@ -925,7 +926,9 @@ DBusMessage * wpas_dbus_handler_remove_interface(DBusMessage *message,
 	if (delete_iface) {
 		wpa_printf(MSG_DEBUG, "%s[dbus]: deleting the interface '%s'",
 			   __func__, wpa_s->ifname);
-		if (wpa_drv_if_remove(global->ifaces, wpa_s->added_vif_type,
+		// wpa_supplicant does not create MBSSID AP,
+		// collapse to WPA_IF_STATION to avoid MBSSID clean up in driver.
+		if (wpa_drv_if_remove(global->ifaces, WPA_IF_STATION,
 				      wpa_s->ifname)) {
 			reply = wpas_dbus_error_unknown_error(
 			message,
diff --git a/wpa_supplicant/wpa_supplicant_i.h b/wpa_supplicant/wpa_supplicant_i.h
index ce7132145..d7c2c56bb 100644
--- a/wpa_supplicant/wpa_supplicant_i.h
+++ b/wpa_supplicant/wpa_supplicant_i.h
@@ -857,7 +857,6 @@ struct wpa_supplicant {
 	unsigned int connection_vht:1;
 	unsigned int connection_he:1;
 	unsigned int disable_mbo_oce:1;
-	enum wpa_driver_if_type added_vif_type;
 
 	struct os_reltime last_mac_addr_change;
 	int last_mac_addr_style;
-- 
2.39.0.rc0.267.gcb52ba06e7-goog


_______________________________________________
Hostap mailing list
Hostap@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/hostap



[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux