]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
driver: Add option for link ID to be specified for send_tdls_mgmt()
authorKiran Kumar Lokere <quic_klokere@quicinc.com>
Thu, 9 Feb 2023 08:25:30 +0000 (00:25 -0800)
committerJouni Malinen <j@w1.fi>
Fri, 8 Sep 2023 09:51:37 +0000 (12:51 +0300)
This is needed to allow the driver to know on which operating channel
(as specified by the link that is affiliated with AP MLD for the current
association) is used for transmitting TDLS Discovery Response. This
commit adds the link_id parameter to various functions, but does not
implement the driver interface change itself.

Signed-off-by: Jouni Malinen <quic_klokere@quicinc.com>
src/drivers/driver.h
src/drivers/driver_nl80211.c
src/rsn_supp/tdls.c
src/rsn_supp/wpa.h
src/rsn_supp/wpa_i.h
wpa_supplicant/driver_i.h
wpa_supplicant/wpas_glue.c

index 5957567a940e956b60d6fcf518f70bd150c347d5..dbe2ad5e413660d00fc25a2b8f1309f4cca3ec36 100644 (file)
@@ -4103,6 +4103,8 @@ struct wpa_driver_ops {
         * @initiator: Is the current end the TDLS link initiator
         * @buf: TDLS IEs to add to the message
         * @len: Length of buf in octets
+        * @link_id: If >= 0 indicates the link of the AP MLD to specify the
+        * operating channel on which to send a TDLS Discovery Response frame.
         * Returns: 0 on success, negative (<0) on failure
         *
         * This optional function can be used to send packet to driver which is
@@ -4110,7 +4112,8 @@ struct wpa_driver_ops {
         */
        int (*send_tdls_mgmt)(void *priv, const u8 *dst, u8 action_code,
                              u8 dialog_token, u16 status_code, u32 peer_capab,
-                             int initiator, const u8 *buf, size_t len);
+                             int initiator, const u8 *buf, size_t len,
+                             int link_id);
 
        /**
         * tdls_oper - Ask the driver to perform high-level TDLS operations
index 563ce61d7ede74e430eadcc10b427297e1242fb6..55eb52f05a56f0914c3813f075f0605573168229 100644 (file)
@@ -10278,7 +10278,7 @@ static int nl80211_add_peer_capab(struct nl_msg *msg,
 static int nl80211_send_tdls_mgmt(void *priv, const u8 *dst, u8 action_code,
                                  u8 dialog_token, u16 status_code,
                                  u32 peer_capab, int initiator, const u8 *buf,
-                                 size_t len)
+                                 size_t len, int link_id)
 {
        struct i802_bss *bss = priv;
        struct wpa_driver_nl80211_data *drv = bss->drv;
index 1531f51cb872e1ef1ef917a90330e1347d5ba2e6..47953b4278b88245bdc4ce3162b2bb9fc4dcf318 100644 (file)
@@ -245,17 +245,19 @@ static int wpa_tdls_set_key(struct wpa_sm *sm, struct wpa_tdls_peer *peer)
 static int wpa_tdls_send_tpk_msg(struct wpa_sm *sm, const u8 *dst,
                                 u8 action_code, u8 dialog_token,
                                 u16 status_code, u32 peer_capab,
-                                int initiator, const u8 *buf, size_t len)
+                                int initiator, const u8 *buf, size_t len,
+                                int link_id)
 {
        return wpa_sm_send_tdls_mgmt(sm, dst, action_code, dialog_token,
                                     status_code, peer_capab, initiator, buf,
-                                    len);
+                                    len, link_id);
 }
 
 
 static int wpa_tdls_tpk_send(struct wpa_sm *sm, const u8 *dest, u8 action_code,
                             u8 dialog_token, u16 status_code, u32 peer_capab,
-                            int initiator, const u8 *msg, size_t msg_len)
+                            int initiator, const u8 *msg, size_t msg_len,
+                            int link_id)
 {
        struct wpa_tdls_peer *peer;
 
@@ -267,7 +269,7 @@ static int wpa_tdls_tpk_send(struct wpa_sm *sm, const u8 *dest, u8 action_code,
 
        if (wpa_tdls_send_tpk_msg(sm, dest, action_code, dialog_token,
                                  status_code, peer_capab, initiator, msg,
-                                 msg_len)) {
+                                 msg_len, link_id)) {
                wpa_printf(MSG_INFO, "TDLS: Failed to send message "
                           "(action_code=%u)", action_code);
                return -1;
@@ -364,7 +366,7 @@ static void wpa_tdls_tpk_retry_timeout(void *eloop_ctx, void *timeout_ctx)
                                          peer->sm_tmr.peer_capab,
                                          peer->initiator,
                                          peer->sm_tmr.buf,
-                                         peer->sm_tmr.buf_len)) {
+                                         peer->sm_tmr.buf_len, -1)) {
                        wpa_printf(MSG_INFO, "TDLS: Failed to retry "
                                   "transmission");
                }
@@ -846,7 +848,8 @@ skip_ies:
 
        /* request driver to send Teardown using this FTIE */
        wpa_tdls_tpk_send(sm, addr, WLAN_TDLS_TEARDOWN, 0,
-                         reason_code, 0, peer->initiator, rbuf, pos - rbuf);
+                         reason_code, 0, peer->initiator, rbuf, pos - rbuf,
+                         -1);
        os_free(rbuf);
 
        return 0;
