]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
D-Bus: Capture group ifname before switching to global P2P instance
authorHassoubi, Hicham <Hicham_Hassoubi@bose.com>
Fri, 3 Dec 2021 20:10:07 +0000 (20:10 +0000)
committerJouni Malinen <j@w1.fi>
Sat, 11 Dec 2021 11:17:47 +0000 (13:17 +0200)
The P2P DBus interface was using the wrong interface name when calling
wpas_p2p_invite_group(). Capture the group interface name before calling
the method to fix this.

Signed-off-by: Hicham Hassoubi <Hicham_hassoubi@bose.com>
wpa_supplicant/dbus/dbus_new_handlers_p2p.c

index 565ced0fd7e257c6a584c763603f4f6f2f95cc7e..de79178f465533c6d28479d97548b5d90ceffc5f 100644 (file)
@@ -744,6 +744,7 @@ DBusMessage * wpas_dbus_handler_p2p_invite(DBusMessage *message,
        unsigned int group_id = 0;
        int persistent = 0;
        struct wpa_ssid *ssid;
+       const char *group_ifname;
 
        if (!wpa_dbus_p2p_check_enabled(wpa_s, message, &reply, NULL))
                return reply;
@@ -777,6 +778,8 @@ DBusMessage * wpas_dbus_handler_p2p_invite(DBusMessage *message,
            !p2p_peer_known(wpa_s->global->p2p, peer_addr))
                goto err;
 
+       /* Capture the interface name for the group first */
+       group_ifname = wpa_s->ifname;
        wpa_s = wpa_s->global->p2p_init_wpa_s;
 
        if (persistent) {
@@ -821,7 +824,7 @@ DBusMessage * wpas_dbus_handler_p2p_invite(DBusMessage *message,
                /*
                 * No group ID means propose to a peer to join my active group
                 */
-               if (wpas_p2p_invite_group(wpa_s, wpa_s->ifname,
+               if (wpas_p2p_invite_group(wpa_s, group_ifname,
                                          peer_addr, NULL, false)) {
                        reply = wpas_dbus_error_unknown_error(
                                message, "Failed to join to an active group");