dbus: Do not bring down primary interface when removing created AP interface

If the CreateInterface command was used to create a virtual AP
interface, deleting this interface using the RemoveInterface command was
also bringing down the primary interface.

wpa_supplicant never uses hostapd style multi-BSS setup with
type=WPA_IF_AP_BSS and setup_ap=1 to if_add() when creating an AP
interface in wpa_driver_nl80211_if_add(), so it should not go through
the multi-BSS 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 for the D-Bus interface to
skip the multi-BSS cleanup procedure. This is inline with the control
interface design. Add comments before the code to avoid confusion.

Signed-off-by: Jintao Lin <jintaolin@chromium.org>
This commit is contained in:
Jintao Lin 2022-12-06 17:41:58 +00:00 committed by Jouni Malinen
parent 3b4a5e58b7
commit 4bd1efe073
3 changed files with 16 additions and 8 deletions

View file

@ -888,8 +888,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);
@ -897,9 +895,13 @@ 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,
ifname);
if (create_iface) {
/* wpa_supplicant does not create multi-BSS AP,
* so collapse to WPA_IF_STATION to avoid
* unwanted clean up in the driver. */
wpa_drv_if_remove(global->ifaces,
WPA_IF_STATION, ifname);
}
}
}
@ -958,7 +960,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 multi-BSS AP, so collapse to
* WPA_IF_STATION to avoid unwanted clean up in the driver. */
if (wpa_drv_if_remove(global->ifaces, WPA_IF_STATION,
wpa_s->ifname)) {
reply = wpas_dbus_error_unknown_error(
message,