AP MLD: Provide Link ID when requesting current seqnum for a group key
This is needed to match the key configuration design with a single netdev and the nl80211 driver interface. Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
This commit is contained in:
parent
19b6a1513f
commit
aa4b8492e4
9 changed files with 29 additions and 12 deletions
|
@ -553,12 +553,12 @@ int hostapd_set_ieee8021x(struct hostapd_data *hapd,
|
||||||
|
|
||||||
|
|
||||||
int hostapd_get_seqnum(const char *ifname, 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)
|
if (hapd->driver == NULL || hapd->driver->get_seqnum == NULL)
|
||||||
return 0;
|
return 0;
|
||||||
return hapd->driver->get_seqnum(ifname, hapd->drv_priv, addr, idx,
|
return hapd->driver->get_seqnum(ifname, hapd->drv_priv, addr, idx,
|
||||||
seq);
|
link_id, seq);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -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,
|
int hostapd_set_ieee8021x(struct hostapd_data *hapd,
|
||||||
struct wpa_bss_params *params);
|
struct wpa_bss_params *params);
|
||||||
int hostapd_get_seqnum(const char *ifname, 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);
|
||||||
int hostapd_flush(struct hostapd_data *hapd);
|
int hostapd_flush(struct hostapd_data *hapd);
|
||||||
int hostapd_set_freq(struct hostapd_data *hapd, enum hostapd_hw_mode mode,
|
int hostapd_set_freq(struct hostapd_data *hapd, enum hostapd_hw_mode mode,
|
||||||
int freq, int channel, int edmg, u8 edmg_channel,
|
int freq, int channel, int edmg, u8 edmg_channel,
|
||||||
|
|
|
@ -511,7 +511,14 @@ static int hostapd_wpa_auth_get_seqnum(void *ctx, const u8 *addr, int idx,
|
||||||
u8 *seq)
|
u8 *seq)
|
||||||
{
|
{
|
||||||
struct hostapd_data *hapd = ctx;
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -3485,6 +3485,7 @@ struct wpa_driver_ops {
|
||||||
* @priv: Private driver interface data
|
* @priv: Private driver interface data
|
||||||
* @addr: MAC address of the station or %NULL for group keys
|
* @addr: MAC address of the station or %NULL for group keys
|
||||||
* @idx: Key index
|
* @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
|
* @seq: Buffer for returning the latest used TSC/packet number
|
||||||
* Returns: 0 on success, -1 on failure
|
* Returns: 0 on success, -1 on failure
|
||||||
*
|
*
|
||||||
|
@ -3494,7 +3495,7 @@ struct wpa_driver_ops {
|
||||||
* unicast keys (i.e., addr != %NULL).
|
* unicast keys (i.e., addr != %NULL).
|
||||||
*/
|
*/
|
||||||
int (*get_seqnum)(const char *ifname, void *priv, const u8 *addr,
|
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)
|
* flush - Flush all association stations (AP only)
|
||||||
|
|
|
@ -586,7 +586,7 @@ atheros_set_key(void *priv, struct wpa_driver_set_key_params *params)
|
||||||
|
|
||||||
static int
|
static int
|
||||||
atheros_get_seqnum(const char *ifname, void *priv, const u8 *addr, int idx,
|
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 atheros_driver_data *drv = priv;
|
||||||
struct ieee80211req_key wk;
|
struct ieee80211req_key wk;
|
||||||
|
|
|
@ -906,7 +906,7 @@ bsd_set_privacy(void *priv, int enabled)
|
||||||
|
|
||||||
static int
|
static int
|
||||||
bsd_get_seqnum(const char *ifname, void *priv, const u8 *addr, int idx,
|
bsd_get_seqnum(const char *ifname, void *priv, const u8 *addr, int idx,
|
||||||
u8 *seq)
|
int link_id, u8 *seq)
|
||||||
{
|
{
|
||||||
struct ieee80211req_key wk;
|
struct ieee80211req_key wk;
|
||||||
|
|
||||||
|
|
|
@ -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,
|
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 hostap_driver_data *drv = priv;
|
||||||
struct prism2_hostapd_param *param;
|
struct prism2_hostapd_param *param;
|
||||||
|
|
|
@ -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,
|
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 i802_bss *bss = priv;
|
||||||
struct wpa_driver_nl80211_data *drv = bss->drv;
|
struct wpa_driver_nl80211_data *drv = bss->drv;
|
||||||
struct nl_msg *msg;
|
struct nl_msg *msg;
|
||||||
|
int res;
|
||||||
|
|
||||||
msg = nl80211_ifindex_msg(drv, if_nametoindex(iface), 0,
|
msg = nl80211_ifindex_msg(drv, if_nametoindex(iface), 0,
|
||||||
NL80211_CMD_GET_KEY);
|
NL80211_CMD_GET_KEY);
|
||||||
if (!msg ||
|
if (!msg ||
|
||||||
(addr && nla_put(msg, NL80211_ATTR_MAC, ETH_ALEN, addr)) ||
|
(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)) {
|
nla_put_u8(msg, NL80211_ATTR_KEY_IDX, idx)) {
|
||||||
nlmsg_free(msg);
|
nlmsg_free(msg);
|
||||||
return -ENOBUFS;
|
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -192,7 +192,7 @@ static inline int wpa_drv_get_seqnum(struct wpa_supplicant *wpa_s,
|
||||||
{
|
{
|
||||||
if (wpa_s->driver->get_seqnum)
|
if (wpa_s->driver->get_seqnum)
|
||||||
return wpa_s->driver->get_seqnum(wpa_s->ifname, wpa_s->drv_priv,
|
return wpa_s->driver->get_seqnum(wpa_s->ifname, wpa_s->drv_priv,
|
||||||
addr, idx, seq);
|
addr, idx, -1, seq);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue