[PATCH v3 17/46] nl80211: Use wdev-based message for SET_KEY on wdev-only interfaces

Kavita Kavita kavita.kavita at oss.qualcomm.com
Wed May 13 02:59:41 PDT 2026


From: Peddolla Harshavardhan Reddy <peddolla.reddy at oss.qualcomm.com>

The pairwise RX/TX modify path in wpa_driver_nl80211_set_key()
always used nl80211_ifindex_msg() which includes NL80211_ATTR_IFINDEX.
Non-netdev interfaces such as PD (Proximity Detection) have no valid
ifindex, causing SET_KEY to fail.

Use nl80211_cmd_msg() instead when the interface is not a netdev type
so that NL80211_ATTR_WDEV is included in the SET_KEY command.

Signed-off-by: Peddolla Harshavardhan Reddy <peddolla.reddy at oss.qualcomm.com>
---
 src/drivers/driver_nl80211.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
index a5b44d9d6..ea214b74b 100644
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -4012,7 +4012,11 @@ static int wpa_driver_nl80211_set_key(struct i802_bss *bss,
 	    KEY_FLAG_PAIRWISE_RX_TX_MODIFY) {
 		wpa_printf(MSG_DEBUG,
 			   "nl80211: SET_KEY (pairwise RX/TX modify)");
-		msg = nl80211_ifindex_msg(drv, ifindex, 0, NL80211_CMD_SET_KEY);
+		if (!nl80211_is_netdev_iftype(drv->nlmode))
+			msg = nl80211_cmd_msg(bss, 0, NL80211_CMD_SET_KEY);
+		else
+			msg = nl80211_ifindex_msg(drv, ifindex, 0,
+						  NL80211_CMD_SET_KEY);
 		if (!msg)
 			goto fail2;
 	} else if (alg == WPA_ALG_NONE && (key_flag & KEY_FLAG_RX_TX)) {
-- 
2.34.1




More information about the Hostap mailing list