From: Andrew Zaborowski <andrew.zaborowski@intel.com>
To: iwd@lists.01.org
Subject: [PATCH 09/18] p2putil: Extract WFD IE payloads from P2P Action frames
Date: Sat, 11 Jul 2020 03:00:44 +0200 [thread overview]
Message-ID: <20200711010053.224223-9-andrew.zaborowski@intel.com> (raw)
In-Reply-To: <20200711010053.224223-1-andrew.zaborowski@intel.com>
[-- Attachment #1: Type: text/plain, Size: 7062 bytes --]
---
src/p2putil.c | 75 ++++++++++++++++++++++++++++++++++++---------------
src/p2putil.h | 14 ++++++++++
2 files changed, 68 insertions(+), 21 deletions(-)
diff --git a/src/p2putil.c b/src/p2putil.c
index ef69f88d..d581a2a3 100644
--- a/src/p2putil.c
+++ b/src/p2putil.c
@@ -984,6 +984,8 @@ int p2p_parse_go_negotiation_req(const uint8_t *pdu, size_t len,
d.go_intent = go_intent.intent;
d.go_tie_breaker = go_intent.tie_breaker;
+ d.wfd = ie_tlv_extract_wfd_payload(pdu + 1, len - 1, &d.wfd_size);
+
memcpy(out, &d, sizeof(d));
return 0;
@@ -1043,6 +1045,8 @@ int p2p_parse_go_negotiation_resp(const uint8_t *pdu, size_t len,
d.go_intent = go_intent.intent;
d.go_tie_breaker = go_intent.tie_breaker;
+ d.wfd = ie_tlv_extract_wfd_payload(pdu + 1, len - 1, &d.wfd_size);
+
memcpy(out, &d, sizeof(d));
return 0;
@@ -1072,12 +1076,16 @@ int p2p_parse_go_negotiation_confirmation(const uint8_t *pdu, size_t len,
REQUIRED(CHANNEL_LIST, &d.channel_list),
OPTIONAL(P2P_GROUP_ID, &d.group_id),
-1);
+ if (r < 0)
+ goto error;
- if (r >= 0)
- memcpy(out, &d, sizeof(d));
- else
- p2p_clear_go_negotiation_confirmation(&d);
+ d.wfd = ie_tlv_extract_wfd_payload(pdu + 1, len - 1, &d.wfd_size);
+
+ memcpy(out, &d, sizeof(d));
+ return 0;
+error:
+ p2p_clear_go_negotiation_confirmation(&d);
return r;
}
@@ -1109,27 +1117,30 @@ int p2p_parse_invitation_req(const uint8_t *pdu, size_t len,
REQUIRED(P2P_DEVICE_INFO, &d.device_info),
-1);
if (r < 0)
- goto done;
+ goto error;
/* A WSC IE is optional */
wsc_data = ie_tlv_extract_wsc_payload(pdu + 1, len - 1, &wsc_len);
- if (!wsc_data)
- goto done;
-
- r = wsc_parse_attrs(wsc_data, wsc_len, &wsc_version2, NULL, 0, NULL,
+ if (wsc_data) {
+ r = wsc_parse_attrs(
+ wsc_data, wsc_len, &wsc_version2, NULL, 0, NULL,
WSC_REQUIRED(DEVICE_PASSWORD_ID, &d.device_password_id),
WSC_ATTR_INVALID);
- l_free(wsc_data);
+ l_free(wsc_data);
- if (r >= 0 && !wsc_version2)
- r = -EINVAL;
+ if (r >= 0 && !wsc_version2) {
+ r = -EINVAL;
+ goto error;
+ }
+ }
-done:
- if (r >= 0)
- memcpy(out, &d, sizeof(d));
- else
- p2p_clear_invitation_req(&d);
+ d.wfd = ie_tlv_extract_wfd_payload(pdu + 1, len - 1, &d.wfd_size);
+ memcpy(out, &d, sizeof(d));
+ return 0;
+
+error:
+ p2p_clear_invitation_req(&d);
return r;
}
@@ -1154,12 +1165,16 @@ int p2p_parse_invitation_resp(const uint8_t *pdu, size_t len,
OPTIONAL(P2P_GROUP_BSSID, &d.group_bssid),
OPTIONAL(CHANNEL_LIST, &d.channel_list),
-1);
+ if (r < 0)
+ goto error;
- if (r >= 0)
- memcpy(out, &d, sizeof(d));
- else
- p2p_clear_invitation_resp(&d);
+ d.wfd = ie_tlv_extract_wfd_payload(pdu + 1, len - 1, &d.wfd_size);
+ memcpy(out, &d, sizeof(d));
+ return 0;
+
+error:
+ p2p_clear_invitation_resp(&d);
return r;
}
@@ -1277,6 +1292,8 @@ int p2p_parse_provision_disc_req(const uint8_t *pdu, size_t len,
goto error;
}
+ d.wfd = ie_tlv_extract_wfd_payload(pdu + 1, len - 1, &d.wfd_size);
+
memcpy(out, &d, sizeof(d));
return 0;
@@ -1355,6 +1372,8 @@ int p2p_parse_provision_disc_resp(const uint8_t *pdu, size_t len,
goto error;
}
+ d.wfd = ie_tlv_extract_wfd_payload(pdu + 1, len - 1, &d.wfd_size);
+
memcpy(out, &d, sizeof(d));
return 0;
@@ -1523,41 +1542,55 @@ void p2p_clear_go_negotiation_req(struct p2p_go_negotiation_req *data)
{
p2p_clear_channel_list_attr(&data->channel_list);
p2p_clear_device_info_attr(&data->device_info);
+ l_free(data->wfd);
+ data->wfd = NULL;
}
void p2p_clear_go_negotiation_resp(struct p2p_go_negotiation_resp *data)
{
p2p_clear_channel_list_attr(&data->channel_list);
p2p_clear_device_info_attr(&data->device_info);
+ l_free(data->wfd);
+ data->wfd = NULL;
}
void p2p_clear_go_negotiation_confirmation(
struct p2p_go_negotiation_confirmation *data)
{
p2p_clear_channel_list_attr(&data->channel_list);
+ l_free(data->wfd);
+ data->wfd = NULL;
}
void p2p_clear_invitation_req(struct p2p_invitation_req *data)
{
p2p_clear_channel_list_attr(&data->channel_list);
p2p_clear_device_info_attr(&data->device_info);
+ l_free(data->wfd);
+ data->wfd = NULL;
}
void p2p_clear_invitation_resp(struct p2p_invitation_resp *data)
{
p2p_clear_channel_list_attr(&data->channel_list);
+ l_free(data->wfd);
+ data->wfd = NULL;
}
void p2p_clear_provision_disc_req(struct p2p_provision_discovery_req *data)
{
p2p_clear_channel_list_attr(&data->channel_list);
p2p_clear_device_info_attr(&data->device_info);
+ l_free(data->wfd);
+ data->wfd = NULL;
}
void p2p_clear_provision_disc_resp(struct p2p_provision_discovery_resp *data)
{
p2p_clear_channel_list_attr(&data->channel_list);
p2p_clear_device_info_attr(&data->device_info);
+ l_free(data->wfd);
+ data->wfd = NULL;
}
void p2p_clear_notice_of_absence(struct p2p_notice_of_absence *data)
diff --git a/src/p2putil.h b/src/p2putil.h
index c609ab16..6aad5574 100644
--- a/src/p2putil.h
+++ b/src/p2putil.h
@@ -377,6 +377,8 @@ struct p2p_go_negotiation_req {
struct p2p_device_info_attr device_info;
struct p2p_channel_attr operating_channel;
enum wsc_device_password_id device_password_id;
+ uint8_t *wfd;
+ ssize_t wfd_size;
};
struct p2p_go_negotiation_resp {
@@ -392,6 +394,8 @@ struct p2p_go_negotiation_resp {
struct p2p_device_info_attr device_info;
struct p2p_group_id_attr group_id;
enum wsc_device_password_id device_password_id;
+ uint8_t *wfd;
+ ssize_t wfd_size;
};
struct p2p_go_negotiation_confirmation {
@@ -401,6 +405,8 @@ struct p2p_go_negotiation_confirmation {
struct p2p_channel_attr operating_channel;
struct p2p_channel_list_attr channel_list;
struct p2p_group_id_attr group_id;
+ uint8_t *wfd;
+ ssize_t wfd_size;
};
struct p2p_invitation_req {
@@ -413,6 +419,8 @@ struct p2p_invitation_req {
struct p2p_group_id_attr group_id;
struct p2p_device_info_attr device_info;
enum wsc_device_password_id device_password_id;
+ uint8_t *wfd;
+ ssize_t wfd_size;
};
struct p2p_invitation_resp {
@@ -422,6 +430,8 @@ struct p2p_invitation_resp {
struct p2p_channel_attr operating_channel;
uint8_t group_bssid[6];
struct p2p_channel_list_attr channel_list;
+ uint8_t *wfd;
+ ssize_t wfd_size;
};
struct p2p_device_discoverability_req {
@@ -453,6 +463,8 @@ struct p2p_provision_discovery_req {
enum p2p_asp_coordination_transport_protocol transport_protocol;
struct p2p_group_id_attr persistent_group_info;
uint16_t wsc_config_method;
+ uint8_t *wfd;
+ ssize_t wfd_size;
};
struct p2p_provision_discovery_resp {
@@ -472,6 +484,8 @@ struct p2p_provision_discovery_resp {
struct p2p_group_id_attr persistent_group_info;
struct p2p_session_info_data_attr session_info;
uint16_t wsc_config_method;
+ uint8_t *wfd;
+ ssize_t wfd_size;
};
struct p2p_notice_of_absence {
--
2.25.1
next prev 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 ` Andrew Zaborowski [this message]
2020-07-11 1:00 ` [PATCH 10/18] p2putil: Add WFD IEs when building P2P Action frames Andrew Zaborowski
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-9-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