Wireless Daemon for Linux
 help / color / mirror / Atom feed
From: Andrew Zaborowski <andrew.zaborowski@intel.com>
To: iwd@lists.01.org
Subject: [PATCH 10/18] p2putil: Add WFD IEs when building P2P Action frames
Date: Sat, 11 Jul 2020 03:00:45 +0200	[thread overview]
Message-ID: <20200711010053.224223-10-andrew.zaborowski@intel.com> (raw)
In-Reply-To: <20200711010053.224223-1-andrew.zaborowski@intel.com>

[-- Attachment #1: Type: text/plain, Size: 5025 bytes --]

---
 src/p2putil.c | 36 +++++++++++++++++++++---------------
 1 file changed, 21 insertions(+), 15 deletions(-)

diff --git a/src/p2putil.c b/src/p2putil.c
index d581a2a3..d0f3a444 100644
--- a/src/p2putil.c
+++ b/src/p2putil.c
@@ -2238,7 +2238,8 @@ static uint8_t *p2p_build_action_frame(bool public, uint8_t frame_subtype,
 					uint8_t dialog_token,
 					struct p2p_attr_builder *p2p_attrs,
 					const struct wsc_p2p_attrs *wsc_attrs,
-					size_t *out_len)
+					const uint8_t *wfd_ie,
+					size_t wfd_ie_len, size_t *out_len)
 {
 	uint8_t *p2p_ie, *wsc_ie, *ret;
 	size_t p2p_ie_len, wsc_ie_len;
@@ -2267,7 +2268,7 @@ static uint8_t *p2p_build_action_frame(bool public, uint8_t frame_subtype,
 		wsc_ie = NULL;
 
 	*out_len = (public ? 8 : 7) + (p2p_ie ? p2p_ie_len : 0) +
-		(wsc_ie ? wsc_ie_len : 0);
+		(wsc_ie ? wsc_ie_len : 0) + (wfd_ie ? wfd_ie_len : 0);
 	ret = l_malloc(*out_len);
 
 	if (public) {
@@ -2292,8 +2293,12 @@ static uint8_t *p2p_build_action_frame(bool public, uint8_t frame_subtype,
 	if (wsc_ie) {
 		memcpy(ret + pos, wsc_ie, wsc_ie_len);
 		l_free(wsc_ie);
+		pos += wsc_ie_len;
 	}
 
+	if (wfd_ie)
+		memcpy(ret + pos, wfd_ie, wfd_ie_len);
+
 	return ret;
 }
 
@@ -2323,7 +2328,7 @@ uint8_t *p2p_build_go_negotiation_req(const struct p2p_go_negotiation_req *data,
 
 	return p2p_build_action_frame(true, P2P_ACTION_GO_NEGOTIATION_REQ,
 					data->dialog_token, builder, &wsc_attrs,
-					out_len);
+					data->wfd, data->wfd_size, out_len);
 }
 
 /* Section 4.2.9.3 */
@@ -2353,7 +2358,7 @@ uint8_t *p2p_build_go_negotiation_resp(
 
 	return p2p_build_action_frame(true, P2P_ACTION_GO_NEGOTIATION_RESP,
 					data->dialog_token, builder, &wsc_attrs,
-					out_len);
+					data->wfd, data->wfd_size, out_len);
 }
 
 /* Section 4.2.9.4 */
@@ -2374,7 +2379,7 @@ uint8_t *p2p_build_go_negotiation_confirmation(
 
 	return p2p_build_action_frame(true, P2P_ACTION_GO_NEGOTIATION_CONFIRM,
 					data->dialog_token, builder, NULL,
-					out_len);
+					data->wfd, data->wfd_size, out_len);
 }
 
 /* Section 4.2.9.5 */
@@ -2404,7 +2409,8 @@ uint8_t *p2p_build_invitation_req(const struct p2p_invitation_req *data,
 	return p2p_build_action_frame(true, P2P_ACTION_INVITATION_REQ,
 					data->dialog_token, builder,
 					data->device_password_id ?
-					&wsc_attrs : NULL, out_len);
+					&wsc_attrs : NULL,
+					data->wfd, data->wfd_size, out_len);
 }
 
 /* Section 4.2.9.6 */
@@ -2428,7 +2434,7 @@ uint8_t *p2p_build_invitation_resp(const struct p2p_invitation_resp *data,
 
 	return p2p_build_action_frame(true, P2P_ACTION_INVITATION_RESP,
 					data->dialog_token, builder, NULL,
-					out_len);
+					data->wfd, data->wfd_size, out_len);
 }
 
 /* Section 4.2.9.7 */
@@ -2447,7 +2453,7 @@ uint8_t *p2p_build_device_disc_req(
 	return p2p_build_action_frame(true,
 					P2P_ACTION_DEVICE_DISCOVERABILITY_REQ,
 					data->dialog_token, builder, NULL,
-					out_len);
+					NULL, 0, out_len);
 }
 
 /* Section 4.2.9.8 */
@@ -2463,7 +2469,7 @@ uint8_t *p2p_build_device_disc_resp(
 	return p2p_build_action_frame(true,
 					P2P_ACTION_DEVICE_DISCOVERABILITY_RESP,
 					data->dialog_token, builder, NULL,
-					out_len);
+					NULL, 0, out_len);
 }
 
 /* Section 4.2.9.9 */
