]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
P2P2: Configuration of channel switch request for testing purposes
authorShivani Baranwal <quic_shivbara@quicinc.com>
Thu, 18 Jul 2024 14:55:24 +0000 (20:25 +0530)
committerJouni Malinen <j@w1.fi>
Fri, 1 Nov 2024 20:49:57 +0000 (22:49 +0200)
P2P2 advertises support for channel switch request in the PCEA
attribute. Add support to configure it through control interface for
testing purposes.

Signed-off-by: Shivani Baranwal <quic_shivbara@quicinc.com>
src/p2p/p2p.c
src/p2p/p2p.h
src/p2p/p2p_build.c
wpa_supplicant/ctrl_iface.c

index bb970f8028e620beda7463f1daabda7290f630b9..b2c7e54184474c97992d73662bee7dd436520133 100644 (file)
@@ -5032,6 +5032,12 @@ void p2p_set_twt_power_mgmt(struct p2p_data *p2p, int val)
                p2p->cfg->twt_power_mgmt = false;
 }
 
+
+void p2p_set_chan_switch_req_enable(struct p2p_data *p2p, bool val)
+{
+       p2p->cfg->chan_switch_req_enable = val;
+}
+
 #endif /* CONFIG_TESTING_OPTIONS */
 
 
index c7a803bc3d88b47fdd299c09ac5d8c12d72504e2..2c99daf835999d9f9175751ea3166057ea4e7e4b 100644 (file)
@@ -721,6 +721,11 @@ struct p2p_config {
         */
        u16 comeback_after;
 
+       /**
+        * chan_switch_req_enable - Enable P2P client channel switch request
+        */
+       bool chan_switch_req_enable;
+
        /**
         * cb_ctx - Context to use with callback functions
         */
@@ -2706,6 +2711,7 @@ void p2p_set_comeback_after(struct p2p_data *p2p, int comeback_after);
 void p2p_set_reg_info(struct p2p_data *p2p, u8 val);
 void p2p_set_twt_power_mgmt(struct p2p_data *p2p, int val);
 void p2p_set_dev_addr(struct p2p_data *p2p, const u8 *addr);
+void p2p_set_chan_switch_req_enable(struct p2p_data *p2p, bool val);
 
 int p2p_get_listen_freq(struct p2p_data *p2p, const u8 *peer_addr);
 int p2p_initiate_pasn_auth(struct p2p_data *p2p, const u8 *addr, int freq);
index ddadd34bc5a1128c05abca3c5b9f08aae5717767..015eed22c009d6835069de92683c2f159ffe68f6 100644 (file)
@@ -741,6 +741,9 @@ void p2p_buf_add_pcea(struct wpabuf *buf, struct p2p_data *p2p)
        if (p2p->cfg->dfs_owner)
                capability_info |= P2P_PCEA_DFS_OWNER;
 
+       if (p2p->cfg->chan_switch_req_enable)
+               capability_info |= P2P_PCEA_CLI_REQ_CS;
+
        if (p2p->cfg->pairing_config.pairing_capable)
                capability_info |= P2P_PCEA_PAIRING_CAPABLE;
 
index 15ff0f2b74154c09f5b5f7c98435763764cffaea..90fa6ed2bc630f15e432230542b9c9929fff17b4 100644 (file)
@@ -7745,6 +7745,11 @@ static int p2p_ctrl_set(struct wpa_supplicant *wpa_s, char *cmd)
                p2p_set_twt_power_mgmt(wpa_s->global->p2p, atoi(param));
                return 0;
        }
+
+       if (os_strcmp(cmd, "chan_switch_req_enable") == 0) {
+               p2p_set_chan_switch_req_enable(wpa_s->global->p2p, atoi(param));
+               return 0;
+       }
 #endif /* CONFIG_TESTING_OPTIONS */
 
        wpa_printf(MSG_DEBUG, "CTRL_IFACE: Unknown P2P_SET field value '%s'",