P2PS: Add CPT parameter to P2PS_PROVISION and P2PS_PROVISION_RESP

Add a parameter allowing to specify a value of Coordination
Protocol Transport to P2PS_PROVISION and P2PS_PROVISION_RESP commands.

Extend the p2ps_provision structure to contain cpt_priority and
cpt_mask properties and initialize them on a P2PS PD request command.

The format of the parameter:
    cpt=<cpt>[:cpt]

where <cpt> is CPT name e.g. UDP or MAC. The CPT names are listed
according to their preferences to be used for a specific P2PS session.

Signed-off-by: Max Stepanov <Max.Stepanov@intel.com>
Reviewed-by: Andrei Otcheretianski <andrei.otcheretianski@intel.com>
Reviewed-by: Ilan Peer <ilan.peer@intel.com>
This commit is contained in:
Max Stepanov 2015-07-02 16:21:21 +03:00 committed by Jouni Malinen
parent e2b7fbf2fb
commit 0670de74ae
2 changed files with 30 additions and 0 deletions

View file

@ -196,6 +196,23 @@ struct p2ps_provision {
*/
u8 adv_mac[ETH_ALEN];
/**
* cpt_mask - Supported Coordination Protocol Transport mask
*
* A bitwise mask of supported ASP Coordination Protocol Transports.
* This property is set together and corresponds with cpt_priority.
*/
u8 cpt_mask;
/**
* cpt_priority - Coordination Protocol Transport priority list
*
* Priorities of supported ASP Coordination Protocol Transports.
* This property is set together and corresponds with cpt_mask.
* The CPT priority list is 0 terminated.
*/
u8 cpt_priority[P2PS_FEATURE_CAPAB_CPT_MAX + 1];
/**
* info - Vendor defined extra Provisioning information
*/

View file

@ -4702,6 +4702,7 @@ static struct p2ps_provision * p2p_parse_asp_provision_cmd(const char *cmd)
char *info = NULL;
u8 role = P2PS_SETUP_NONE;
long long unsigned val;
int i;
pos = os_strstr(cmd, "info=");
if (pos) {
@ -4760,6 +4761,18 @@ static struct p2ps_provision * p2p_parse_asp_provision_cmd(const char *cmd)
if (!pos || hwaddr_aton(pos + 12, p2ps_prov->session_mac))
goto invalid_args;
pos = os_strstr(cmd, "cpt=");
if (pos) {
if (p2ps_ctrl_parse_cpt_priority(pos + 4,
p2ps_prov->cpt_priority))
goto invalid_args;
} else {
p2ps_prov->cpt_priority[0] = P2PS_FEATURE_CAPAB_UDP_TRANSPORT;
}
for (i = 0; p2ps_prov->cpt_priority[i]; i++)
p2ps_prov->cpt_mask |= p2ps_prov->cpt_priority[i];
/* force conncap with tstCap (no sanity checks) */
pos = os_strstr(cmd, "tstCap=");
if (pos) {