@@ -2507,7 +2513,7 @@ uint8_t *p2p_build_provision_disc_req(
 
 	return p2p_build_action_frame(true, P2P_ACTION_PROVISION_DISCOVERY_REQ,
 					data->dialog_token, builder, &wsc_attrs,
-					out_len);
+					data->wfd, data->wfd_size, out_len);
 }
 
 /* Section 4.2.9.10 */
@@ -2553,7 +2559,7 @@ uint8_t *p2p_build_provision_disc_resp(
 
 	return p2p_build_action_frame(true, P2P_ACTION_PROVISION_DISCOVERY_RESP,
 					data->dialog_token, builder, &wsc_attrs,
-					out_len);
+					data->wfd, data->wfd_size, out_len);
 }
 
 /* Section 4.2.10.2 */
@@ -2567,7 +2573,7 @@ uint8_t *p2p_build_notice_of_absence(const struct p2p_notice_of_absence *data,
 						&data->notice_of_absence);
 
 	return p2p_build_action_frame(false, P2P_ACTION_NOTICE_OF_ABSENCE,
-					0, builder, NULL, out_len);
+					0, builder, NULL, NULL, 0, out_len);
 }
 
 /* Section 4.2.10.3 */
@@ -2581,7 +2587,7 @@ uint8_t *p2p_build_presence_req(const struct p2p_presence_req *data,
 						&data->notice_of_absence);
 
 	return p2p_build_action_frame(false, P2P_ACTION_PRESENCE_REQ,
-					0, builder, NULL, out_len);
+					0, builder, NULL, NULL, 0, out_len);
 }
 
 /* Section 4.2.10.4 */
@@ -2596,12 +2602,12 @@ uint8_t *p2p_build_presence_resp(const struct p2p_presence_resp *data,
 						&data->notice_of_absence);
 
 	return p2p_build_action_frame(false, P2P_ACTION_PRESENCE_RESP,
-					0, builder, NULL, out_len);
+					0, builder, NULL, NULL, 0, out_len);
 }
 
 /* Section 4.2.10.5 */
 uint8_t *p2p_build_go_disc_req(size_t *out_len)
 {
 	return p2p_build_action_frame(false, P2P_ACTION_GO_DISCOVERABILITY_REQ,
-					0, NULL, NULL, out_len);
+					0, NULL, NULL, NULL, 0, out_len);
 }
-- 
2.25.1

  parent reply	other threads:[~2020-07-11  1:00 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-11  1:00 [PATCH 01/18] p2p: Stop discovery after GO Negotiation Req error Andrew Zaborowski
2020-07-11  1:00 ` [PATCH 02/18] p2p: Update peer->device_addr when updating peer->bss Andrew Zaborowski
2020-07-11  1:00 ` [PATCH 03/18] p2p: Initialize dev->discovery_users in p2p_device_request_discovery Andrew Zaborowski
2020-07-11  1:00 ` [PATCH 04/18] p2p: Use nl80211_parse_attrs Andrew Zaborowski
2020-07-11  1:00 ` [PATCH 05/18] p2p: Implement the Peer.Device property Andrew Zaborowski
2020-07-11  1:00 ` [PATCH 06/18] man iwd.debug: Document IWD_GENL_DEBUG Andrew Zaborowski
2020-07-11  1:00 ` [PATCH 07/18] test: Set WSC.PushButton call timeout to 120s Andrew Zaborowski
2020-07-11  1:00 ` [PATCH 08/18] scan: Extract WFD IE payload into struct bss Andrew Zaborowski
2020-07-11  1:00 ` [PATCH 09/18] p2putil: Extract WFD IE payloads from P2P Action frames Andrew Zaborowski
2020-07-11  1:00 ` Andrew Zaborowski [this message]
2020-07-11  1:00 ` [PATCH 11/18] p2p: Implement the p2p.ServiceManager interface Andrew Zaborowski
2020-07-13 19:47   ` Denis Kenzior
2020-07-15 14:25     ` Andrew Zaborowski
2020-07-11  1:00 ` [PATCH 12/18] p2p: Add the p2p.Display interface on WFD-capable peers Andrew Zaborowski
2020-07-11  1:00 ` [PATCH 13/18] p2p: Add WFD IEs in GO Negotiation and association Andrew Zaborowski
2020-07-11  1:00 ` [PATCH 14/18] doc: Wi-Fi Display DBus API doc Andrew Zaborowski
2020-07-13 19:51   ` Denis Kenzior
2020-07-11  1:00 ` [PATCH 15/18] netconfig: Implement netconfig_get_dhcp_server_ipv4 Andrew Zaborowski
2020-07-13 19:53   ` Denis Kenzior
2020-07-11  1:00 ` [PATCH 16/18] p2p: Add ConnectedInterface and ConnectedIP Peer properties Andrew Zaborowski
2020-07-13 19:54   ` Denis Kenzior
2020-07-11  1:00 ` [PATCH 17/18] doc: Document Peer.ConnectedInterface and ConnectedIP Andrew Zaborowski
2020-07-11  1:00 ` [PATCH 18/18] test: Add a sample Wi-Fi Display source app Andrew Zaborowski
2020-07-13 19:25 ` [PATCH 01/18] p2p: Stop discovery after GO Negotiation Req error Denis Kenzior

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200711010053.224223-10-andrew.zaborowski@intel.com \
    --to=andrew.zaborowski@intel.com \
    --cc=iwd@lists.01.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox