* [PATCH v2 1/2] ap: check FULL_AP_CLIENT_STATE for NEW_STATION
@ 2023-02-24 18:51 James Prestwood
2023-02-24 18:51 ` [PATCH v2 2/2] ap: handle -ENOTSUP when getting the GTK James Prestwood
2023-02-27 16:28 ` [PATCH v2 1/2] ap: check FULL_AP_CLIENT_STATE for NEW_STATION Denis Kenzior
0 siblings, 2 replies; 3+ messages in thread
From: James Prestwood @ 2023-02-24 18:51 UTC (permalink / raw)
To: iwd; +Cc: James Prestwood
nl80211 has a check which returns -EINVAL for NEW_STATION if this
feature is not enabled and the mask contains Authenticated/Associated
flags.
---
src/ap.c | 17 ++++++++++-------
1 file changed, 10 insertions(+), 7 deletions(-)
diff --git a/src/ap.c b/src/ap.c
index 2867e1ab..fee5a6c8 100644
--- a/src/ap.c
+++ b/src/ap.c
@@ -1643,19 +1643,22 @@ static struct l_genl_msg *ap_build_cmd_new_station(struct sta_state *sta)
{
struct l_genl_msg *msg;
uint32_t ifindex = netdev_get_ifindex(sta->ap->netdev);
- /*
- * This should hopefully work both with and without
- * NL80211_FEATURE_FULL_AP_CLIENT_STATE.
- */
struct nl80211_sta_flag_update flags = {
- .mask = (1 << NL80211_STA_FLAG_AUTHENTICATED) |
- (1 << NL80211_STA_FLAG_ASSOCIATED) |
- (1 << NL80211_STA_FLAG_AUTHORIZED) |
+ .mask = (1 << NL80211_STA_FLAG_AUTHORIZED) |
(1 << NL80211_STA_FLAG_MFP),
.set = (1 << NL80211_STA_FLAG_AUTHENTICATED) |
(1 << NL80211_STA_FLAG_ASSOCIATED),
};
+ /*
+ * Without this feature nl80211 rejects NEW_STATION if the mask contains
+ * auth/assoc flags
+ */
+ if (wiphy_has_feature(netdev_get_wiphy(sta->ap->netdev),
+ NL80211_FEATURE_FULL_AP_CLIENT_STATE))
+ flags.mask |= (1 << NL80211_STA_FLAG_ASSOCIATED) |
+ (1 << NL80211_STA_FLAG_AUTHENTICATED);
+
msg = l_genl_msg_new_sized(NL80211_CMD_NEW_STATION, 300);
l_genl_msg_append_attr(msg, NL80211_ATTR_IFINDEX, 4, &ifindex);
--
2.34.3
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH v2 2/2] ap: handle -ENOTSUP when getting the GTK
2023-02-24 18:51 [PATCH v2 1/2] ap: check FULL_AP_CLIENT_STATE for NEW_STATION James Prestwood
@ 2023-02-24 18:51 ` James Prestwood
2023-02-27 16:28 ` [PATCH v2 1/2] ap: check FULL_AP_CLIENT_STATE for NEW_STATION Denis Kenzior
1 sibling, 0 replies; 3+ messages in thread
From: James Prestwood @ 2023-02-24 18:51 UTC (permalink / raw)
To: iwd; +Cc: James Prestwood
Some hardware does not support this, so use a zero RSC in this
case rather than failing the association.
---
src/ap.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
v2:
* Instead, jump to the !gtk_rsc if block to memset and set the pointer
diff --git a/src/ap.c b/src/ap.c
index fee5a6c8..398e469a 100644
--- a/src/ap.c
+++ b/src/ap.c
@@ -1499,14 +1499,19 @@ static void ap_gtk_query_cb(struct l_genl_msg *msg, void *user_data)
struct sta_state *sta = user_data;
const void *gtk_rsc;
uint8_t zero_gtk_rsc[6];
+ int err;
sta->gtk_query_cmd_id = 0;
- if (l_genl_msg_get_error(msg) < 0)
+ err = l_genl_msg_get_error(msg);
+ if (err == -ENOTSUP)
+ goto zero_rsc;
+ else if (err < 0)
goto error;
gtk_rsc = nl80211_parse_get_key_seq(msg);
if (!gtk_rsc) {
+zero_rsc:
memset(zero_gtk_rsc, 0, 6);
gtk_rsc = zero_gtk_rsc;
}
--
2.34.3
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v2 1/2] ap: check FULL_AP_CLIENT_STATE for NEW_STATION
2023-02-24 18:51 [PATCH v2 1/2] ap: check FULL_AP_CLIENT_STATE for NEW_STATION James Prestwood
2023-02-24 18:51 ` [PATCH v2 2/2] ap: handle -ENOTSUP when getting the GTK James Prestwood
@ 2023-02-27 16:28 ` Denis Kenzior
1 sibling, 0 replies; 3+ messages in thread
From: Denis Kenzior @ 2023-02-27 16:28 UTC (permalink / raw)
To: James Prestwood, iwd
Hi James,
On 2/24/23 12:51, James Prestwood wrote:
> nl80211 has a check which returns -EINVAL for NEW_STATION if this
> feature is not enabled and the mask contains Authenticated/Associated
> flags.
> ---
> src/ap.c | 17 ++++++++++-------
> 1 file changed, 10 insertions(+), 7 deletions(-)
Both applied, thanks.
Regards,
-Denis
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-02-27 16:29 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-24 18:51 [PATCH v2 1/2] ap: check FULL_AP_CLIENT_STATE for NEW_STATION James Prestwood
2023-02-24 18:51 ` [PATCH v2 2/2] ap: handle -ENOTSUP when getting the GTK James Prestwood
2023-02-27 16:28 ` [PATCH v2 1/2] ap: check FULL_AP_CLIENT_STATE for NEW_STATION Denis Kenzior
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).