> -----Original Message----- > From: Hostap <hostap-bounces@xxxxxxxxxxxxxxxxxxx> On Behalf Of > Veerendranath Jakkam > Sent: Thursday, August 25, 2022 08:53 > To: hostap@xxxxxxxxxxxxxxxxxxx > Cc: quic_vjakkam@xxxxxxxxxxx > Subject: [PATCH 07/12] MLD STA: Add support to configure keys with MLO > link ID param > > Add APIs to specify link ID for set key operations for MLO connection. > > Signed-off-by: Veerendranath Jakkam <quic_vjakkam@xxxxxxxxxxx> > --- > src/ap/ap_drv_ops.c | 1 + > src/drivers/driver.h | 6 ++++++ > src/drivers/driver_nl80211.c | 15 +++++++++++++++ > src/rsn_supp/wpa.h | 4 ++++ > src/rsn_supp/wpa_i.h | 12 ++++++++++++ > wpa_supplicant/driver_i.h | 24 ++++++++++++++++++------ > wpa_supplicant/wpas_glue.c | 16 ++++++++++++++++ > 7 files changed, 72 insertions(+), 6 deletions(-) > > diff --git a/src/ap/ap_drv_ops.c b/src/ap/ap_drv_ops.c index > 87c3b9006..2102a2898 100644 > --- a/src/ap/ap_drv_ops.c > +++ b/src/ap/ap_drv_ops.c > @@ -716,6 +716,7 @@ int hostapd_drv_set_key(const char *ifname, struct > hostapd_data *hapd, > params.key_len = key_len; > params.vlan_id = vlan_id; > params.key_flag = key_flag; > + params.link_id = -1; > > return hapd->driver->set_key(hapd->drv_priv, ¶ms); } diff --git > a/src/drivers/driver.h b/src/drivers/driver.h index 3602224b6..9a2d9bbc2 > 100644 > --- a/src/drivers/driver.h > +++ b/src/drivers/driver.h > @@ -1772,6 +1772,12 @@ struct wpa_driver_set_key_params { > * %KEY_FLAG_RX_TX > * RX/TX key. */ > enum key_flag key_flag; > + > + /** > + * link_id - MLO link ID > + * > + * set to valid link ID (0-14) when applicable, otherwise -1 */ > + int link_id; > }; > > enum wpa_driver_if_type { > diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c index > a4675eb1d..af9d53b45 100644 > --- a/src/drivers/driver_nl80211.c > +++ b/src/drivers/driver_nl80211.c > @@ -3343,6 +3343,7 @@ static int wpa_driver_nl80211_set_key(struct > i802_bss *bss, > size_t key_len = params->key_len; > int vlan_id = params->vlan_id; > enum key_flag key_flag = params->key_flag; > + int link_id = params->link_id; > > /* Ignore for P2P Device */ > if (drv->nlmode == NL80211_IFTYPE_P2P_DEVICE) @@ -3479,6 > +3480,13 @@ static int wpa_driver_nl80211_set_key(struct i802_bss *bss, > goto fail; > } > > + if (link_id != -1) { > + wpa_printf(MSG_DEBUG, "nl80211: Link ID %d", > + link_id); > + if (nla_put_u8(msg, NL80211_ATTR_MLO_LINK_ID, link_id)) > + goto fail; > + } > + > ret = send_and_recv_msgs(drv, msg, NULL, NULL, NULL, NULL); > if ((ret == -ENOENT || ret == -ENOLINK) && alg == WPA_ALG_NONE) > ret = 0; > @@ -3541,6 +3549,13 @@ static int wpa_driver_nl80211_set_key(struct > i802_bss *bss, > goto fail; > } > > + if (link_id != -1) { > + wpa_printf(MSG_DEBUG, "nl80211: set_key default - Link ID > %d", > + link_id); > + if (nla_put_u8(msg, NL80211_ATTR_MLO_LINK_ID, link_id)) > + goto fail; > + } > + > ret = send_and_recv_msgs(drv, msg, NULL, NULL, NULL, NULL); > if (ret) > wpa_printf(MSG_DEBUG, > diff --git a/src/rsn_supp/wpa.h b/src/rsn_supp/wpa.h index > a56802b0a..ecfcf277f 100644 > --- a/src/rsn_supp/wpa.h > +++ b/src/rsn_supp/wpa.h > @@ -33,6 +33,10 @@ struct wpa_sm_ctx { > const u8 *addr, int key_idx, int set_tx, > const u8 *seq, size_t seq_len, > const u8 *key, size_t key_len, enum key_flag key_flag); > + int (*mlo_set_key)(void *ctx, u8 link_id, enum wpa_alg alg, > + const u8 *addr, int key_idx, int set_tx, > + const u8 *seq, size_t seq_len, const u8 *key, > + size_t key_len, enum key_flag key_flag); Did you consider extending the existing set_key callback? Seems more straightforward. > > +static int wpa_supplicant_mlo_set_key(void *_wpa_s, u8 link_id, > + enum wpa_alg alg, const u8 *addr, > + int key_idx, int set_tx, const u8 *seq, > + size_t seq_len, const u8 *key, > + size_t key_len, enum key_flag key_flag) { > + struct wpa_supplicant *wpa_s = _wpa_s; > + if (alg == WPA_ALG_TKIP && key_idx == 0 && key_len == 32) { > + /* Clear the MIC error counter when setting a new PTK. */ > + wpa_s->mic_errors_seen = 0; > + } I do not think that TKIP is an allowed cipher suite with MLD (at least I hope it isn't ...). Regards, Ilan. _______________________________________________ Hostap mailing list Hostap@xxxxxxxxxxxxxxxxxxx http://lists.infradead.org/mailman/listinfo/hostap