diff --git a/src/ap/ap_drv_ops.c b/src/ap/ap_drv_ops.c index 6864ed402..8f9cc5b36 100644 --- a/src/ap/ap_drv_ops.c +++ b/src/ap/ap_drv_ops.c @@ -553,12 +553,12 @@ int hostapd_set_ieee8021x(struct hostapd_data *hapd, int hostapd_get_seqnum(const char *ifname, struct hostapd_data *hapd, - const u8 *addr, int idx, u8 *seq) + const u8 *addr, int idx, int link_id, u8 *seq) { if (hapd->driver == NULL || hapd->driver->get_seqnum == NULL) return 0; return hapd->driver->get_seqnum(ifname, hapd->drv_priv, addr, idx, - seq); + link_id, seq); } diff --git a/src/ap/ap_drv_ops.h b/src/ap/ap_drv_ops.h index 25d9ee75e..331b0eaf4 100644 --- a/src/ap/ap_drv_ops.h +++ b/src/ap/ap_drv_ops.h @@ -62,7 +62,7 @@ int hostapd_if_remove(struct hostapd_data *hapd, enum wpa_driver_if_type type, int hostapd_set_ieee8021x(struct hostapd_data *hapd, struct wpa_bss_params *params); int hostapd_get_seqnum(const char *ifname, struct hostapd_data *hapd, - const u8 *addr, int idx, u8 *seq); + const u8 *addr, int idx, int link_id, u8 *seq); int hostapd_flush(struct hostapd_data *hapd); int hostapd_set_freq(struct hostapd_data *hapd, enum hostapd_hw_mode mode, int freq, int channel, int edmg, u8 edmg_channel, diff --git a/src/ap/wpa_auth_glue.c b/src/ap/wpa_auth_glue.c index eeeecaf4c..c810619a4 100644 --- a/src/ap/wpa_auth_glue.c +++ b/src/ap/wpa_auth_glue.c @@ -511,7 +511,14 @@ static int hostapd_wpa_auth_get_seqnum(void *ctx, const u8 *addr, int idx, u8 *seq) { struct hostapd_data *hapd = ctx; - return hostapd_get_seqnum(hapd->conf->iface, hapd, addr, idx, seq); + int link_id = -1; + +#ifdef CONFIG_IEEE80211BE + if (hapd->conf->mld_ap && idx) + link_id = hapd->mld_link_id; +#endif /* CONFIG_IEEE80211BE */ + return hostapd_get_seqnum(hapd->conf->iface, hapd, addr, idx, link_id, + seq); } diff --git a/src/drivers/driver.h b/src/drivers/driver.h index 24daa25db..b6171dde3 100644 --- a/src/drivers/driver.h +++ b/src/drivers/driver.h @@ -3485,6 +3485,7 @@ struct wpa_driver_ops { * @priv: Private driver interface data * @addr: MAC address of the station or %NULL for group keys * @idx: Key index + * @link_id: Link ID for a group key, or -1 if not set * @seq: Buffer for returning the latest used TSC/packet number * Returns: 0 on success, -1 on failure * @@ -3494,7 +3495,7 @@ struct wpa_driver_ops { * unicast keys (i.e., addr != %NULL). */ int (*get_seqnum)(const char *ifname, void *priv, const u8 *addr, - int idx, u8 *seq); + int idx, int link_id, u8 *seq); /** * flush - Flush all association stations (AP only) diff --git a/src/drivers/driver_atheros.c b/src/drivers/driver_atheros.c index 22c8ff30c..08ff915ac 100644 --- a/src/drivers/driver_atheros.c +++ b/src/drivers/driver_atheros.c @@ -586,7 +586,7 @@ atheros_set_key(void *priv, struct wpa_driver_set_key_params *params) static int atheros_get_seqnum(const char *ifname, void *priv, const u8 *addr, int idx, - u8 *seq) + int link_id, u8 *seq) { struct atheros_driver_data *drv = priv; struct ieee80211req_key wk; diff --git a/src/drivers/driver_bsd.c b/src/drivers/driver_bsd.c index 13fcab5a1..c32d05e65 100644 --- a/src/drivers/driver_bsd.c +++ b/src/drivers/driver_bsd.c @@ -906,7 +906,7 @@ bsd_set_privacy(void *priv, int enabled) static int bsd_get_seqnum(const char *ifname, void *priv, const u8 *addr, int idx, - u8 *seq) + int link_id, u8 *seq) { struct ieee80211req_key wk; diff --git a/src/drivers/driver_hostap.c b/src/drivers/driver_hostap.c index cf3b01e51..d3520aacc 100644 --- a/src/drivers/driver_hostap.c +++ b/src/drivers/driver_hostap.c @@ -459,7 +459,7 @@ static int wpa_driver_hostap_set_key(void *priv, static int hostap_get_seqnum(const char *ifname, void *priv, const u8 *addr, - int idx, u8 *seq) + int idx, int link_id, u8 *seq) { struct hostap_driver_data *drv = priv; struct prism2_hostapd_param *param; diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c index 1df3145a6..e4180daed 100644 --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c @@ -7520,24 +7520,33 @@ static int get_key_handler(struct nl_msg *msg, void *arg) static int i802_get_seqnum(const char *iface, void *priv, const u8 *addr, - int idx, u8 *seq) + int idx, int link_id, u8 *seq) { struct i802_bss *bss = priv; struct wpa_driver_nl80211_data *drv = bss->drv; struct nl_msg *msg; + int res; msg = nl80211_ifindex_msg(drv, if_nametoindex(iface), 0, NL80211_CMD_GET_KEY); if (!msg || (addr && nla_put(msg, NL80211_ATTR_MAC, ETH_ALEN, addr)) || + (link_id != NL80211_DRV_LINK_ID_NA && + nla_put_u8(msg, NL80211_ATTR_MLO_LINK_ID, link_id)) || nla_put_u8(msg, NL80211_ATTR_KEY_IDX, idx)) { nlmsg_free(msg); return -ENOBUFS; } - memset(seq, 0, 6); + os_memset(seq, 0, 6); + res = send_and_recv_msgs(drv, msg, get_key_handler, seq, NULL, NULL); + if (res) { + wpa_printf(MSG_DEBUG, + "nl80211: Failed to get current TX sequence for a key (link_id=%d idx=%d): %d (%s)", + link_id, idx, res, strerror(-res)); + } - return send_and_recv_msgs(drv, msg, get_key_handler, seq, NULL, NULL); + return res; } diff --git a/wpa_supplicant/driver_i.h b/wpa_supplicant/driver_i.h index 459a8e4ff..48953c1d9 100644 --- a/wpa_supplicant/driver_i.h +++ b/wpa_supplicant/driver_i.h @@ -192,7 +192,7 @@ static inline int wpa_drv_get_seqnum(struct wpa_supplicant *wpa_s, { if (wpa_s->driver->get_seqnum) return wpa_s->driver->get_seqnum(wpa_s->ifname, wpa_s->drv_priv, - addr, idx, seq); + addr, idx, -1, seq); return -1; }