]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
dbus: Do not bring down primary interface when removing created AP interface
authorJintao Lin <jintaolin@chromium.org>
Tue, 6 Dec 2022 17:41:58 +0000 (17:41 +0000)
committerJouni Malinen <j@w1.fi>
Sun, 18 Dec 2022 09:04:18 +0000 (11:04 +0200)
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>
wpa_supplicant/ctrl_iface.c
wpa_supplicant/dbus/dbus_new_handlers.c
wpa_supplicant/wpa_supplicant_i.h

index d34d4a7778d5d5f3c69296433d648696b2e0c524..e0b6e11bb931bd96282433bb83038cfa7e62a917 100644 (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;
index 83f46a9ebc251cafef0fe4ea5d6d09d6e0e66568..67ce970d01bd6ae2d88f1dd7a41e5d114cc37d6d 100644 (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,
index 0c044129cf4f4dfa33bdbf113f72f3af3d8d4f5e..dfe6ffd93fc3ce98360a86396a21aa2e544db91f 100644 (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;