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

@ -13070,8 +13070,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 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, iface.ifname);
}
return -1;
}
@ -13093,6 +13096,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 multi-BSS AP, so collapse to
* WPA_IF_STATION to avoid unwanted clean up in the driver. */
ret = wpa_drv_if_remove(global->ifaces, WPA_IF_STATION, cmd);
}
return ret;

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,

View file

@ -926,7 +926,6 @@ struct wpa_supplicant {
unsigned int connection_he:1;
unsigned int connection_eht: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;