Nl80211 supports Extended Key ID, implement support for it. Signed-off-by: Alexander Wetzel <alexander@xxxxxxxxxxxxxx> --- This patch allows hostapd/wpa_supplicant to really use Extended Key ID. Since so far only linux support Extended Key ID (and only via nl80211) the other drivers can't be updated. The patch is close to the end of the series make sure bisecting still generates working binaries regardless at which patch we split this series. src/drivers/driver_nl80211.c | 25 ++++++++++++++++++++++--- src/drivers/driver_nl80211_capa.c | 4 ++++ 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c index 7ff912912..9ef376c56 100644 --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c @@ -3049,7 +3049,11 @@ static int wpa_driver_nl80211_set_key(const char *ifname, struct i802_bss *bss, if (!key_msg) return -ENOBUFS; - if (alg == WPA_ALG_NONE) { + if (key_type == KEY_TYPE_SET_TX) { + msg = nl80211_ifindex_msg(drv, ifindex, 0, NL80211_CMD_SET_KEY); + if (!msg) + goto fail2; + } else if (alg == WPA_ALG_NONE) { msg = nl80211_ifindex_msg(drv, ifindex, 0, NL80211_CMD_DEL_KEY); if (!msg) goto fail2; @@ -3059,16 +3063,18 @@ static int wpa_driver_nl80211_set_key(const char *ifname, struct i802_bss *bss, suite = wpa_alg_to_cipher_suite(alg, key_len); if (!suite) goto fail2; + msg = nl80211_ifindex_msg(drv, ifindex, 0, NL80211_CMD_NEW_KEY); if (!msg) goto fail2; + if (nla_put(key_msg, NL80211_KEY_DATA, key_len, key) || nla_put_u32(key_msg, NL80211_KEY_CIPHER, suite)) goto fail; wpa_hexdump_key(MSG_DEBUG, "nl80211: KEY_DATA", key, key_len); } - if (seq && seq_len) { + if (seq && seq_len && key_type != KEY_TYPE_SET_TX) { if (nla_put(key_msg, NL80211_KEY_SEQ, seq_len, seq)) goto fail; wpa_hexdump(MSG_DEBUG, "nl80211: KEY_SEQ", seq, seq_len); @@ -3079,7 +3085,20 @@ static int wpa_driver_nl80211_set_key(const char *ifname, struct i802_bss *bss, if (nla_put(msg, NL80211_ATTR_MAC, ETH_ALEN, addr)) goto fail; - if (alg != WPA_ALG_WEP && key_type != KEY_TYPE_PAIRWISE) { + if (key_type == KEY_TYPE_NO_AUTO_TX || + key_type == KEY_TYPE_SET_TX) { + wpa_printf(MSG_DEBUG, "nl80211: %s for " + "keyid=%d addr=" MACSTR, + key_type == KEY_TYPE_NO_AUTO_TX ? + "KEY_TYPE_NO_AUTO_TX" : "KEY_TYPE_SET_TX", + key_idx, MAC2STR(addr)); + if (nla_put_u8(key_msg, NL80211_KEY_MODE, + key_type == KEY_TYPE_NO_AUTO_TX ? + NL80211_KEY_NO_TX : + NL80211_KEY_SET_TX)) + goto fail; + } else if (alg != WPA_ALG_WEP && + key_type != KEY_TYPE_PAIRWISE) { wpa_printf(MSG_DEBUG, " RSN IBSS RX GTK"); if (nla_put_u32(key_msg, NL80211_KEY_TYPE, NL80211_KEYTYPE_GROUP)) diff --git a/src/drivers/driver_nl80211_capa.c b/src/drivers/driver_nl80211_capa.c index 8318b10ab..b4d175f4e 100644 --- a/src/drivers/driver_nl80211_capa.c +++ b/src/drivers/driver_nl80211_capa.c @@ -417,6 +417,10 @@ static void wiphy_info_ext_feature_flags(struct wiphy_info_data *info, NL80211_EXT_FEATURE_DFS_OFFLOAD)) capa->flags |= WPA_DRIVER_FLAGS_DFS_OFFLOAD; + if (ext_feature_isset(ext_features, len, + NL80211_EXT_FEATURE_EXT_KEY_ID)) + capa->flags |= WPA_DRIVER_FLAGS_EXTENDED_KEY_ID; + #ifdef CONFIG_MBO if (ext_feature_isset(ext_features, len, NL80211_EXT_FEATURE_FILS_MAX_CHANNEL_TIME) && -- 2.22.0 _______________________________________________ Hostap mailing list Hostap@xxxxxxxxxxxxxxxxxxx http://lists.infradead.org/mailman/listinfo/hostap