iwd.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] wiphy: add wiphy_supports_probe_resp_offload
@ 2022-09-28 19:48 James Prestwood
  2022-09-28 19:48 ` [PATCH 2/2] ap: include PROBE_RESP attribute if required by driver James Prestwood
  2022-09-28 21:24 ` [PATCH 1/2] wiphy: add wiphy_supports_probe_resp_offload Denis Kenzior
  0 siblings, 2 replies; 3+ messages in thread
From: James Prestwood @ 2022-09-28 19:48 UTC (permalink / raw)
  To: iwd; +Cc: James Prestwood

Parse the AP probe response offload attribute during the dump. If
set this indicates the driver expects the probe response attribute
to be included with START_AP.
---
 src/wiphy.c | 9 +++++++++
 src/wiphy.h | 1 +
 2 files changed, 10 insertions(+)

diff --git a/src/wiphy.c b/src/wiphy.c
index 28d4b66e..6fdd3df5 100644
--- a/src/wiphy.c
+++ b/src/wiphy.c
@@ -138,6 +138,7 @@ struct wiphy {
 	bool blacklisted : 1;
 	bool registered : 1;
 	bool self_managed : 1;
+	bool ap_probe_resp_offload : 1;
 };
 
 static struct l_queue *wiphy_list = NULL;
@@ -473,6 +474,11 @@ const struct scan_freq_set *wiphy_get_disabled_freqs(const struct wiphy *wiphy)
 	return wiphy->disabled_freqs;
 }
 