@@ -1041,7 +1044,7 @@ static int wpa_tdls_send_error(struct wpa_sm *sm, const u8 *dst,
                   " (action=%u status=%u)",
                   MAC2STR(dst), tdls_action, status);
        return wpa_tdls_tpk_send(sm, dst, tdls_action, dialog_token, status,
-                                0, initiator, NULL, 0);
+                                0, initiator, NULL, 0, -1);
 }
 
 
@@ -1249,7 +1252,8 @@ skip_ies:
                   MAC2STR(peer->addr));
 
        status = wpa_tdls_tpk_send(sm, peer->addr, WLAN_TDLS_SETUP_REQUEST,
-                                  1, 0, 0, peer->initiator, rbuf, pos - rbuf);
+                                  1, 0, 0, peer->initiator, rbuf, pos - rbuf,
+                                  -1);
        os_free(rbuf);
 
        return status;
@@ -1341,7 +1345,7 @@ static int wpa_tdls_send_tpk_m2(struct wpa_sm *sm,
 skip_ies:
        status = wpa_tdls_tpk_send(sm, src_addr, WLAN_TDLS_SETUP_RESPONSE,
                                   dtoken, 0, 0, peer->initiator, rbuf,
-                                  pos - rbuf);
+                                  pos - rbuf, -1);
        os_free(rbuf);
 
        return status;
@@ -1442,7 +1446,7 @@ skip_ies:
 
        status = wpa_tdls_tpk_send(sm, src_addr, WLAN_TDLS_SETUP_CONFIRM,
                                   dtoken, 0, peer_capab, peer->initiator,
-                                  rbuf, pos - rbuf);
+                                  rbuf, pos - rbuf, -1);
        os_free(rbuf);
 
        return status;
@@ -1451,7 +1455,7 @@ skip_ies:
 
 static int wpa_tdls_send_discovery_response(struct wpa_sm *sm,
                                            struct wpa_tdls_peer *peer,
-                                           u8 dialog_token)
+                                           u8 dialog_token, int link_id)
 {
        size_t buf_len = 0;
        struct wpa_tdls_timeoutie timeoutie;
@@ -1528,7 +1532,8 @@ skip_rsn_ies:
        wpa_printf(MSG_DEBUG, "TDLS: TPK lifetime %u seconds", peer->lifetime);
 skip_ies:
        status = wpa_tdls_tpk_send(sm, peer->addr, WLAN_TDLS_DISCOVERY_RESPONSE,
-                                  dialog_token, 0, 0, 0, rbuf, pos - rbuf);
+                                  dialog_token, 0, 0, 0, rbuf, pos - rbuf,
+                                  link_id);
        os_free(rbuf);
 
        return status;
