]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
P2P: Allow GO BSSID to be specified for P2P_GROUP_ADD commands
authorJouni Malinen <quic_jouni@quicinc.com>
Wed, 22 Feb 2023 12:11:17 +0000 (14:11 +0200)
committerJouni Malinen <j@w1.fi>
Wed, 22 Feb 2023 12:11:17 +0000 (14:11 +0200)
This allows the control interface to be used similarly to the way D-Bus
interface was extended to force a specific GO BSSID for optimizing
scanning.

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
wpa_supplicant/ctrl_iface.c

index 68a62da72fdff87d33e22328775003703edcdc2a..9abfeb2168e6aee3ef78ed267b2acdaac99b9d60 100644 (file)
@@ -7113,7 +7113,8 @@ static int p2p_ctrl_invite(struct wpa_supplicant *wpa_s, char *cmd)
 static int p2p_ctrl_group_add_persistent(struct wpa_supplicant *wpa_s,
                                         int id, int freq, int vht_center_freq2,
                                         int ht40, int vht, int vht_chwidth,
-                                        int he, int edmg, bool allow_6ghz)
+                                        int he, int edmg, bool allow_6ghz,
+                                        const u8 *go_bssid)
 {
        struct wpa_ssid *ssid;
 
@@ -7128,7 +7129,8 @@ static int p2p_ctrl_group_add_persistent(struct wpa_supplicant *wpa_s,
        return wpas_p2p_group_add_persistent(wpa_s, ssid, 0, freq,
                                             vht_center_freq2, 0, ht40, vht,
                                             vht_chwidth, he, edmg,
-                                            NULL, 0, 0, allow_6ghz, 0, NULL);
+                                            NULL, 0, 0, allow_6ghz, 0,
+                                            go_bssid);
 }
 
 
@@ -7142,6 +7144,7 @@ static int p2p_ctrl_group_add(struct wpa_supplicant *wpa_s, char *cmd)
        int edmg = wpa_s->conf->p2p_go_edmg;
        int max_oper_chwidth, chwidth = 0, freq2 = 0;
        char *token, *context = NULL;
+       u8 go_bssid_buf[ETH_ALEN], *go_bssid = NULL;
 #ifdef CONFIG_ACS
        int acs = 0;
 #endif /* CONFIG_ACS */
@@ -7170,6 +7173,10 @@ static int p2p_ctrl_group_add(struct wpa_supplicant *wpa_s, char *cmd)
                        persistent = 1;
                } else if (os_strcmp(token, "allow_6ghz") == 0) {
                        allow_6ghz = true;
+               } else if (os_strncmp(token, "go_bssid=", 9) == 0) {
+                       if (hwaddr_aton(token + 9, go_bssid_buf))
+                               return -1;
+                       go_bssid = go_bssid_buf;
                } else {
                        wpa_printf(MSG_DEBUG,
                                   "CTRL: Invalid P2P_GROUP_ADD parameter: '%s'",
@@ -7213,7 +7220,8 @@ static int p2p_ctrl_group_add(struct wpa_supplicant *wpa_s, char *cmd)
                return p2p_ctrl_group_add_persistent(wpa_s, group_id,
                                                     freq, freq2, ht40, vht,
                                                     max_oper_chwidth, he,
-                                                    edmg, allow_6ghz);
+                                                    edmg, allow_6ghz,
+                                                    go_bssid);
 
        return wpas_p2p_group_add(wpa_s, persistent, freq, freq2, ht40, vht,
                                  max_oper_chwidth, he, edmg, allow_6ghz);