+bool wiphy_supports_probe_resp_offload(struct wiphy *wiphy)
+{
+	return wiphy->ap_probe_resp_offload;
+}
+
 bool wiphy_can_transition_disable(struct wiphy *wiphy)
 {
 	/*
@@ -1644,6 +1650,9 @@ static void wiphy_parse_attributes(struct wiphy *wiphy,
 		case NL80211_ATTR_WIPHY_SELF_MANAGED_REG:
 			wiphy->self_managed = true;
 			break;
+		case NL80211_ATTR_PROBE_RESP_OFFLOAD:
+			wiphy->ap_probe_resp_offload = true;
+			break;
 		}
 	}
 }
diff --git a/src/wiphy.h b/src/wiphy.h
index 9cd18451..2c6bf86b 100644
--- a/src/wiphy.h
+++ b/src/wiphy.h
@@ -97,6 +97,7 @@ uint32_t wiphy_get_supported_bands(struct wiphy *wiphy);
 const struct scan_freq_set *wiphy_get_supported_freqs(
 						const struct wiphy *wiphy);
 const struct scan_freq_set *wiphy_get_disabled_freqs(const struct wiphy *wiphy);
+bool wiphy_supports_probe_resp_offload(struct wiphy *wiphy);
 bool wiphy_can_transition_disable(struct wiphy *wiphy);
 bool wiphy_can_offload(struct wiphy *wiphy);
 bool wiphy_supports_cmds_auth_assoc(struct wiphy *wiphy);
-- 
2.34.3


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 2/2] ap: include PROBE_RESP attribute if required by driver
  2022-09-28 19:48 [PATCH 1/2] wiphy: add wiphy_supports_probe_resp_offload James Prestwood
@ 2022-09-28 19:48 ` James Prestwood
  2022-09-28 21:24 ` [PATCH 1/2] wiphy: add wiphy_supports_probe_resp_offload Denis Kenzior
  1 sibling, 0 replies; 3+ messages in thread
From: James Prestwood @ 2022-09-28 19:48 UTC (permalink / raw)
  To: iwd; +Cc: James Prestwood

Certain drivers support/require probe response offloading which
IWD did not check for or properly handle. If probe response
offloading is required the probe response frame watch will not
be added and instead the ATTR_PROBE_RESP will be included with
START_AP.

The head/tail builders were reused but slightly modified to check
if the probe request frame is NULL, since it will be for use with
START_AP.
---
 src/ap.c | 25 ++++++++++++++++++++++---
 1 file changed, 22 insertions(+), 3 deletions(-)

diff --git a/src/ap.c b/src/ap.c
index 8681189b..7140e823 100644
--- a/src/ap.c
+++ b/src/ap.c
@@ -699,7 +699,7 @@ static size_t ap_write_wsc_ie(struct ap_state *ap,
 	size_t len = 0;
 
 	/* WSC IE */
-	if (type == MPDU_MANAGEMENT_SUBTYPE_PROBE_RESPONSE) {
+	if (type == MPDU_MANAGEMENT_SUBTYPE_PROBE_RESPONSE && client_frame) {
 		const uint8_t *from = client_frame->address_2;
 		struct wsc_probe_response wsc_pr = {};
 		const struct mmpdu_probe_request *req =
@@ -2416,6 +2416,8 @@ static struct l_genl_msg *ap_build_cmd_start_ap(struct ap_state *ap)
 		0xff, 0xff, 0xff, 0xff, 0xff, 0xff
 	};
 
+	static const uint8_t zero_addr[6] = { 0 };
+
 	for (i = 0, nl_ciphers_cnt = 0; i < 8; i++)
 		if (ap->ciphers & (1 << i))
 			nl_ciphers[nl_ciphers_cnt++] =
@@ -2458,6 +2460,21 @@ static struct l_genl_msg *ap_build_cmd_start_ap(struct ap_state *ap)
 	l_genl_msg_append_attr(cmd, NL80211_ATTR_WIPHY_FREQ, 4, &ch_freq);
 	l_genl_msg_append_attr(cmd, NL80211_ATTR_CHANNEL_WIDTH, 4, &ch_width);
 
+	if (wiphy_supports_probe_resp_offload(wiphy)) {
+		uint8_t probe_resp[head_len + tail_len];
+		uint8_t *ptr = probe_resp;
+
+		ptr += ap_build_beacon_pr_head(ap,
+					MPDU_MANAGEMENT_SUBTYPE_PROBE_RESPONSE,
+					zero_addr, ptr, sizeof(probe_resp));
+		ptr += ap_build_beacon_pr_tail(ap,
+					MPDU_MANAGEMENT_SUBTYPE_PROBE_RESPONSE,
+					NULL, 0, ptr);
+
+		l_genl_msg_append_attr(cmd, NL80211_ATTR_PROBE_RESP,
+					ptr - probe_resp, probe_resp);
+	}
+
 	if (wiphy_has_ext_feature(wiphy,
 			NL80211_EXT_FEATURE_CONTROL_PORT_OVER_NL80211)) {
 		l_genl_msg_append_attr(cmd, NL80211_ATTR_SOCKET_OWNER, 0, NULL);
@@ -3321,10 +3338,12 @@ struct ap_state *ap_start(struct netdev *netdev, struct l_settings *config,
 			NULL, 0, ap_reassoc_req_cb, ap, NULL))
 		goto error;
 
-	if (!frame_watch_add(wdev_id, 0, 0x0000 |
+	if (!wiphy_supports_probe_resp_offload(wiphy)) {
+		if (!frame_watch_add(wdev_id, 0, 0x0000 |
 				(MPDU_MANAGEMENT_SUBTYPE_PROBE_REQUEST << 4),
 				NULL, 0, ap_probe_req_cb, ap, NULL))
-		goto error;
+			goto error;
+	}
 
 	if (!frame_watch_add(wdev_id, 0, 0x0000 |
 				(MPDU_MANAGEMENT_SUBTYPE_DISASSOCIATION << 4),
-- 
2.34.3


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/2] wiphy: add wiphy_supports_probe_resp_offload
  2022-09-28 19:48 [PATCH 1/2] wiphy: add wiphy_supports_probe_resp_offload James Prestwood
  2022-09-28 19:48 ` [PATCH 2/2] ap: include PROBE_RESP attribute if required by driver James Prestwood
@ 2022-09-28 21:24 ` Denis Kenzior
  1 sibling, 0 replies; 3+ messages in thread
From: Denis Kenzior @ 2022-09-28 21:24 UTC (permalink / raw)
  To: James Prestwood, iwd

Hi James,

On 9/28/22 14:48, James Prestwood wrote:
> Parse the AP probe response offload attribute during the dump. If
> set this indicates the driver expects the probe response attribute
> to be included with START_AP.
> ---
>   src/wiphy.c | 9 +++++++++
>   src/wiphy.h | 1 +
>   2 files changed, 10 insertions(+)
> 

Both applied, thanks.

Regards,
-Denis


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-09-28 21:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-28 19:48 [PATCH 1/2] wiphy: add wiphy_supports_probe_resp_offload James Prestwood
2022-09-28 19:48 ` [PATCH 2/2] ap: include PROBE_RESP attribute if required by driver James Prestwood
2022-09-28 21:24 ` [PATCH 1/2] wiphy: add wiphy_supports_probe_resp_offload 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).