@@ -1545,6 +1550,7 @@ wpa_tdls_process_discovery_request(struct wpa_sm *sm, const u8 *addr,
        size_t min_req_len = sizeof(struct wpa_tdls_frame) +
                1 /* dialog token */ + sizeof(struct wpa_tdls_lnkid);
        u8 dialog_token;
+       int link_id = -1;
 
        wpa_printf(MSG_DEBUG, "TDLS: Discovery Request from " MACSTR,
                   MAC2STR(addr));
@@ -1587,7 +1593,8 @@ wpa_tdls_process_discovery_request(struct wpa_sm *sm, const u8 *addr,
        if (peer == NULL)
                return -1;
 
-       return wpa_tdls_send_discovery_response(sm, peer, dialog_token);
+       return wpa_tdls_send_discovery_response(sm, peer, dialog_token,
+                                               link_id);
 }
 
 
@@ -1599,7 +1606,7 @@ int wpa_tdls_send_discovery_request(struct wpa_sm *sm, const u8 *addr)
        wpa_printf(MSG_DEBUG, "TDLS: Sending Discovery Request to peer "
                   MACSTR, MAC2STR(addr));
        return wpa_tdls_tpk_send(sm, addr, WLAN_TDLS_DISCOVERY_REQUEST,
-                                1, 0, 0, 1, NULL, 0);
+                                1, 0, 0, 1, NULL, 0, -1);
 }
 
 
index b3c8b6a7de8e020bf2abb790f3c006751fbcd002..36ddab3fe09c48a0d30ebcac8f0b1dd483aca84b 100644 (file)
@@ -64,7 +64,8 @@ struct wpa_sm_ctx {
        int (*send_tdls_mgmt)(void *ctx, const u8 *dst,
                              u8 action_code, u8 dialog_token,
                              u16 status_code, u32 peer_capab,
-                             int initiator, const u8 *buf, size_t len);
+                             int initiator, const u8 *buf, size_t len,
+                             int link_id);
        int (*tdls_oper)(void *ctx, int oper, const u8 *peer);
        int (*tdls_peer_addset)(void *ctx, const u8 *addr, int add, u16 aid,
                                u16 capability, const u8 *supp_rates,
index 300ef547d2550a5cb1f2accde553f2877fc99910..b70c54a5009508d11cb66a86313753a7b2c3c83a 100644 (file)
@@ -380,13 +380,13 @@ static inline int wpa_sm_send_tdls_mgmt(struct wpa_sm *sm, const u8 *dst,
                                        u8 action_code, u8 dialog_token,
                                        u16 status_code, u32 peer_capab,
                                        int initiator, const u8 *buf,
-                                       size_t len)
+                                       size_t len, int link_id)
 {
        if (sm->ctx->send_tdls_mgmt)
                return sm->ctx->send_tdls_mgmt(sm->ctx->ctx, dst, action_code,
                                               dialog_token, status_code,
                                               peer_capab, initiator, buf,
-                                              len);
+                                              len, link_id);
        return -1;
 }
 
index 48953c1d93bf1417da0549ebcc56909dcdb76275..f0ce7581b5d82dc43f6da5c8c2dc58e608a022ab 100644 (file)
@@ -585,13 +585,14 @@ static inline int wpa_drv_send_tdls_mgmt(struct wpa_supplicant *wpa_s,
                                         const u8 *dst, u8 action_code,
                                         u8 dialog_token, u16 status_code,
                                         u32 peer_capab, int initiator,
-                                        const u8 *buf, size_t len)
+                                        const u8 *buf, size_t len, int link_id)
 {
        if (wpa_s->driver->send_tdls_mgmt) {
                return wpa_s->driver->send_tdls_mgmt(wpa_s->drv_priv, dst,
                                                     action_code, dialog_token,
                                                     status_code, peer_capab,
-                                                    initiator, buf, len);
+                                                    initiator, buf, len,
+                                                    link_id);
        }
        return -1;
 }
index c4cfca50e62a1774b778c282ff996bf41fa07b57..fb5149f200e90eb13e298ac9caca173ffaa33e28 100644 (file)
@@ -769,12 +769,12 @@ static int wpa_supplicant_send_tdls_mgmt(void *ctx, const u8 *dst,
                                         u8 action_code, u8 dialog_token,
                                         u16 status_code, u32 peer_capab,
                                         int initiator, const u8 *buf,
-                                        size_t len)
+                                        size_t len, int link_id)
 {
        struct wpa_supplicant *wpa_s = ctx;
        return wpa_drv_send_tdls_mgmt(wpa_s, dst, action_code, dialog_token,
                                      status_code, peer_capab, initiator, buf,
-                                     len);
+                                     len, link_id);
 }