P2P: Clean up debug prints

Replace direct wpa_msg() calls with p2p_dbg(), p2p_info(), and p2p_err()
calls that use a new debug_print() callback to handle actual debug
printing outside the P2P module.

Signed-hostap: Jouni Malinen <j@w1.fi>
This commit is contained in:
Jouni Malinen 2013-05-18 18:47:36 +03:00
parent 710ae9ac1f
commit ed496f131f
11 changed files with 567 additions and 984 deletions

View File

@ -3195,6 +3195,12 @@ static void test_prov_disc_resp(void *ctx, const u8 *peer, u16 config_methods)
/* TODO */
}
static void test_p2p_debug_print(void *ctx, int level, const char *msg)
{
wpa_printf(level, "P2P: %s", msg);
}
#endif /* CONFIG_P2P */
@ -3206,8 +3212,8 @@ static int wpa_driver_test_init_p2p(struct wpa_driver_test_data *drv)
int i;
os_memset(&p2p, 0, sizeof(p2p));
p2p.msg_ctx = drv->ctx;
p2p.cb_ctx = drv;
p2p.debug_print = test_p2p_debug_print;
p2p.p2p_scan = test_p2p_scan;
p2p.send_action = test_send_action;
p2p.send_action_done = test_send_action_done;

File diff suppressed because it is too large Load Diff

View File

@ -370,16 +370,19 @@ struct p2p_config {
*/
unsigned int max_listen;
/**
* msg_ctx - Context to use with wpa_msg() calls
*/
void *msg_ctx;
/**
* cb_ctx - Context to use with callback functions
*/
void *cb_ctx;
/**
* debug_print - Debug print
* @ctx: Callback context from cb_ctx
* @level: Debug verbosity level (MSG_*)
* @msg: Debug message
*/
void (*debug_print)(void *ctx, int level, const char *msg);
/* Callbacks to request lower layer driver operations */

View File

@ -42,8 +42,7 @@ static struct wpabuf * p2p_build_dev_disc_req(struct p2p_data *p2p,
void p2p_dev_disc_req_cb(struct p2p_data *p2p, int success)
{
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: Device Discoverability Request TX callback: success=%d",
p2p_dbg(p2p, "Device Discoverability Request TX callback: success=%d",
success);
if (!success) {
@ -56,9 +55,7 @@ void p2p_dev_disc_req_cb(struct p2p_data *p2p, int success)
return;
}
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: GO acknowledged Device Discoverability Request - wait "
"for response");
p2p_dbg(p2p, "GO acknowledged Device Discoverability Request - wait for response");
/*
* TODO: is the remain-on-channel from Action frame TX long enough for
* most cases or should we try to increase its duration and/or start
@ -74,9 +71,7 @@ int p2p_send_dev_disc_req(struct p2p_data *p2p, struct p2p_device *dev)
go = p2p_get_device(p2p, dev->member_in_go_dev);
if (go == NULL || dev->oper_freq <= 0) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: Could not find peer entry for GO and frequency "
"to send Device Discoverability Request");
p2p_dbg(p2p, "Could not find peer entry for GO and frequency to send Device Discoverability Request");
return -1;
}
@ -84,8 +79,7 @@ int p2p_send_dev_disc_req(struct p2p_data *p2p, struct p2p_device *dev)
if (req == NULL)
return -1;
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: Sending Device Discoverability Request to GO " MACSTR
p2p_dbg(p2p, "Sending Device Discoverability Request to GO " MACSTR
" for client " MACSTR,
MAC2STR(go->info.p2p_device_addr),
MAC2STR(dev->info.p2p_device_addr));
@ -97,8 +91,7 @@ int p2p_send_dev_disc_req(struct p2p_data *p2p, struct p2p_device *dev)
if (p2p_send_action(p2p, dev->oper_freq, go->info.p2p_device_addr,
p2p->cfg->dev_addr, go->info.p2p_device_addr,
wpabuf_head(req), wpabuf_len(req), 1000) < 0) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: Failed to send Action frame");
p2p_dbg(p2p, "Failed to send Action frame");
wpabuf_free(req);
/* TODO: how to recover from failure? */
return -1;
@ -131,8 +124,7 @@ static struct wpabuf * p2p_build_dev_disc_resp(u8 dialog_token, u8 status)
void p2p_dev_disc_resp_cb(struct p2p_data *p2p, int success)
{
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: Device Discoverability Response TX callback: success=%d",
p2p_dbg(p2p, "Device Discoverability Response TX callback: success=%d",
success);
p2p->cfg->send_action_done(p2p->cfg->cb_ctx);
}
@ -147,8 +139,7 @@ static void p2p_send_dev_disc_resp(struct p2p_data *p2p, u8 dialog_token,
if (resp == NULL)
return;
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: Sending Device Discoverability Response to " MACSTR
p2p_dbg(p2p, "Sending Device Discoverability Response to " MACSTR
" (status %u freq %d)",
MAC2STR(addr), status, freq);
@ -156,8 +147,7 @@ static void p2p_send_dev_disc_resp(struct p2p_data *p2p, u8 dialog_token,
if (p2p_send_action(p2p, freq, addr, p2p->cfg->dev_addr,
p2p->cfg->dev_addr,
wpabuf_head(resp), wpabuf_len(resp), 200) < 0) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: Failed to send Action frame");
p2p_dbg(p2p, "Failed to send Action frame");
}
wpabuf_free(resp);
@ -170,17 +160,14 @@ void p2p_process_dev_disc_req(struct p2p_data *p2p, const u8 *sa,
struct p2p_message msg;
size_t g;
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: Received Device Discoverability Request from " MACSTR
p2p_dbg(p2p, "Received Device Discoverability Request from " MACSTR
" (freq=%d)", MAC2STR(sa), rx_freq);
if (p2p_parse(data, len, &msg))
return;
if (msg.dialog_token == 0) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: Invalid Dialog Token 0 (must be nonzero) in "
"Device Discoverability Request");
p2p_dbg(p2p, "Invalid Dialog Token 0 (must be nonzero) in Device Discoverability Request");
p2p_send_dev_disc_resp(p2p, msg.dialog_token, sa, rx_freq,
P2P_SC_FAIL_INVALID_PARAMS);
p2p_parse_free(&msg);
@ -188,9 +175,7 @@ void p2p_process_dev_disc_req(struct p2p_data *p2p, const u8 *sa,
}
if (msg.device_id == NULL) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: P2P Device ID attribute missing from Device "
"Discoverability Request");
p2p_dbg(p2p, "P2P Device ID attribute missing from Device Discoverability Request");
p2p_send_dev_disc_resp(p2p, msg.dialog_token, sa, rx_freq,
P2P_SC_FAIL_INVALID_PARAMS);
p2p_parse_free(&msg);
@ -200,9 +185,7 @@ void p2p_process_dev_disc_req(struct p2p_data *p2p, const u8 *sa,
for (g = 0; g < p2p->num_groups; g++) {
if (p2p_group_go_discover(p2p->groups[g], msg.device_id, sa,
rx_freq) == 0) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG, "P2P: Scheduled "
"GO Discoverability Request for the target "
"device");
p2p_dbg(p2p, "Scheduled GO Discoverability Request for the target device");
/*
* P2P group code will use a callback to indicate TX
* status, so that we can reply to the request once the
@ -217,9 +200,7 @@ void p2p_process_dev_disc_req(struct p2p_data *p2p, const u8 *sa,
}
}
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG, "P2P: Requested client "
"was not found in any group or did not support client "
"discoverability");
p2p_dbg(p2p, "Requested client was not found in any group or did not support client discoverability");
p2p_send_dev_disc_resp(p2p, msg.dialog_token, sa, rx_freq,
P2P_SC_FAIL_UNABLE_TO_ACCOMMODATE);
p2p_parse_free(&msg);
@ -233,15 +214,13 @@ void p2p_process_dev_disc_resp(struct p2p_data *p2p, const u8 *sa,
struct p2p_device *go;
u8 status;
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: Received Device Discoverability Response from " MACSTR,
p2p_dbg(p2p, "Received Device Discoverability Response from " MACSTR,
MAC2STR(sa));
go = p2p->pending_client_disc_go;
if (go == NULL ||
os_memcmp(sa, go->info.p2p_device_addr, ETH_ALEN) != 0) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG, "P2P: Ignore unexpected "
"Device Discoverability Response");
p2p_dbg(p2p, "Ignore unexpected Device Discoverability Response");
return;
}
@ -254,9 +233,7 @@ void p2p_process_dev_disc_resp(struct p2p_data *p2p, const u8 *sa,
}
if (msg.dialog_token != go->dialog_token) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG, "P2P: Ignore Device "
"Discoverability Response with unexpected dialog "
"token %u (expected %u)",
p2p_dbg(p2p, "Ignore Device Discoverability Response with unexpected dialog token %u (expected %u)",
msg.dialog_token, go->dialog_token);
p2p_parse_free(&msg);
return;
@ -265,17 +242,14 @@ void p2p_process_dev_disc_resp(struct p2p_data *p2p, const u8 *sa,
status = *msg.status;
p2p_parse_free(&msg);
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: Device Discoverability Response status %u", status);
p2p_dbg(p2p, "Device Discoverability Response status %u", status);
if (p2p->go_neg_peer == NULL ||
os_memcmp(p2p->pending_client_disc_addr,
p2p->go_neg_peer->info.p2p_device_addr, ETH_ALEN) != 0 ||
os_memcmp(p2p->go_neg_peer->member_in_go_dev,
go->info.p2p_device_addr, ETH_ALEN) != 0) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG, "P2P: No pending "
"operation with the client discoverability peer "
"anymore");
p2p_dbg(p2p, "No pending operation with the client discoverability peer anymore");
return;
}
@ -284,8 +258,7 @@ void p2p_process_dev_disc_resp(struct p2p_data *p2p, const u8 *sa,
* Peer is expected to be awake for at least 100 TU; try to
* connect immediately.
*/
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: Client discoverability request succeeded");
p2p_dbg(p2p, "Client discoverability request succeeded");
if (p2p->state == P2P_CONNECT) {
/*
* Change state to force the timeout to start in
@ -301,8 +274,7 @@ void p2p_process_dev_disc_resp(struct p2p_data *p2p, const u8 *sa,
* Client discoverability request failed; try to connect from
* timeout.
*/
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: Client discoverability request failed");
p2p_dbg(p2p, "Client discoverability request failed");
p2p_set_timeout(p2p, 0, 500000);
}
@ -311,14 +283,12 @@ void p2p_process_dev_disc_resp(struct p2p_data *p2p, const u8 *sa,
void p2p_go_disc_req_cb(struct p2p_data *p2p, int success)
{
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: GO Discoverability Request TX callback: success=%d",
p2p_dbg(p2p, "GO Discoverability Request TX callback: success=%d",
success);
p2p->cfg->send_action_done(p2p->cfg->cb_ctx);
if (p2p->pending_dev_disc_dialog_token == 0) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG, "P2P: No pending Device "
"Discoverability Request");
p2p_dbg(p2p, "No pending Device Discoverability Request");
return;
}
@ -338,9 +308,7 @@ void p2p_process_go_disc_req(struct p2p_data *p2p, const u8 *da, const u8 *sa,
unsigned int tu;
struct wpabuf *ies;
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: Received GO Discoverability Request - remain awake for "
"100 TU");
p2p_dbg(p2p, "Received GO Discoverability Request - remain awake for 100 TU");
ies = p2p_build_probe_resp_ies(p2p);
if (ies == NULL)
@ -351,9 +319,7 @@ void p2p_process_go_disc_req(struct p2p_data *p2p, const u8 *da, const u8 *sa,
tu = 100;
if (p2p->cfg->start_listen(p2p->cfg->cb_ctx, rx_freq, 1024 * tu / 1000,
ies) < 0) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: Failed to start listen mode for client "
"discoverability");
p2p_dbg(p2p, "Failed to start listen mode for client discoverability");
}
wpabuf_free(ies);
}

View File

@ -49,8 +49,7 @@ int p2p_peer_channels_check(struct p2p_data *p2p, struct p2p_channels *own,
os_memcpy(dev->country, pos, 3);
wpa_hexdump_ascii(MSG_DEBUG, "P2P: Peer country", pos, 3);
if (pos[2] != 0x04 && os_memcmp(pos, p2p->cfg->country, 2) != 0) {
wpa_msg(p2p->cfg->msg_ctx, MSG_INFO,
"P2P: Mismatching country (ours=%c%c peer's=%c%c)",
p2p_info(p2p, "Mismatching country (ours=%c%c peer's=%c%c)",
p2p->cfg->country[0], p2p->cfg->country[1],
pos[0], pos[1]);
return -1;
@ -61,8 +60,7 @@ int p2p_peer_channels_check(struct p2p_data *p2p, struct p2p_channels *own,
struct p2p_reg_class *cl = &ch->reg_class[ch->reg_classes];
cl->reg_class = *pos++;
if (pos + 1 + pos[0] > end) {
wpa_msg(p2p->cfg->msg_ctx, MSG_INFO,
"P2P: Invalid peer Channel List");
p2p_info(p2p, "Invalid peer Channel List");
return -1;
}
channels = *pos++;
@ -76,14 +74,12 @@ int p2p_peer_channels_check(struct p2p_data *p2p, struct p2p_channels *own,
}
p2p_channels_intersect(own, &dev->channels, &intersection);
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG, "P2P: Own reg_classes %d "
"peer reg_classes %d intersection reg_classes %d",
p2p_dbg(p2p, "Own reg_classes %d peer reg_classes %d intersection reg_classes %d",
(int) own->reg_classes,
(int) dev->channels.reg_classes,
(int) intersection.reg_classes);
if (intersection.reg_classes == 0) {
wpa_msg(p2p->cfg->msg_ctx, MSG_INFO,
"P2P: No common channels found");
p2p_info(p2p, "No common channels found");
return -1;
}
return 0;
@ -194,8 +190,7 @@ int p2p_connect_send(struct p2p_data *p2p, struct p2p_device *dev)
if (dev->flags & P2P_DEV_PD_BEFORE_GO_NEG) {
u16 config_method;
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: Use PD-before-GO-Neg workaround for " MACSTR,
p2p_dbg(p2p, "Use PD-before-GO-Neg workaround for " MACSTR,
MAC2STR(dev->info.p2p_device_addr));
if (dev->wps_method == WPS_PIN_DISPLAY)
config_method = WPS_CONFIG_KEYPAD;
@ -211,9 +206,8 @@ int p2p_connect_send(struct p2p_data *p2p, struct p2p_device *dev)
freq = dev->listen_freq > 0 ? dev->listen_freq : dev->oper_freq;
if (freq <= 0) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: No Listen/Operating frequency known for the "
"peer " MACSTR " to send GO Negotiation Request",
p2p_dbg(p2p, "No Listen/Operating frequency known for the peer "
MACSTR " to send GO Negotiation Request",
MAC2STR(dev->info.p2p_device_addr));
return -1;
}
@ -221,8 +215,7 @@ int p2p_connect_send(struct p2p_data *p2p, struct p2p_device *dev)
req = p2p_build_go_neg_req(p2p, dev);
if (req == NULL)
return -1;
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: Sending GO Negotiation Request");
p2p_dbg(p2p, "Sending GO Negotiation Request");
p2p_set_state(p2p, P2P_CONNECT);
p2p->pending_action_state = P2P_PENDING_GO_NEG_REQUEST;
p2p->go_neg_peer = dev;
@ -231,8 +224,7 @@ int p2p_connect_send(struct p2p_data *p2p, struct p2p_device *dev)
if (p2p_send_action(p2p, freq, dev->info.p2p_device_addr,
p2p->cfg->dev_addr, dev->info.p2p_device_addr,
wpabuf_head(req), wpabuf_len(req), 500) < 0) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: Failed to send Action frame");
p2p_dbg(p2p, "Failed to send Action frame");
/* Use P2P find to recover and retry */
p2p_set_timeout(p2p, 0, 0);
} else
@ -254,8 +246,7 @@ static struct wpabuf * p2p_build_go_neg_resp(struct p2p_data *p2p,
u8 group_capab;
size_t extra = 0;
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: Building GO Negotiation Response");
p2p_dbg(p2p, "Building GO Negotiation Response");
#ifdef CONFIG_WIFI_DISPLAY
if (p2p->wfd_ie_go_neg)
@ -289,8 +280,7 @@ static struct wpabuf * p2p_build_go_neg_resp(struct p2p_data *p2p,
p2p_buf_add_go_intent(buf, (p2p->go_intent << 1) | tie_breaker);
p2p_buf_add_config_timeout(buf, p2p->go_timeout, p2p->client_timeout);
if (peer && peer->go_state == REMOTE_GO) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG, "P2P: Omit Operating "
"Channel attribute");
p2p_dbg(p2p, "Omit Operating Channel attribute");
} else {
p2p_buf_add_operating_channel(buf, p2p->cfg->country,
p2p->op_reg_class,
@ -354,9 +344,8 @@ void p2p_reselect_channel(struct p2p_data *p2p,
p2p_freq_to_channel(p2p->own_freq_preference,
&op_reg_class, &op_channel) == 0 &&
p2p_channels_includes(intersection, op_reg_class, op_channel)) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG, "P2P: Pick own channel "
"preference (reg_class %u channel %u) from "
"intersection", op_reg_class, op_channel);
p2p_dbg(p2p, "Pick own channel preference (reg_class %u channel %u) from intersection",
op_reg_class, op_channel);
p2p->op_reg_class = op_reg_class;
p2p->op_channel = op_channel;
return;
@ -366,8 +355,7 @@ void p2p_reselect_channel(struct p2p_data *p2p,
p2p_freq_to_channel(p2p->best_freq_overall,
&op_reg_class, &op_channel) == 0 &&
p2p_channels_includes(intersection, op_reg_class, op_channel)) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG, "P2P: Pick best overall "
"channel (reg_class %u channel %u) from intersection",
p2p_dbg(p2p, "Pick best overall channel (reg_class %u channel %u) from intersection",
op_reg_class, op_channel);
p2p->op_reg_class = op_reg_class;
p2p->op_channel = op_channel;
@ -382,8 +370,7 @@ void p2p_reselect_channel(struct p2p_data *p2p,
p2p_freq_to_channel(p2p->best_freq_5,
&op_reg_class, &op_channel) == 0 &&
p2p_channels_includes(intersection, op_reg_class, op_channel)) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG, "P2P: Pick best 5 GHz "
"channel (reg_class %u channel %u) from intersection",
p2p_dbg(p2p, "Pick best 5 GHz channel (reg_class %u channel %u) from intersection",
op_reg_class, op_channel);
p2p->op_reg_class = op_reg_class;
p2p->op_channel = op_channel;
@ -396,8 +383,7 @@ void p2p_reselect_channel(struct p2p_data *p2p,
p2p_freq_to_channel(p2p->best_freq_24,
&op_reg_class, &op_channel) == 0 &&
p2p_channels_includes(intersection, op_reg_class, op_channel)) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG, "P2P: Pick best 2.4 GHz "
"channel (reg_class %u channel %u) from intersection",
p2p_dbg(p2p, "Pick best 2.4 GHz channel (reg_class %u channel %u) from intersection",
op_reg_class, op_channel);
p2p->op_reg_class = op_reg_class;
p2p->op_channel = op_channel;
@ -411,9 +397,7 @@ void p2p_reselect_channel(struct p2p_data *p2p,
p2p->cfg->pref_chan[i].chan)) {
p2p->op_reg_class = p2p->cfg->pref_chan[i].op_class;
p2p->op_channel = p2p->cfg->pref_chan[i].chan;
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG, "P2P: Pick "
"highest preferred chnnel (op_class %u "
"channel %u) from intersection",
p2p_dbg(p2p, "Pick highest preferred channel (op_class %u channel %u) from intersection",
p2p->op_reg_class, p2p->op_channel);
return;
}
@ -424,9 +408,7 @@ void p2p_reselect_channel(struct p2p_data *p2p,
struct p2p_reg_class *c = &intersection->reg_class[i];
if (c->reg_class == 116 || c->reg_class == 117 ||
c->reg_class == 126 || c->reg_class == 127) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: Pick possible HT40 channel (reg_class "
"%u channel %u) from intersection",
p2p_dbg(p2p, "Pick possible HT40 channel (reg_class %u channel %u) from intersection",
c->reg_class, c->channel[0]);
p2p->op_reg_class = c->reg_class;
p2p->op_channel = c->channel[0];
@ -441,9 +423,7 @@ void p2p_reselect_channel(struct p2p_data *p2p,
*/
if (p2p_channels_includes(intersection, p2p->op_reg_class,
p2p->op_channel)) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: Using original operating class and channel "
"(op_class %u channel %u) from intersection",
p2p_dbg(p2p, "Using original operating class and channel (op_class %u channel %u) from intersection",
p2p->op_reg_class, p2p->op_channel);
return;
}
@ -453,8 +433,7 @@ void p2p_reselect_channel(struct p2p_data *p2p,
* no better options seems to be available.
*/
cl = &intersection->reg_class[0];
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG, "P2P: Pick another channel "
"(reg_class %u channel %u) from intersection",
p2p_dbg(p2p, "Pick another channel (reg_class %u channel %u) from intersection",
cl->reg_class, cl->channel[0]);
p2p->op_reg_class = cl->reg_class;
p2p->op_channel = cl->channel[0];
@ -471,15 +450,14 @@ static int p2p_go_select_channel(struct p2p_data *p2p, struct p2p_device *dev,
if (intersection.reg_classes == 0 ||
intersection.reg_class[0].channels == 0) {
*status = P2P_SC_FAIL_NO_COMMON_CHANNELS;
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: No common channels found");
p2p_dbg(p2p, "No common channels found");
return -1;
}
for (i = 0; i < intersection.reg_classes; i++) {
struct p2p_reg_class *c;
c = &intersection.reg_class[i];
wpa_printf(MSG_DEBUG, "P2P: reg_class %u", c->reg_class);
p2p_dbg(p2p, "reg_class %u", c->reg_class);
wpa_hexdump(MSG_DEBUG, "P2P: channels",
c->channel, c->channels);
}
@ -488,20 +466,16 @@ static int p2p_go_select_channel(struct p2p_data *p2p, struct p2p_device *dev,
p2p->op_channel)) {
if (dev->flags & P2P_DEV_FORCE_FREQ) {
*status = P2P_SC_FAIL_NO_COMMON_CHANNELS;
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG, "P2P: Peer does "
"not support the forced channel");
p2p_dbg(p2p, "Peer does not support the forced channel");
return -1;
}
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG, "P2P: Selected operating "
"channel (op_class %u channel %u) not acceptable to "
"the peer", p2p->op_reg_class, p2p->op_channel);
p2p_dbg(p2p, "Selected operating channel (op_class %u channel %u) not acceptable to the peer",
p2p->op_reg_class, p2p->op_channel);
p2p_reselect_channel(p2p, &intersection);
} else if (!(dev->flags & P2P_DEV_FORCE_FREQ) &&
!p2p->cfg->cfg_op_channel) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG, "P2P: Try to optimize "
"channel selection with peer information received; "
"previously selected op_class %u channel %u",
p2p_dbg(p2p, "Try to optimize channel selection with peer information received; previously selected op_class %u channel %u",
p2p->op_reg_class, p2p->op_channel);
p2p_reselect_channel(p2p, &intersection);
}
@ -525,17 +499,14 @@ void p2p_process_go_neg_req(struct p2p_data *p2p, const u8 *sa,
int tie_breaker = 0;
int freq;
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: Received GO Negotiation Request from " MACSTR
"(freq=%d)", MAC2STR(sa), rx_freq);
p2p_dbg(p2p, "Received GO Negotiation Request from " MACSTR "(freq=%d)",
MAC2STR(sa), rx_freq);
if (p2p_parse(data, len, &msg))
return;
if (!msg.capability) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: Mandatory Capability attribute missing from GO "
"Negotiation Request");
p2p_dbg(p2p, "Mandatory Capability attribute missing from GO Negotiation Request");
#ifdef CONFIG_P2P_STRICT
goto fail;
#endif /* CONFIG_P2P_STRICT */
@ -544,53 +515,42 @@ void p2p_process_go_neg_req(struct p2p_data *p2p, const u8 *sa,
if (msg.go_intent)
tie_breaker = *msg.go_intent & 0x01;
else {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: Mandatory GO Intent attribute missing from GO "
"Negotiation Request");
p2p_dbg(p2p, "Mandatory GO Intent attribute missing from GO Negotiation Request");
#ifdef CONFIG_P2P_STRICT
goto fail;
#endif /* CONFIG_P2P_STRICT */
}
if (!msg.config_timeout) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: Mandatory Configuration Timeout attribute "
"missing from GO Negotiation Request");
p2p_dbg(p2p, "Mandatory Configuration Timeout attribute missing from GO Negotiation Request");
#ifdef CONFIG_P2P_STRICT
goto fail;
#endif /* CONFIG_P2P_STRICT */
}
if (!msg.listen_channel) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: No Listen Channel attribute received");
p2p_dbg(p2p, "No Listen Channel attribute received");
goto fail;
}
if (!msg.operating_channel) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: No Operating Channel attribute received");
p2p_dbg(p2p, "No Operating Channel attribute received");
goto fail;
}
if (!msg.channel_list) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: No Channel List attribute received");
p2p_dbg(p2p, "No Channel List attribute received");
goto fail;
}
if (!msg.intended_addr) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: No Intended P2P Interface Address attribute "
"received");
p2p_dbg(p2p, "No Intended P2P Interface Address attribute received");
goto fail;
}
if (!msg.p2p_device_info) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: No P2P Device Info attribute received");
p2p_dbg(p2p, "No P2P Device Info attribute received");
goto fail;
}
if (os_memcmp(msg.p2p_device_addr, sa, ETH_ALEN) != 0) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: Unexpected GO Negotiation Request SA=" MACSTR
p2p_dbg(p2p, "Unexpected GO Negotiation Request SA=" MACSTR
" != dev_addr=" MACSTR,
MAC2STR(sa), MAC2STR(msg.p2p_device_addr));
goto fail;
@ -599,9 +559,8 @@ void p2p_process_go_neg_req(struct p2p_data *p2p, const u8 *sa,
dev = p2p_get_device(p2p, sa);
if (msg.status && *msg.status) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: Unexpected Status attribute (%d) in GO "
"Negotiation Request", *msg.status);
p2p_dbg(p2p, "Unexpected Status attribute (%d) in GO Negotiation Request",
*msg.status);
goto fail;
}
@ -610,120 +569,96 @@ void p2p_process_go_neg_req(struct p2p_data *p2p, const u8 *sa,
else if (dev->flags & P2P_DEV_PROBE_REQ_ONLY)
p2p_add_dev_info(p2p, sa, dev, &msg);
if (dev && dev->flags & P2P_DEV_USER_REJECTED) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: User has rejected this peer");
p2p_dbg(p2p, "User has rejected this peer");
status = P2P_SC_FAIL_REJECTED_BY_USER;
} else if (dev == NULL || dev->wps_method == WPS_NOT_READY) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: Not ready for GO negotiation with " MACSTR,
p2p_dbg(p2p, "Not ready for GO negotiation with " MACSTR,
MAC2STR(sa));
status = P2P_SC_FAIL_INFO_CURRENTLY_UNAVAILABLE;
p2p->cfg->go_neg_req_rx(p2p->cfg->cb_ctx, sa,
msg.dev_password_id);
} else if (p2p->go_neg_peer && p2p->go_neg_peer != dev) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: Already in Group Formation with another peer");
p2p_dbg(p2p, "Already in Group Formation with another peer");
status = P2P_SC_FAIL_UNABLE_TO_ACCOMMODATE;
} else {
int go;
if (!p2p->go_neg_peer) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG, "P2P: Starting "
"GO Negotiation with previously authorized "
"peer");
p2p_dbg(p2p, "Starting GO Negotiation with previously authorized peer");
if (!(dev->flags & P2P_DEV_FORCE_FREQ)) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: Use default channel settings");
p2p_dbg(p2p, "Use default channel settings");
p2p->op_reg_class = p2p->cfg->op_reg_class;
p2p->op_channel = p2p->cfg->op_channel;
os_memcpy(&p2p->channels, &p2p->cfg->channels,
sizeof(struct p2p_channels));
} else {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: Use previously configured "
"forced channel settings");
p2p_dbg(p2p, "Use previously configured forced channel settings");
}
}
dev->flags &= ~P2P_DEV_NOT_YET_READY;
if (!msg.go_intent) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: No GO Intent attribute received");
p2p_dbg(p2p, "No GO Intent attribute received");
goto fail;
}
if ((*msg.go_intent >> 1) > P2P_MAX_GO_INTENT) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: Invalid GO Intent value (%u) received",
p2p_dbg(p2p, "Invalid GO Intent value (%u) received",
*msg.go_intent >> 1);
goto fail;
}
if (dev->go_neg_req_sent &&
os_memcmp(sa, p2p->cfg->dev_addr, ETH_ALEN) > 0) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: Do not reply since peer has higher "
"address and GO Neg Request already sent");
p2p_dbg(p2p, "Do not reply since peer has higher address and GO Neg Request already sent");
p2p_parse_free(&msg);
return;
}
go = p2p_go_det(p2p->go_intent, *msg.go_intent);
if (go < 0) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: Incompatible GO Intent");
p2p_dbg(p2p, "Incompatible GO Intent");
status = P2P_SC_FAIL_BOTH_GO_INTENT_15;
goto fail;
}
if (p2p_peer_channels(p2p, dev, msg.channel_list,
msg.channel_list_len) < 0) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: No common channels found");
p2p_dbg(p2p, "No common channels found");
status = P2P_SC_FAIL_NO_COMMON_CHANNELS;
goto fail;
}
switch (msg.dev_password_id) {
case DEV_PW_REGISTRAR_SPECIFIED:
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: PIN from peer Display");
p2p_dbg(p2p, "PIN from peer Display");
if (dev->wps_method != WPS_PIN_KEYPAD) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: We have wps_method=%s -> "
"incompatible",
p2p_dbg(p2p, "We have wps_method=%s -> incompatible",
p2p_wps_method_str(dev->wps_method));
status = P2P_SC_FAIL_INCOMPATIBLE_PROV_METHOD;
goto fail;
}
break;
case DEV_PW_USER_SPECIFIED:
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: Peer entered PIN on Keypad");
p2p_dbg(p2p, "Peer entered PIN on Keypad");
if (dev->wps_method != WPS_PIN_DISPLAY) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: We have wps_method=%s -> "
"incompatible",
p2p_dbg(p2p, "We have wps_method=%s -> incompatible",
p2p_wps_method_str(dev->wps_method));
status = P2P_SC_FAIL_INCOMPATIBLE_PROV_METHOD;
goto fail;
}
break;
case DEV_PW_PUSHBUTTON:
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: Peer using pushbutton");
p2p_dbg(p2p, "Peer using pushbutton");
if (dev->wps_method != WPS_PBC) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: We have wps_method=%s -> "
"incompatible",
p2p_dbg(p2p, "We have wps_method=%s -> incompatible",
p2p_wps_method_str(dev->wps_method));
status = P2P_SC_FAIL_INCOMPATIBLE_PROV_METHOD;
goto fail;
}
break;
default:
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: Unsupported Device Password ID %d",
p2p_dbg(p2p, "Unsupported Device Password ID %d",
msg.dev_password_id);
status = P2P_SC_FAIL_INCOMPATIBLE_PROV_METHOD;
goto fail;
@ -735,16 +670,15 @@ void p2p_process_go_neg_req(struct p2p_data *p2p, const u8 *sa,
dev->go_state = go ? LOCAL_GO : REMOTE_GO;
dev->oper_freq = p2p_channel_to_freq(msg.operating_channel[3],
msg.operating_channel[4]);
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG, "P2P: Peer operating "
"channel preference: %d MHz", dev->oper_freq);
p2p_dbg(p2p, "Peer operating channel preference: %d MHz",
dev->oper_freq);
if (msg.config_timeout) {
dev->go_timeout = msg.config_timeout[0];
dev->client_timeout = msg.config_timeout[1];
}
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: GO Negotiation with " MACSTR, MAC2STR(sa));
p2p_dbg(p2p, "GO Negotiation with " MACSTR, MAC2STR(sa));
if (p2p->state != P2P_IDLE)
p2p_stop_find_for_freq(p2p, rx_freq);
p2p_set_state(p2p, P2P_GO_NEG);
@ -763,16 +697,14 @@ fail:
p2p_parse_free(&msg);
if (resp == NULL)
return;
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: Sending GO Negotiation Response");
p2p_dbg(p2p, "Sending GO Negotiation Response");
if (rx_freq > 0)
freq = rx_freq;
else
freq = p2p_channel_to_freq(p2p->cfg->reg_class,
p2p->cfg->channel);
if (freq < 0) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: Unknown regulatory class/channel");
p2p_dbg(p2p, "Unknown regulatory class/channel");
wpabuf_free(resp);
return;
}
@ -796,8 +728,7 @@ fail:
if (p2p_send_action(p2p, freq, sa, p2p->cfg->dev_addr,
p2p->cfg->dev_addr,
wpabuf_head(resp), wpabuf_len(resp), 500) < 0) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: Failed to send Action frame");
p2p_dbg(p2p, "Failed to send Action frame");
}
wpabuf_free(resp);
@ -815,8 +746,7 @@ static struct wpabuf * p2p_build_go_neg_conf(struct p2p_data *p2p,
u8 group_capab;
size_t extra = 0;
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: Building GO Negotiation Confirm");
p2p_dbg(p2p, "Building GO Negotiation Confirm");
#ifdef CONFIG_WIFI_DISPLAY
if (p2p->wfd_ie_go_neg)
@ -881,14 +811,12 @@ void p2p_process_go_neg_resp(struct p2p_data *p2p, const u8 *sa,
u8 status = P2P_SC_SUCCESS;
int freq;
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: Received GO Negotiation Response from " MACSTR
p2p_dbg(p2p, "Received GO Negotiation Response from " MACSTR
" (freq=%d)", MAC2STR(sa), rx_freq);
dev = p2p_get_device(p2p, sa);
if (dev == NULL || dev->wps_method == WPS_NOT_READY ||
dev != p2p->go_neg_peer) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: Not ready for GO negotiation with " MACSTR,
p2p_dbg(p2p, "Not ready for GO negotiation with " MACSTR,
MAC2STR(sa));
return;
}
@ -897,44 +825,35 @@ void p2p_process_go_neg_resp(struct p2p_data *p2p, const u8 *sa,
return;
if (!(dev->flags & P2P_DEV_WAIT_GO_NEG_RESPONSE)) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: Was not expecting GO Negotiation Response - "
"ignore");
p2p_dbg(p2p, "Was not expecting GO Negotiation Response - ignore");
p2p_parse_free(&msg);
return;
}
dev->flags &= ~P2P_DEV_WAIT_GO_NEG_RESPONSE;
if (msg.dialog_token != dev->dialog_token) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: Unexpected Dialog Token %u (expected %u)",
p2p_dbg(p2p, "Unexpected Dialog Token %u (expected %u)",
msg.dialog_token, dev->dialog_token);
p2p_parse_free(&msg);
return;
}
if (!msg.status) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: No Status attribute received");
p2p_dbg(p2p, "No Status attribute received");
status = P2P_SC_FAIL_INVALID_PARAMS;
goto fail;
}
if (*msg.status) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: GO Negotiation rejected: status %d",
*msg.status);
p2p_dbg(p2p, "GO Negotiation rejected: status %d", *msg.status);
dev->go_neg_req_sent = 0;
if (*msg.status == P2P_SC_FAIL_INFO_CURRENTLY_UNAVAILABLE) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: Wait for the peer to become ready for "
"GO Negotiation");
p2p_dbg(p2p, "Wait for the peer to become ready for GO Negotiation");
dev->flags |= P2P_DEV_NOT_YET_READY;
dev->wait_count = 0;
p2p_set_state(p2p, P2P_WAIT_PEER_IDLE);
p2p_set_timeout(p2p, 0, 0);
} else {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: Stop GO Negotiation attempt");
p2p_dbg(p2p, "Stop GO Negotiation attempt");
p2p_go_neg_failed(p2p, dev, *msg.status);
}
p2p->cfg->send_action_done(p2p->cfg->cb_ctx);
@ -943,9 +862,7 @@ void p2p_process_go_neg_resp(struct p2p_data *p2p, const u8 *sa,
}
if (!msg.capability) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: Mandatory Capability attribute missing from GO "
"Negotiation Response");
p2p_dbg(p2p, "Mandatory Capability attribute missing from GO Negotiation Response");
#ifdef CONFIG_P2P_STRICT
status = P2P_SC_FAIL_INVALID_PARAMS;
goto fail;
@ -953,9 +870,7 @@ void p2p_process_go_neg_resp(struct p2p_data *p2p, const u8 *sa,
}
if (!msg.p2p_device_info) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: Mandatory P2P Device Info attribute missing "
"from GO Negotiation Response");
p2p_dbg(p2p, "Mandatory P2P Device Info attribute missing from GO Negotiation Response");
#ifdef CONFIG_P2P_STRICT
status = P2P_SC_FAIL_INVALID_PARAMS;
goto fail;
@ -963,22 +878,18 @@ void p2p_process_go_neg_resp(struct p2p_data *p2p, const u8 *sa,
}
if (!msg.intended_addr) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: No Intended P2P Interface Address attribute "
"received");
p2p_dbg(p2p, "No Intended P2P Interface Address attribute received");
status = P2P_SC_FAIL_INVALID_PARAMS;
goto fail;
}
if (!msg.go_intent) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: No GO Intent attribute received");
p2p_dbg(p2p, "No GO Intent attribute received");
status = P2P_SC_FAIL_INVALID_PARAMS;
goto fail;
}
if ((*msg.go_intent >> 1) > P2P_MAX_GO_INTENT) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: Invalid GO Intent value (%u) received",
p2p_dbg(p2p, "Invalid GO Intent value (%u) received",
*msg.go_intent >> 1);
status = P2P_SC_FAIL_INVALID_PARAMS;
goto fail;
@ -986,8 +897,7 @@ void p2p_process_go_neg_resp(struct p2p_data *p2p, const u8 *sa,
go = p2p_go_det(p2p->go_intent, *msg.go_intent);
if (go < 0) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: Incompatible GO Intent");
p2p_dbg(p2p, "Incompatible GO Intent");
status = P2P_SC_FAIL_INCOMPATIBLE_PARAMS;
goto fail;
}
@ -997,18 +907,14 @@ void p2p_process_go_neg_resp(struct p2p_data *p2p, const u8 *sa,
p2p->ssid_len = msg.group_id_len - ETH_ALEN;
os_memcpy(p2p->ssid, msg.group_id + ETH_ALEN, p2p->ssid_len);
} else if (!go) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: Mandatory P2P Group ID attribute missing from "
"GO Negotiation Response");
p2p_dbg(p2p, "Mandatory P2P Group ID attribute missing from GO Negotiation Response");
p2p->ssid_len = 0;
status = P2P_SC_FAIL_INVALID_PARAMS;
goto fail;
}
if (!msg.config_timeout) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: Mandatory Configuration Timeout attribute "
"missing from GO Negotiation Response");
p2p_dbg(p2p, "Mandatory Configuration Timeout attribute missing from GO Negotiation Response");
#ifdef CONFIG_P2P_STRICT
status = P2P_SC_FAIL_INVALID_PARAMS;
goto fail;
@ -1023,22 +929,19 @@ void p2p_process_go_neg_resp(struct p2p_data *p2p, const u8 *sa,
* Note: P2P Client may omit Operating Channel attribute to
* indicate it does not have a preference.
*/
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: No Operating Channel attribute received");
p2p_dbg(p2p, "No Operating Channel attribute received");
status = P2P_SC_FAIL_INVALID_PARAMS;
goto fail;
}
if (!msg.channel_list) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: No Channel List attribute received");
p2p_dbg(p2p, "No Channel List attribute received");
status = P2P_SC_FAIL_INVALID_PARAMS;
goto fail;
}
if (p2p_peer_channels(p2p, dev, msg.channel_list,
msg.channel_list_len) < 0) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: No common channels found");
p2p_dbg(p2p, "No common channels found");
status = P2P_SC_FAIL_NO_COMMON_CHANNELS;
goto fail;
}
@ -1046,51 +949,41 @@ void p2p_process_go_neg_resp(struct p2p_data *p2p, const u8 *sa,
if (msg.operating_channel) {
dev->oper_freq = p2p_channel_to_freq(msg.operating_channel[3],
msg.operating_channel[4]);
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG, "P2P: Peer operating "
"channel preference: %d MHz", dev->oper_freq);
p2p_dbg(p2p, "Peer operating channel preference: %d MHz",
dev->oper_freq);
} else
dev->oper_freq = 0;
switch (msg.dev_password_id) {
case DEV_PW_REGISTRAR_SPECIFIED:
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: PIN from peer Display");
p2p_dbg(p2p, "PIN from peer Display");
if (dev->wps_method != WPS_PIN_KEYPAD) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: We have wps_method=%s -> "
"incompatible",
p2p_dbg(p2p, "We have wps_method=%s -> incompatible",
p2p_wps_method_str(dev->wps_method));
status = P2P_SC_FAIL_INCOMPATIBLE_PROV_METHOD;
goto fail;
}
break;
case DEV_PW_USER_SPECIFIED:
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: Peer entered PIN on Keypad");
p2p_dbg(p2p, "Peer entered PIN on Keypad");
if (dev->wps_method != WPS_PIN_DISPLAY) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: We have wps_method=%s -> "
"incompatible",
p2p_dbg(p2p, "We have wps_method=%s -> incompatible",
p2p_wps_method_str(dev->wps_method));
status = P2P_SC_FAIL_INCOMPATIBLE_PROV_METHOD;
goto fail;
}
break;
case DEV_PW_PUSHBUTTON:
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: Peer using pushbutton");
p2p_dbg(p2p, "Peer using pushbutton");
if (dev->wps_method != WPS_PBC) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: We have wps_method=%s -> "
"incompatible",
p2p_dbg(p2p, "We have wps_method=%s -> incompatible",
p2p_wps_method_str(dev->wps_method));
status = P2P_SC_FAIL_INCOMPATIBLE_PROV_METHOD;
goto fail;
}
break;
default:
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: Unsupported Device Password ID %d",
p2p_dbg(p2p, "Unsupported Device Password ID %d",
msg.dev_password_id);
status = P2P_SC_FAIL_INCOMPATIBLE_PROV_METHOD;
goto fail;
@ -1102,8 +995,7 @@ void p2p_process_go_neg_resp(struct p2p_data *p2p, const u8 *sa,
p2p_set_state(p2p, P2P_GO_NEG);
p2p_clear_timeout(p2p);
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: GO Negotiation with " MACSTR, MAC2STR(sa));
p2p_dbg(p2p, "GO Negotiation with " MACSTR, MAC2STR(sa));
os_memcpy(dev->intended_addr, msg.intended_addr, ETH_ALEN);
fail:
@ -1112,8 +1004,7 @@ fail:
p2p_parse_free(&msg);
if (conf == NULL)
return;
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: Sending GO Negotiation Confirm");
p2p_dbg(p2p, "Sending GO Negotiation Confirm");
if (status == P2P_SC_SUCCESS) {
p2p->pending_action_state = P2P_PENDING_GO_NEG_CONFIRM;
dev->go_state = go ? LOCAL_GO : REMOTE_GO;
@ -1125,14 +1016,12 @@ fail:
freq = dev->listen_freq;
if (p2p_send_action(p2p, freq, sa, p2p->cfg->dev_addr, sa,
wpabuf_head(conf), wpabuf_len(conf), 0) < 0) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: Failed to send Action frame");
p2p_dbg(p2p, "Failed to send Action frame");
p2p_go_neg_failed(p2p, dev, -1);
}
wpabuf_free(conf);
if (status != P2P_SC_SUCCESS) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: GO Negotiation failed");
p2p_dbg(p2p, "GO Negotiation failed");
p2p_go_neg_failed(p2p, dev, status);
}
}
@ -1144,22 +1033,18 @@ void p2p_process_go_neg_conf(struct p2p_data *p2p, const u8 *sa,
struct p2p_device *dev;
struct p2p_message msg;
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: Received GO Negotiation Confirm from " MACSTR,
p2p_dbg(p2p, "Received GO Negotiation Confirm from " MACSTR,
MAC2STR(sa));
dev = p2p_get_device(p2p, sa);
if (dev == NULL || dev->wps_method == WPS_NOT_READY ||
dev != p2p->go_neg_peer) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: Not ready for GO negotiation with " MACSTR,
p2p_dbg(p2p, "Not ready for GO negotiation with " MACSTR,
MAC2STR(sa));
return;
}
if (p2p->pending_action_state == P2P_PENDING_GO_NEG_RESPONSE) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG, "P2P: Stopped waiting "
"for TX status on GO Negotiation Response since we "
"already received Confirmation");
p2p_dbg(p2p, "Stopped waiting for TX status on GO Negotiation Response since we already received Confirmation");
p2p->pending_action_state = P2P_NO_PENDING_ACTION;
}
@ -1167,31 +1052,25 @@ void p2p_process_go_neg_conf(struct p2p_data *p2p, const u8 *sa,
return;
if (!(dev->flags & P2P_DEV_WAIT_GO_NEG_CONFIRM)) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: Was not expecting GO Negotiation Confirm - "
"ignore");
p2p_dbg(p2p, "Was not expecting GO Negotiation Confirm - ignore");
return;
}
dev->flags &= ~P2P_DEV_WAIT_GO_NEG_CONFIRM;
if (msg.dialog_token != dev->dialog_token) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: Unexpected Dialog Token %u (expected %u)",
p2p_dbg(p2p, "Unexpected Dialog Token %u (expected %u)",
msg.dialog_token, dev->dialog_token);
p2p_parse_free(&msg);
return;
}
if (!msg.status) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: No Status attribute received");
p2p_dbg(p2p, "No Status attribute received");
p2p_parse_free(&msg);
return;
}
if (*msg.status) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: GO Negotiation rejected: status %d",
*msg.status);
p2p_dbg(p2p, "GO Negotiation rejected: status %d", *msg.status);
p2p_go_neg_failed(p2p, dev, *msg.status);
p2p_parse_free(&msg);
return;
@ -1202,9 +1081,7 @@ void p2p_process_go_neg_conf(struct p2p_data *p2p, const u8 *sa,
p2p->ssid_len = msg.group_id_len - ETH_ALEN;
os_memcpy(p2p->ssid, msg.group_id + ETH_ALEN, p2p->ssid_len);
} else if (dev->go_state == REMOTE_GO) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: Mandatory P2P Group ID attribute missing from "
"GO Negotiation Confirmation");
p2p_dbg(p2p, "Mandatory P2P Group ID attribute missing from GO Negotiation Confirmation");
p2p->ssid_len = 0;
p2p_go_neg_failed(p2p, dev, P2P_SC_FAIL_INVALID_PARAMS);
p2p_parse_free(&msg);
@ -1212,9 +1089,7 @@ void p2p_process_go_neg_conf(struct p2p_data *p2p, const u8 *sa,
}
if (!msg.operating_channel) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: Mandatory Operating Channel attribute missing "
"from GO Negotiation Confirmation");
p2p_dbg(p2p, "Mandatory Operating Channel attribute missing from GO Negotiation Confirmation");
#ifdef CONFIG_P2P_STRICT
p2p_parse_free(&msg);
return;
@ -1222,9 +1097,7 @@ void p2p_process_go_neg_conf(struct p2p_data *p2p, const u8 *sa,
}
if (!msg.channel_list) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: Mandatory Operating Channel attribute missing "
"from GO Negotiation Confirmation");
p2p_dbg(p2p, "Mandatory Operating Channel attribute missing from GO Negotiation Confirmation");
#ifdef CONFIG_P2P_STRICT
p2p_parse_free(&msg);
return;
@ -1238,9 +1111,7 @@ void p2p_process_go_neg_conf(struct p2p_data *p2p, const u8 *sa,
* This should not happen since GO negotiation has already
* been completed.
*/
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: Unexpected GO Neg state - do not know which end "
"becomes GO");
p2p_dbg(p2p, "Unexpected GO Neg state - do not know which end becomes GO");
return;
}
@ -1252,8 +1123,7 @@ void p2p_process_go_neg_conf(struct p2p_data *p2p, const u8 *sa,
* the group so that we will remain on the current channel to
* acknowledge any possible retransmission from the peer.
*/
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG, "P2P: 20 ms wait on current "
"channel before starting group");
p2p_dbg(p2p, "20 ms wait on current channel before starting group");
os_sleep(0, 20000);
p2p_go_complete(p2p, dev);

View File

@ -378,8 +378,8 @@ wifi_display_build_go_ie(struct p2p_group *group)
} else {
WPA_PUT_BE16(len, (u8 *) wpabuf_put(wfd_subelems, 0) - len -
2);
wpa_printf(MSG_DEBUG, "WFD: WFD Session Info: %u descriptors",
count);
p2p_dbg(group->p2p, "WFD: WFD Session Info: %u descriptors",
count);
}
wfd_ie = wifi_display_encaps(wfd_subelems);
@ -588,7 +588,7 @@ int p2p_group_notif_assoc(struct p2p_group *group, const u8 *addr,
m->next = group->members;
group->members = m;
group->num_members++;
wpa_msg(group->p2p->cfg->msg_ctx, MSG_DEBUG, "P2P: Add client " MACSTR
p2p_dbg(group->p2p, "Add client " MACSTR
" to group (p2p=%d wfd=%d client_info=%d); num_members=%u/%u",
MAC2STR(addr), m->p2p_ie ? 1 : 0, m->wfd_ie ? 1 : 0,
m->client_info ? 1 : 0,
@ -641,8 +641,8 @@ struct wpabuf * p2p_group_assoc_resp_ie(struct p2p_group *group, u8 status)
void p2p_group_notif_disassoc(struct p2p_group *group, const u8 *addr)
{
if (p2p_group_remove_member(group, addr)) {
wpa_msg(group->p2p->cfg->msg_ctx, MSG_DEBUG, "P2P: Remove "
"client " MACSTR " from group; num_members=%u/%u",
p2p_dbg(group->p2p, "Remove client " MACSTR
" from group; num_members=%u/%u",
MAC2STR(addr), group->num_members,
group->cfg->max_clients);
if (group->num_members == group->cfg->max_clients - 1)
@ -854,20 +854,18 @@ int p2p_group_go_discover(struct p2p_group *group, const u8 *dev_id,
m = p2p_group_get_client(group, dev_id);
if (m == NULL || m->client_info == NULL) {
wpa_printf(MSG_DEBUG, "P2P: Requested client was not in this "
"group " MACSTR,
MAC2STR(group->cfg->interface_addr));
p2p_dbg(group->p2p, "Requested client was not in this group "
MACSTR, MAC2STR(group->cfg->interface_addr));
return -1;
}
if (!(m->dev_capab & P2P_DEV_CAPAB_CLIENT_DISCOVERABILITY)) {
wpa_printf(MSG_DEBUG, "P2P: Requested client does not support "
"client discoverability");
p2p_dbg(group->p2p, "Requested client does not support client discoverability");
return -1;
}
wpa_printf(MSG_DEBUG, "P2P: Schedule GO Discoverability Request to be "
"sent to " MACSTR, MAC2STR(dev_id));
p2p_dbg(group->p2p, "Schedule GO Discoverability Request to be sent to "
MACSTR, MAC2STR(dev_id));
req = p2p_build_go_disc_req();
if (req == NULL)
@ -882,8 +880,7 @@ int p2p_group_go_discover(struct p2p_group *group, const u8 *dev_id,
group->cfg->interface_addr,
wpabuf_head(req), wpabuf_len(req), 200) < 0)
{
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: Failed to send Action frame");
p2p_dbg(p2p, "Failed to send Action frame");
}
wpabuf_free(req);
@ -908,7 +905,7 @@ u8 p2p_group_presence_req(struct p2p_group *group,
m = p2p_group_get_client_iface(group, client_interface_addr);
if (m == NULL || m->client_info == NULL) {
wpa_printf(MSG_DEBUG, "P2P: Client was not in this group");
p2p_dbg(group->p2p, "Client was not in this group");
return P2P_SC_FAIL_UNABLE_TO_ACCOMMODATE;
}
@ -921,9 +918,9 @@ u8 p2p_group_presence_req(struct p2p_group *group,
else
curr_noa_len = -1;
if (curr_noa_len < 0)
wpa_printf(MSG_DEBUG, "P2P: Failed to fetch current NoA");
p2p_dbg(group->p2p, "Failed to fetch current NoA");
else if (curr_noa_len == 0)
wpa_printf(MSG_DEBUG, "P2P: No NoA being advertized");
p2p_dbg(group->p2p, "No NoA being advertized");
else
wpa_hexdump(MSG_DEBUG, "P2P: Current NoA", curr_noa,
curr_noa_len);

View File

@ -717,5 +717,11 @@ int p2p_send_action(struct p2p_data *p2p, unsigned int freq, const u8 *dst,
void p2p_stop_listen_for_freq(struct p2p_data *p2p, int freq);
int p2p_prepare_channel(struct p2p_data *p2p, struct p2p_device *dev,
unsigned int force_freq, unsigned int pref_freq);
void p2p_dbg(struct p2p_data *p2p, const char *fmt, ...)
PRINTF_FORMAT(2, 3);
void p2p_info(struct p2p_data *p2p, const char *fmt, ...)
PRINTF_FORMAT(2, 3);
void p2p_err(struct p2p_data *p2p, const char *fmt, ...)
PRINTF_FORMAT(2, 3);
#endif /* P2P_I_H */

View File

@ -166,8 +166,7 @@ void p2p_process_invitation_req(struct p2p_data *p2p, const u8 *sa,
os_memset(group_bssid, 0, sizeof(group_bssid));
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: Received Invitation Request from " MACSTR " (freq=%d)",
p2p_dbg(p2p, "Received Invitation Request from " MACSTR " (freq=%d)",
MAC2STR(sa), rx_freq);
if (p2p_parse(data, len, &msg))
@ -175,14 +174,12 @@ void p2p_process_invitation_req(struct p2p_data *p2p, const u8 *sa,
dev = p2p_get_device(p2p, sa);
if (dev == NULL || (dev->flags & P2P_DEV_PROBE_REQ_ONLY)) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: Invitation Request from unknown peer "
MACSTR, MAC2STR(sa));
p2p_dbg(p2p, "Invitation Request from unknown peer " MACSTR,
MAC2STR(sa));
if (p2p_add_device(p2p, sa, rx_freq, NULL, 0, data + 1, len - 1,
0)) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: Invitation Request add device failed "
p2p_dbg(p2p, "Invitation Request add device failed "
MACSTR, MAC2STR(sa));
status = P2P_SC_FAIL_INFO_CURRENTLY_UNAVAILABLE;
goto fail;
@ -190,18 +187,16 @@ void p2p_process_invitation_req(struct p2p_data *p2p, const u8 *sa,
dev = p2p_get_device(p2p, sa);
if (dev == NULL) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: Reject Invitation Request from unknown "
"peer " MACSTR, MAC2STR(sa));
p2p_dbg(p2p, "Reject Invitation Request from unknown peer "
MACSTR, MAC2STR(sa));
status = P2P_SC_FAIL_INFO_CURRENTLY_UNAVAILABLE;
goto fail;
}
}
if (!msg.group_id || !msg.channel_list) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: Mandatory attribute missing in Invitation "
"Request from " MACSTR, MAC2STR(sa));
p2p_dbg(p2p, "Mandatory attribute missing in Invitation Request from "
MACSTR, MAC2STR(sa));
status = P2P_SC_FAIL_INVALID_PARAMS;
goto fail;
}
@ -214,16 +209,14 @@ void p2p_process_invitation_req(struct p2p_data *p2p, const u8 *sa,
* the request was for a persistent group if the attribute is
* missing.
*/
wpa_printf(MSG_DEBUG, "P2P: Mandatory Invitation Flags "
"attribute missing from Invitation Request");
p2p_dbg(p2p, "Mandatory Invitation Flags attribute missing from Invitation Request");
persistent = 1;
}
if (p2p_peer_channels_check(p2p, &p2p->cfg->channels, dev,
msg.channel_list, msg.channel_list_len) <
0) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: No common channels found");
p2p_dbg(p2p, "No common channels found");
status = P2P_SC_FAIL_NO_COMMON_CHANNELS;
goto fail;
}
@ -236,12 +229,11 @@ void p2p_process_invitation_req(struct p2p_data *p2p, const u8 *sa,
}
if (op_freq) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG, "P2P: Invitation "
"processing forced frequency %d MHz", op_freq);
p2p_dbg(p2p, "Invitation processing forced frequency %d MHz",
op_freq);
if (p2p_freq_to_channel(op_freq, &reg_class, &channel) < 0) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: Unknown forced freq %d MHz from "
"invitation_process()", op_freq);
p2p_dbg(p2p, "Unknown forced freq %d MHz from invitation_process()",
op_freq);
status = P2P_SC_FAIL_NO_COMMON_CHANNELS;
goto fail;
}
@ -250,9 +242,8 @@ void p2p_process_invitation_req(struct p2p_data *p2p, const u8 *sa,
&intersection);
if (!p2p_channels_includes(&intersection, reg_class, channel))
{
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: forced freq %d MHz not in the supported "
"channels interaction", op_freq);
p2p_dbg(p2p, "forced freq %d MHz not in the supported channels interaction",
op_freq);
status = P2P_SC_FAIL_NO_COMMON_CHANNELS;
goto fail;
}
@ -260,17 +251,14 @@ void p2p_process_invitation_req(struct p2p_data *p2p, const u8 *sa,
if (status == P2P_SC_SUCCESS)
channels = &intersection;
} else {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: No forced channel from invitation processing - "
"figure out best one to use");
p2p_dbg(p2p, "No forced channel from invitation processing - figure out best one to use");
p2p_channels_intersect(&p2p->cfg->channels, &dev->channels,
&intersection);
/* Default to own configuration as a starting point */
p2p->op_reg_class = p2p->cfg->op_reg_class;
p2p->op_channel = p2p->cfg->op_channel;
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG, "P2P: Own default "
"op_class %d channel %d",
p2p_dbg(p2p, "Own default op_class %d channel %d",
p2p->op_reg_class, p2p->op_channel);
/* Use peer preference if specified and compatible */
@ -279,8 +267,7 @@ void p2p_process_invitation_req(struct p2p_data *p2p, const u8 *sa,
req_freq = p2p_channel_to_freq(
msg.operating_channel[3],
msg.operating_channel[4]);
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG, "P2P: Peer "
"operating channel preference: %d MHz",
p2p_dbg(p2p, "Peer operating channel preference: %d MHz",
req_freq);
if (req_freq > 0 &&
p2p_channels_includes(&intersection,
@ -288,46 +275,31 @@ void p2p_process_invitation_req(struct p2p_data *p2p, const u8 *sa,
msg.operating_channel[4])) {
p2p->op_reg_class = msg.operating_channel[3];
p2p->op_channel = msg.operating_channel[4];
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: Use peer preference op_class %d "
"channel %d",
p2p_dbg(p2p, "Use peer preference op_class %d channel %d",
p2p->op_reg_class, p2p->op_channel);
} else {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: Cannot use peer channel "
"preference");
p2p_dbg(p2p, "Cannot use peer channel preference");
}
}
if (!p2p_channels_includes(&intersection, p2p->op_reg_class,
p2p->op_channel)) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: Initially selected channel (op_class %d "
"channel %d) not in channel intersection - try "
"to reselect",
p2p_dbg(p2p, "Initially selected channel (op_class %d channel %d) not in channel intersection - try to reselect",
p2p->op_reg_class, p2p->op_channel);
p2p_reselect_channel(p2p, &intersection);
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: Re-selection result: op_class %d "
"channel %d",
p2p_dbg(p2p, "Re-selection result: op_class %d channel %d",
p2p->op_reg_class, p2p->op_channel);
if (!p2p_channels_includes(&intersection,
p2p->op_reg_class,
p2p->op_channel)) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: Peer does not support selected "
"operating channel (reg_class=%u "
"channel=%u)",
p2p_dbg(p2p, "Peer does not support selected operating channel (reg_class=%u channel=%u)",
p2p->op_reg_class, p2p->op_channel);
status = P2P_SC_FAIL_NO_COMMON_CHANNELS;
goto fail;
}
} else if (!(dev->flags & P2P_DEV_FORCE_FREQ) &&
!p2p->cfg->cfg_op_channel) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: Try to reselect channel selection with "
"peer information received; "
"previously selected op_class %u channel %u",
p2p_dbg(p2p, "Try to reselect channel selection with peer information received; previously selected op_class %u channel %u",
p2p->op_reg_class, p2p->op_channel);
p2p_reselect_channel(p2p, &intersection);
}
@ -335,16 +307,13 @@ void p2p_process_invitation_req(struct p2p_data *p2p, const u8 *sa,
op_freq = p2p_channel_to_freq(p2p->op_reg_class,
p2p->op_channel);
if (op_freq < 0) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: Unknown operational channel "
"(country=%c%c reg_class=%u channel=%u)",
p2p_dbg(p2p, "Unknown operational channel (country=%c%c reg_class=%u channel=%u)",
p2p->cfg->country[0], p2p->cfg->country[1],
p2p->op_reg_class, p2p->op_channel);
status = P2P_SC_FAIL_NO_COMMON_CHANNELS;
goto fail;
}
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG, "P2P: Selected operating "
"channel - %d MHz", op_freq);
p2p_dbg(p2p, "Selected operating channel - %d MHz", op_freq);
if (status == P2P_SC_SUCCESS) {
reg_class = p2p->op_reg_class;
@ -370,8 +339,7 @@ fail:
freq = p2p_channel_to_freq(p2p->cfg->reg_class,
p2p->cfg->channel);
if (freq < 0) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: Unknown regulatory class/channel");
p2p_dbg(p2p, "Unknown regulatory class/channel");
goto out;
}
@ -398,8 +366,7 @@ fail:
if (p2p_send_action(p2p, freq, sa, p2p->cfg->dev_addr,
p2p->cfg->dev_addr,
wpabuf_head(resp), wpabuf_len(resp), 200) < 0) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: Failed to send Action frame");
p2p_dbg(p2p, "Failed to send Action frame");
}
out:
@ -415,21 +382,18 @@ void p2p_process_invitation_resp(struct p2p_data *p2p, const u8 *sa,
struct p2p_message msg;
struct p2p_channels intersection, *channels = NULL;
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: Received Invitation Response from " MACSTR,
p2p_dbg(p2p, "Received Invitation Response from " MACSTR,
MAC2STR(sa));
dev = p2p_get_device(p2p, sa);
if (dev == NULL) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: Ignore Invitation Response from unknown peer "
p2p_dbg(p2p, "Ignore Invitation Response from unknown peer "
MACSTR, MAC2STR(sa));
return;
}
if (dev != p2p->invite_peer) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: Ignore unexpected Invitation Response from peer "
p2p_dbg(p2p, "Ignore unexpected Invitation Response from peer "
MACSTR, MAC2STR(sa));
return;
}
@ -438,17 +402,15 @@ void p2p_process_invitation_resp(struct p2p_data *p2p, const u8 *sa,
return;
if (!msg.status) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: Mandatory Status attribute missing in "
"Invitation Response from " MACSTR, MAC2STR(sa));
p2p_dbg(p2p, "Mandatory Status attribute missing in Invitation Response from "
MACSTR, MAC2STR(sa));
p2p_parse_free(&msg);
return;
}
if (!msg.channel_list) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: Mandatory Channel List attribute missing in "
"Invitation Response from " MACSTR, MAC2STR(sa));
p2p_dbg(p2p, "Mandatory Channel List attribute missing in Invitation Response from "
MACSTR, MAC2STR(sa));
#ifdef CONFIG_P2P_STRICT
p2p_parse_free(&msg);
return;
@ -458,8 +420,7 @@ void p2p_process_invitation_resp(struct p2p_data *p2p, const u8 *sa,
} else if (p2p_peer_channels_check(p2p, &p2p->channels, dev,
msg.channel_list,
msg.channel_list_len) < 0) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: No common channels found");
p2p_dbg(p2p, "No common channels found");
p2p_parse_free(&msg);
return;
} else {
@ -488,9 +449,8 @@ int p2p_invite_send(struct p2p_data *p2p, struct p2p_device *dev,
freq = dev->listen_freq > 0 ? dev->listen_freq : dev->oper_freq;
if (freq <= 0) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: No Listen/Operating frequency known for the "
"peer " MACSTR " to send Invitation Request",
p2p_dbg(p2p, "No Listen/Operating frequency known for the peer "
MACSTR " to send Invitation Request",
MAC2STR(dev->info.p2p_device_addr));
return -1;
}
@ -500,8 +460,7 @@ int p2p_invite_send(struct p2p_data *p2p, struct p2p_device *dev,
return -1;
if (p2p->state != P2P_IDLE)
p2p_stop_listen_for_freq(p2p, freq);
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: Sending Invitation Request");
p2p_dbg(p2p, "Sending Invitation Request");
p2p_set_state(p2p, P2P_INVITE);
p2p->pending_action_state = P2P_PENDING_INVITATION_REQUEST;
p2p->invite_peer = dev;
@ -509,8 +468,7 @@ int p2p_invite_send(struct p2p_data *p2p, struct p2p_device *dev,
if (p2p_send_action(p2p, freq, dev->info.p2p_device_addr,
p2p->cfg->dev_addr, dev->info.p2p_device_addr,
wpabuf_head(req), wpabuf_len(req), 200) < 0) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: Failed to send Action frame");
p2p_dbg(p2p, "Failed to send Action frame");
/* Use P2P find to recover and retry */
p2p_set_timeout(p2p, 0, 0);
}
@ -523,12 +481,10 @@ int p2p_invite_send(struct p2p_data *p2p, struct p2p_device *dev,
void p2p_invitation_req_cb(struct p2p_data *p2p, int success)
{
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: Invitation Request TX callback: success=%d", success);
p2p_dbg(p2p, "Invitation Request TX callback: success=%d", success);
if (p2p->invite_peer == NULL) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: No pending Invite");
p2p_dbg(p2p, "No pending Invite");
return;
}
@ -543,15 +499,11 @@ void p2p_invitation_req_cb(struct p2p_data *p2p, int success)
void p2p_invitation_resp_cb(struct p2p_data *p2p, int success)
{
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: Invitation Response TX callback: success=%d", success);
p2p_dbg(p2p, "Invitation Response TX callback: success=%d", success);
p2p->cfg->send_action_done(p2p->cfg->cb_ctx);
if (!success)
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: Assume Invitation Response was actually "
"received by the peer even though Ack was not "
"reported");
p2p_dbg(p2p, "Assume Invitation Response was actually received by the peer even though Ack was not reported");
if (p2p->cfg->invitation_received) {
p2p->cfg->invitation_received(p2p->cfg->cb_ctx,
@ -572,28 +524,24 @@ int p2p_invite(struct p2p_data *p2p, const u8 *peer, enum p2p_invite_role role,
{
struct p2p_device *dev;
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: Request to invite peer " MACSTR " role=%d persistent=%d "
p2p_dbg(p2p, "Request to invite peer " MACSTR " role=%d persistent=%d "
"force_freq=%u",
MAC2STR(peer), role, persistent_group, force_freq);
if (bssid)
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: Invitation for BSSID " MACSTR, MAC2STR(bssid));
p2p_dbg(p2p, "Invitation for BSSID " MACSTR, MAC2STR(bssid));
if (go_dev_addr) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: Invitation for GO Device Address " MACSTR,
p2p_dbg(p2p, "Invitation for GO Device Address " MACSTR,
MAC2STR(go_dev_addr));
os_memcpy(p2p->invite_go_dev_addr_buf, go_dev_addr, ETH_ALEN);
p2p->invite_go_dev_addr = p2p->invite_go_dev_addr_buf;
} else
p2p->invite_go_dev_addr = NULL;
wpa_hexdump_ascii(MSG_DEBUG, "P2P: Invitation for SSID",
wpa_hexdump_ascii(MSG_DEBUG, "Invitation for SSID",
ssid, ssid_len);
dev = p2p_get_device(p2p, peer);
if (dev == NULL || (dev->listen_freq <= 0 && dev->oper_freq <= 0)) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: Cannot invite unknown P2P Device " MACSTR,
p2p_dbg(p2p, "Cannot invite unknown P2P Device " MACSTR,
MAC2STR(peer));
return -1;
}
@ -610,8 +558,7 @@ int p2p_invite(struct p2p_data *p2p, const u8 *peer, enum p2p_invite_role role,
if (dev->flags & P2P_DEV_GROUP_CLIENT_ONLY) {
if (!(dev->info.dev_capab &
P2P_DEV_CAPAB_CLIENT_DISCOVERABILITY)) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: Cannot invite a P2P Device " MACSTR
p2p_dbg(p2p, "Cannot invite a P2P Device " MACSTR
" that is in a group and is not discoverable",
MAC2STR(peer));
}

View File

@ -141,22 +141,19 @@ void p2p_process_prov_disc_req(struct p2p_data *p2p, const u8 *sa,
if (p2p_parse(data, len, &msg))
return;
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: Received Provision Discovery Request from " MACSTR
p2p_dbg(p2p, "Received Provision Discovery Request from " MACSTR
" with config methods 0x%x (freq=%d)",
MAC2STR(sa), msg.wps_config_methods, rx_freq);
dev = p2p_get_device(p2p, sa);
if (dev == NULL || (dev->flags & P2P_DEV_PROBE_REQ_ONLY)) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: Provision Discovery Request from "
"unknown peer " MACSTR, MAC2STR(sa));
p2p_dbg(p2p, "Provision Discovery Request from unknown peer "
MACSTR, MAC2STR(sa));
if (p2p_add_device(p2p, sa, rx_freq, NULL, 0, data + 1, len - 1,
0)) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: Provision Discovery Request add device "
"failed " MACSTR, MAC2STR(sa));
p2p_dbg(p2p, "Provision Discovery Request add device failed "
MACSTR, MAC2STR(sa));
}
} else if (msg.wfd_subelems) {
wpabuf_free(dev->info.wfd_subelems);
@ -166,8 +163,7 @@ void p2p_process_prov_disc_req(struct p2p_data *p2p, const u8 *sa,
if (!(msg.wps_config_methods &
(WPS_CONFIG_DISPLAY | WPS_CONFIG_KEYPAD |
WPS_CONFIG_PUSHBUTTON))) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG, "P2P: Unsupported "
"Config Methods in Provision Discovery Request");
p2p_dbg(p2p, "Unsupported Config Methods in Provision Discovery Request");
goto out;
}
@ -180,8 +176,7 @@ void p2p_process_prov_disc_req(struct p2p_data *p2p, const u8 *sa,
break;
}
if (i == p2p->num_groups) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG, "P2P: PD "
"request for unknown P2P Group ID - reject");
p2p_dbg(p2p, "PD request for unknown P2P Group ID - reject");
goto out;
}
}
@ -190,12 +185,12 @@ void p2p_process_prov_disc_req(struct p2p_data *p2p, const u8 *sa,
dev->flags &= ~(P2P_DEV_PD_PEER_DISPLAY |
P2P_DEV_PD_PEER_KEYPAD);
if (msg.wps_config_methods & WPS_CONFIG_DISPLAY) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG, "P2P: Peer " MACSTR
p2p_dbg(p2p, "Peer " MACSTR
" requested us to show a PIN on display", MAC2STR(sa));
if (dev)
dev->flags |= P2P_DEV_PD_PEER_KEYPAD;
} else if (msg.wps_config_methods & WPS_CONFIG_KEYPAD) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG, "P2P: Peer " MACSTR
p2p_dbg(p2p, "Peer " MACSTR
" requested us to write its PIN using keypad",
MAC2STR(sa));
if (dev)
@ -212,16 +207,14 @@ out:
p2p_parse_free(&msg);
return;
}
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: Sending Provision Discovery Response");
p2p_dbg(p2p, "Sending Provision Discovery Response");
if (rx_freq > 0)
freq = rx_freq;
else
freq = p2p_channel_to_freq(p2p->cfg->reg_class,
p2p->cfg->channel);
if (freq < 0) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: Unknown regulatory class/channel");
p2p_dbg(p2p, "Unknown regulatory class/channel");
wpabuf_free(resp);
p2p_parse_free(&msg);
return;
@ -230,8 +223,7 @@ out:
if (p2p_send_action(p2p, freq, sa, p2p->cfg->dev_addr,
p2p->cfg->dev_addr,
wpabuf_head(resp), wpabuf_len(resp), 200) < 0) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: Failed to send Action frame");
p2p_dbg(p2p, "Failed to send Action frame");
}
wpabuf_free(resp);
@ -264,24 +256,20 @@ void p2p_process_prov_disc_resp(struct p2p_data *p2p, const u8 *sa,
if (p2p_parse(data, len, &msg))
return;
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: Received Provision Discovery Response from " MACSTR
p2p_dbg(p2p, "Received Provision Discovery Response from " MACSTR
" with config methods 0x%x",
MAC2STR(sa), msg.wps_config_methods);
dev = p2p_get_device(p2p, sa);
if (dev == NULL || !dev->req_config_methods) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: Ignore Provision Discovery Response from "
MACSTR " with no pending request", MAC2STR(sa));
p2p_dbg(p2p, "Ignore Provision Discovery Response from " MACSTR
" with no pending request", MAC2STR(sa));
p2p_parse_free(&msg);
return;
}
if (dev->dialog_token != msg.dialog_token) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: Ignore Provision Discovery Response with "
"unexpected Dialog Token %u (expected %u)",
p2p_dbg(p2p, "Ignore Provision Discovery Response with unexpected Dialog Token %u (expected %u)",
msg.dialog_token, dev->dialog_token);
p2p_parse_free(&msg);
return;
@ -307,9 +295,7 @@ void p2p_process_prov_disc_resp(struct p2p_data *p2p, const u8 *sa,
p2p_reset_pending_pd(p2p);
if (msg.wps_config_methods != req_config_methods) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG, "P2P: Peer rejected "
"our Provision Discovery Request (received "
"config_methods 0x%x expected 0x%x",
p2p_dbg(p2p, "Peer rejected our Provision Discovery Request (received config_methods 0x%x expected 0x%x",
msg.wps_config_methods, req_config_methods);
if (p2p->cfg->prov_disc_fail)
p2p->cfg->prov_disc_fail(p2p->cfg->cb_ctx, sa,
@ -322,11 +308,11 @@ void p2p_process_prov_disc_resp(struct p2p_data *p2p, const u8 *sa,
dev->flags &= ~(P2P_DEV_PD_PEER_DISPLAY |
P2P_DEV_PD_PEER_KEYPAD);
if (req_config_methods & WPS_CONFIG_DISPLAY) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG, "P2P: Peer " MACSTR
p2p_dbg(p2p, "Peer " MACSTR
" accepted to show a PIN on display", MAC2STR(sa));
dev->flags |= P2P_DEV_PD_PEER_DISPLAY;
} else if (msg.wps_config_methods & WPS_CONFIG_KEYPAD) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG, "P2P: Peer " MACSTR
p2p_dbg(p2p, "Peer " MACSTR
" accepted to write our PIN using keypad",
MAC2STR(sa));
dev->flags |= P2P_DEV_PD_PEER_KEYPAD;
@ -342,10 +328,8 @@ out:
dev->req_config_methods = 0;
p2p->cfg->send_action_done(p2p->cfg->cb_ctx);
if (dev->flags & P2P_DEV_PD_BEFORE_GO_NEG) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: Start GO Neg after the PD-before-GO-Neg "
"workaround with " MACSTR,
MAC2STR(dev->info.p2p_device_addr));
p2p_dbg(p2p, "Start GO Neg after the PD-before-GO-Neg workaround with "
MACSTR, MAC2STR(dev->info.p2p_device_addr));
dev->flags &= ~P2P_DEV_PD_BEFORE_GO_NEG;
p2p_connect_send(p2p, dev);
return;
@ -373,9 +357,8 @@ int p2p_send_prov_disc_req(struct p2p_data *p2p, struct p2p_device *dev,
freq = dev->listen_freq > 0 ? dev->listen_freq :
dev->oper_freq;
if (freq <= 0) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: No Listen/Operating frequency known for the "
"peer " MACSTR " to send Provision Discovery Request",
p2p_dbg(p2p, "No Listen/Operating frequency known for the peer "
MACSTR " to send Provision Discovery Request",
MAC2STR(dev->info.p2p_device_addr));
return -1;
}
@ -383,8 +366,7 @@ int p2p_send_prov_disc_req(struct p2p_data *p2p, struct p2p_device *dev,
if (dev->flags & P2P_DEV_GROUP_CLIENT_ONLY) {
if (!(dev->info.dev_capab &
P2P_DEV_CAPAB_CLIENT_DISCOVERABILITY)) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: Cannot use PD with P2P Device " MACSTR
p2p_dbg(p2p, "Cannot use PD with P2P Device " MACSTR
" that is in a group and is not discoverable",
MAC2STR(dev->info.p2p_device_addr));
return -1;
@ -404,8 +386,7 @@ int p2p_send_prov_disc_req(struct p2p_data *p2p, struct p2p_device *dev,
if (p2p_send_action(p2p, freq, dev->info.p2p_device_addr,
p2p->cfg->dev_addr, dev->info.p2p_device_addr,
wpabuf_head(req), wpabuf_len(req), 200) < 0) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: Failed to send Action frame");
p2p_dbg(p2p, "Failed to send Action frame");
wpabuf_free(req);
return -1;
}
@ -427,14 +408,13 @@ int p2p_prov_disc_req(struct p2p_data *p2p, const u8 *peer_addr,
if (dev == NULL)
dev = p2p_get_device_interface(p2p, peer_addr);
if (dev == NULL || (dev->flags & P2P_DEV_PROBE_REQ_ONLY)) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG, "P2P: Provision "
"Discovery Request destination " MACSTR
p2p_dbg(p2p, "Provision Discovery Request destination " MACSTR
" not yet known", MAC2STR(peer_addr));
return -1;
}
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG, "P2P: Provision Discovery "
"Request with " MACSTR " (config methods 0x%x)",
p2p_dbg(p2p, "Provision Discovery Request with " MACSTR
" (config methods 0x%x)",
MAC2STR(peer_addr), config_methods);
if (config_methods == 0)
return -1;
@ -450,9 +430,8 @@ int p2p_prov_disc_req(struct p2p_data *p2p, const u8 *peer_addr,
if (p2p->state != P2P_IDLE && p2p->state != P2P_SEARCH &&
p2p->state != P2P_LISTEN_ONLY) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG, "P2P: Busy with other "
"operations; postpone Provision Discovery Request "
"with " MACSTR " (config methods 0x%x)",
p2p_dbg(p2p, "Busy with other operations; postpone Provision Discovery Request with "
MACSTR " (config methods 0x%x)",
MAC2STR(peer_addr), config_methods);
return 0;
}

View File

@ -157,8 +157,7 @@ static void p2p_send_gas_comeback_req(struct p2p_data *p2p, const u8 *dst,
p2p->pending_action_state = P2P_NO_PENDING_ACTION;
if (p2p_send_action(p2p, freq, dst, p2p->cfg->dev_addr, dst,
wpabuf_head(req), wpabuf_len(req), 200) < 0)
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: Failed to send Action frame");
p2p_dbg(p2p, "Failed to send Action frame");
wpabuf_free(req);
}
@ -235,9 +234,8 @@ int p2p_start_sd(struct p2p_data *p2p, struct p2p_device *dev)
freq = dev->listen_freq > 0 ? dev->listen_freq : dev->oper_freq;
if (freq <= 0) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: No Listen/Operating frequency known for the "
"peer " MACSTR " to send SD Request",
p2p_dbg(p2p, "No Listen/Operating frequency known for the peer "
MACSTR " to send SD Request",
MAC2STR(dev->info.p2p_device_addr));
return -1;
}
@ -246,8 +244,7 @@ int p2p_start_sd(struct p2p_data *p2p, struct p2p_device *dev)
if (query == NULL)
return -1;
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: Start Service Discovery with " MACSTR,
p2p_dbg(p2p, "Start Service Discovery with " MACSTR,
MAC2STR(dev->info.p2p_device_addr));
req = p2p_build_sd_query(p2p->srv_update_indic, query->tlvs);
@ -261,8 +258,7 @@ int p2p_start_sd(struct p2p_data *p2p, struct p2p_device *dev)
if (p2p_send_action(p2p, freq, dev->info.p2p_device_addr,
p2p->cfg->dev_addr, dev->info.p2p_device_addr,
wpabuf_head(req), wpabuf_len(req), 5000) < 0) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: Failed to send Action frame");
p2p_dbg(p2p, "Failed to send Action frame");
ret = -1;
}
@ -299,14 +295,12 @@ void p2p_rx_gas_initial_req(struct p2p_data *p2p, const u8 *sa,
return;
dialog_token = *pos++;
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: GAS Initial Request from " MACSTR " (dialog token %u, "
"freq %d)",
p2p_dbg(p2p, "GAS Initial Request from " MACSTR
" (dialog token %u, freq %d)",
MAC2STR(sa), dialog_token, rx_freq);
if (*pos != WLAN_EID_ADV_PROTO) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: Unexpected IE in GAS Initial Request: %u", *pos);
p2p_dbg(p2p, "Unexpected IE in GAS Initial Request: %u", *pos);
return;
}
pos++;
@ -314,15 +308,13 @@ void p2p_rx_gas_initial_req(struct p2p_data *p2p, const u8 *sa,
slen = *pos++;
next = pos + slen;
if (next > end || slen < 2) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: Invalid IE in GAS Initial Request");
p2p_dbg(p2p, "Invalid IE in GAS Initial Request");
return;
}
pos++; /* skip QueryRespLenLimit and PAME-BI */
if (*pos != ACCESS_NETWORK_QUERY_PROTOCOL) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: Unsupported GAS advertisement protocol id %u",
p2p_dbg(p2p, "Unsupported GAS advertisement protocol id %u",
*pos);
return;
}
@ -341,8 +333,7 @@ void p2p_rx_gas_initial_req(struct p2p_data *p2p, const u8 *sa,
if (pos + 4 > end)
return;
if (WPA_GET_LE16(pos) != ANQP_VENDOR_SPECIFIC) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: Unsupported ANQP Info ID %u", WPA_GET_LE16(pos));
p2p_dbg(p2p, "Unsupported ANQP Info ID %u", WPA_GET_LE16(pos));
return;
}
pos += 2;
@ -350,21 +341,18 @@ void p2p_rx_gas_initial_req(struct p2p_data *p2p, const u8 *sa,
slen = WPA_GET_LE16(pos);
pos += 2;
if (pos + slen > end || slen < 3 + 1) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: Invalid ANQP Query Request length");
p2p_dbg(p2p, "Invalid ANQP Query Request length");
return;
}
if (WPA_GET_BE24(pos) != OUI_WFA) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: Unsupported ANQP OUI %06x", WPA_GET_BE24(pos));
p2p_dbg(p2p, "Unsupported ANQP OUI %06x", WPA_GET_BE24(pos));
return;
}
pos += 3;
if (*pos != P2P_OUI_TYPE) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: Unsupported ANQP vendor type %u", *pos);
p2p_dbg(p2p, "Unsupported ANQP vendor type %u", *pos);
return;
}
pos++;
@ -372,8 +360,7 @@ void p2p_rx_gas_initial_req(struct p2p_data *p2p, const u8 *sa,
if (pos + 2 > end)
return;
update_indic = WPA_GET_LE16(pos);
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: Service Update Indicator: %u", update_indic);
p2p_dbg(p2p, "Service Update Indicator: %u", update_indic);
pos += 2;
p2p->cfg->sd_request(p2p->cfg->cb_ctx, freq, sa, dialog_token,
@ -389,8 +376,7 @@ void p2p_sd_response(struct p2p_data *p2p, int freq, const u8 *dst,
/* TODO: fix the length limit to match with the maximum frame length */
if (wpabuf_len(resp_tlvs) > 1400) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG, "P2P: SD response long "
"enough to require fragmentation");
p2p_dbg(p2p, "SD response long enough to require fragmentation");
if (p2p->sd_resp) {
/*
* TODO: Could consider storing the fragmented response
@ -399,14 +385,12 @@ void p2p_sd_response(struct p2p_data *p2p, int freq, const u8 *dst,
* Though, that would eat more memory, so there are
* also benefits to just using a single buffer.
*/
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG, "P2P: Drop "
"previous SD response");
p2p_dbg(p2p, "Drop previous SD response");
wpabuf_free(p2p->sd_resp);
}
p2p->sd_resp = wpabuf_dup(resp_tlvs);
if (p2p->sd_resp == NULL) {
wpa_msg(p2p->cfg->msg_ctx, MSG_ERROR, "P2P: Failed to "
"allocate SD response fragmentation area");
p2p_err(p2p, "Failed to allocate SD response fragmentation area");
return;
}
os_memcpy(p2p->sd_resp_addr, dst, ETH_ALEN);
@ -416,8 +400,7 @@ void p2p_sd_response(struct p2p_data *p2p, int freq, const u8 *dst,
resp = p2p_build_sd_response(dialog_token, WLAN_STATUS_SUCCESS,
1, p2p->srv_update_indic, NULL);
} else {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG, "P2P: SD response fits "
"in initial response");
p2p_dbg(p2p, "SD response fits in initial response");
resp = p2p_build_sd_response(dialog_token,
WLAN_STATUS_SUCCESS, 0,
p2p->srv_update_indic, resp_tlvs);
@ -429,8 +412,7 @@ void p2p_sd_response(struct p2p_data *p2p, int freq, const u8 *dst,
if (p2p_send_action(p2p, freq, dst, p2p->cfg->dev_addr,
p2p->cfg->dev_addr,
wpabuf_head(resp), wpabuf_len(resp), 200) < 0)
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: Failed to send Action frame");
p2p_dbg(p2p, "Failed to send Action frame");
wpabuf_free(resp);
}
@ -450,21 +432,18 @@ void p2p_rx_gas_initial_resp(struct p2p_data *p2p, const u8 *sa,
if (p2p->state != P2P_SD_DURING_FIND || p2p->sd_peer == NULL ||
os_memcmp(sa, p2p->sd_peer->info.p2p_device_addr, ETH_ALEN) != 0) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: Ignore unexpected GAS Initial Response from "
p2p_dbg(p2p, "Ignore unexpected GAS Initial Response from "
MACSTR, MAC2STR(sa));
return;
}
p2p->cfg->send_action_done(p2p->cfg->cb_ctx);
p2p_clear_timeout(p2p);
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: Received GAS Initial Response from " MACSTR " (len=%d)",
p2p_dbg(p2p, "Received GAS Initial Response from " MACSTR " (len=%d)",
MAC2STR(sa), (int) len);
if (len < 5 + 2) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: Too short GAS Initial Response frame");
p2p_dbg(p2p, "Too short GAS Initial Response frame");
return;
}
@ -474,20 +453,16 @@ void p2p_rx_gas_initial_resp(struct p2p_data *p2p, const u8 *sa,
pos += 2;
comeback_delay = WPA_GET_LE16(pos);
pos += 2;
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: dialog_token=%u status_code=%u comeback_delay=%u",
p2p_dbg(p2p, "dialog_token=%u status_code=%u comeback_delay=%u",
dialog_token, status_code, comeback_delay);
if (status_code) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: Service Discovery failed: status code %u",
p2p_dbg(p2p, "Service Discovery failed: status code %u",
status_code);
return;
}
if (*pos != WLAN_EID_ADV_PROTO) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: Unexpected IE in GAS Initial Response: %u",
*pos);
p2p_dbg(p2p, "Unexpected IE in GAS Initial Response: %u", *pos);
return;
}
pos++;
@ -495,15 +470,13 @@ void p2p_rx_gas_initial_resp(struct p2p_data *p2p, const u8 *sa,
slen = *pos++;
next = pos + slen;
if (next > end || slen < 2) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: Invalid IE in GAS Initial Response");
p2p_dbg(p2p, "Invalid IE in GAS Initial Response");
return;
}
pos++; /* skip QueryRespLenLimit and PAME-BI */
if (*pos != ACCESS_NETWORK_QUERY_PROTOCOL) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: Unsupported GAS advertisement protocol id %u",
p2p_dbg(p2p, "Unsupported GAS advertisement protocol id %u",
*pos);
return;
}
@ -511,27 +484,22 @@ void p2p_rx_gas_initial_resp(struct p2p_data *p2p, const u8 *sa,
pos = next;
/* Query Response */
if (pos + 2 > end) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG, "P2P: Too short Query "
"Response");
p2p_dbg(p2p, "Too short Query Response");
return;
}
slen = WPA_GET_LE16(pos);
pos += 2;
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG, "P2P: Query Response Length: %d",
slen);
p2p_dbg(p2p, "Query Response Length: %d", slen);
if (pos + slen > end) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG, "P2P: Not enough Query "
"Response data");
p2p_dbg(p2p, "Not enough Query Response data");
return;
}
end = pos + slen;
if (comeback_delay) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG, "P2P: Fragmented "
"response - request fragments");
p2p_dbg(p2p, "Fragmented response - request fragments");
if (p2p->sd_rx_resp) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG, "P2P: Drop "
"old SD reassembly buffer");
p2p_dbg(p2p, "Drop old SD reassembly buffer");
wpabuf_free(p2p->sd_rx_resp);
p2p->sd_rx_resp = NULL;
}
@ -543,8 +511,7 @@ void p2p_rx_gas_initial_resp(struct p2p_data *p2p, const u8 *sa,
if (pos + 4 > end)
return;
if (WPA_GET_LE16(pos) != ANQP_VENDOR_SPECIFIC) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: Unsupported ANQP Info ID %u", WPA_GET_LE16(pos));
p2p_dbg(p2p, "Unsupported ANQP Info ID %u", WPA_GET_LE16(pos));
return;
}
pos += 2;
@ -552,21 +519,18 @@ void p2p_rx_gas_initial_resp(struct p2p_data *p2p, const u8 *sa,
slen = WPA_GET_LE16(pos);
pos += 2;
if (pos + slen > end || slen < 3 + 1) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: Invalid ANQP Query Response length");
p2p_dbg(p2p, "Invalid ANQP Query Response length");
return;
}
if (WPA_GET_BE24(pos) != OUI_WFA) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: Unsupported ANQP OUI %06x", WPA_GET_BE24(pos));
p2p_dbg(p2p, "Unsupported ANQP OUI %06x", WPA_GET_BE24(pos));
return;
}
pos += 3;
if (*pos != P2P_OUI_TYPE) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: Unsupported ANQP vendor type %u", *pos);
p2p_dbg(p2p, "Unsupported ANQP vendor type %u", *pos);
return;
}
pos++;
@ -574,8 +538,7 @@ void p2p_rx_gas_initial_resp(struct p2p_data *p2p, const u8 *sa,
if (pos + 2 > end)
return;
update_indic = WPA_GET_LE16(pos);
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: Service Update Indicator: %u", update_indic);
p2p_dbg(p2p, "Service Update Indicator: %u", update_indic);
pos += 2;
p2p->sd_peer->flags |= P2P_DEV_SD_INFO;
@ -585,8 +548,7 @@ void p2p_rx_gas_initial_resp(struct p2p_data *p2p, const u8 *sa,
if (p2p->sd_query) {
if (!p2p->sd_query->for_all_peers) {
struct p2p_sd_query *q;
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: Remove completed SD query %p",
p2p_dbg(p2p, "Remove completed SD query %p",
p2p->sd_query);
q = p2p->sd_query;
p2p_unlink_sd_query(p2p, p2p->sd_query);
@ -614,22 +576,20 @@ void p2p_rx_gas_comeback_req(struct p2p_data *p2p, const u8 *sa,
if (len < 1)
return;
dialog_token = *data;
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG, "P2P: Dialog Token: %u",
dialog_token);
p2p_dbg(p2p, "Dialog Token: %u", dialog_token);
if (dialog_token != p2p->sd_resp_dialog_token) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG, "P2P: No pending SD "
"response fragment for dialog token %u", dialog_token);
p2p_dbg(p2p, "No pending SD response fragment for dialog token %u",
dialog_token);
return;
}
if (p2p->sd_resp == NULL) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG, "P2P: No pending SD "
"response fragment available");
p2p_dbg(p2p, "No pending SD response fragment available");
return;
}
if (os_memcmp(sa, p2p->sd_resp_addr, ETH_ALEN) != 0) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG, "P2P: No pending SD "
"response fragment for " MACSTR, MAC2STR(sa));
p2p_dbg(p2p, "No pending SD response fragment for " MACSTR,
MAC2STR(sa));
return;
}
@ -646,19 +606,16 @@ void p2p_rx_gas_comeback_req(struct p2p_data *p2p, const u8 *sa,
wpabuf_len(p2p->sd_resp));
if (resp == NULL)
return;
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG, "P2P: Send GAS Comeback "
"Response (frag_id %d more=%d frag_len=%d)",
p2p_dbg(p2p, "Send GAS Comeback Response (frag_id %d more=%d frag_len=%d)",
p2p->sd_frag_id, more, (int) frag_len);
p2p->sd_frag_id++;
p2p->sd_resp_pos += frag_len;
if (more) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG, "P2P: %d more bytes "
"remain to be sent",
p2p_dbg(p2p, "%d more bytes remain to be sent",
(int) (wpabuf_len(p2p->sd_resp) - p2p->sd_resp_pos));
} else {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG, "P2P: All fragments of "
"SD response sent");
p2p_dbg(p2p, "All fragments of SD response sent");
wpabuf_free(p2p->sd_resp);
p2p->sd_resp = NULL;
}
@ -667,8 +624,7 @@ void p2p_rx_gas_comeback_req(struct p2p_data *p2p, const u8 *sa,
if (p2p_send_action(p2p, rx_freq, sa, p2p->cfg->dev_addr,
p2p->cfg->dev_addr,
wpabuf_head(resp), wpabuf_len(resp), 200) < 0)
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: Failed to send Action frame");
p2p_dbg(p2p, "Failed to send Action frame");
wpabuf_free(resp);
}
@ -691,21 +647,18 @@ void p2p_rx_gas_comeback_resp(struct p2p_data *p2p, const u8 *sa,
if (p2p->state != P2P_SD_DURING_FIND || p2p->sd_peer == NULL ||
os_memcmp(sa, p2p->sd_peer->info.p2p_device_addr, ETH_ALEN) != 0) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: Ignore unexpected GAS Comeback Response from "
p2p_dbg(p2p, "Ignore unexpected GAS Comeback Response from "
MACSTR, MAC2STR(sa));
return;
}
p2p->cfg->send_action_done(p2p->cfg->cb_ctx);
p2p_clear_timeout(p2p);
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: Received GAS Comeback Response from " MACSTR " (len=%d)",
p2p_dbg(p2p, "Received GAS Comeback Response from " MACSTR " (len=%d)",
MAC2STR(sa), (int) len);
if (len < 6 + 2) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: Too short GAS Comeback Response frame");
p2p_dbg(p2p, "Too short GAS Comeback Response frame");
return;
}
@ -718,22 +671,19 @@ void p2p_rx_gas_comeback_resp(struct p2p_data *p2p, const u8 *sa,
pos++;
comeback_delay = WPA_GET_LE16(pos);
pos += 2;
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: dialog_token=%u status_code=%u frag_id=%d more_frags=%d "
p2p_dbg(p2p, "dialog_token=%u status_code=%u frag_id=%d more_frags=%d "
"comeback_delay=%u",
dialog_token, status_code, frag_id, more_frags,
comeback_delay);
/* TODO: check frag_id match */
if (status_code) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: Service Discovery failed: status code %u",
p2p_dbg(p2p, "Service Discovery failed: status code %u",
status_code);
return;
}
if (*pos != WLAN_EID_ADV_PROTO) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: Unexpected IE in GAS Comeback Response: %u",
p2p_dbg(p2p, "Unexpected IE in GAS Comeback Response: %u",
*pos);
return;
}
@ -742,15 +692,13 @@ void p2p_rx_gas_comeback_resp(struct p2p_data *p2p, const u8 *sa,
slen = *pos++;
next = pos + slen;
if (next > end || slen < 2) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: Invalid IE in GAS Comeback Response");
p2p_dbg(p2p, "Invalid IE in GAS Comeback Response");
return;
}
pos++; /* skip QueryRespLenLimit and PAME-BI */
if (*pos != ACCESS_NETWORK_QUERY_PROTOCOL) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: Unsupported GAS advertisement protocol id %u",
p2p_dbg(p2p, "Unsupported GAS advertisement protocol id %u",
*pos);
return;
}
@ -758,22 +706,18 @@ void p2p_rx_gas_comeback_resp(struct p2p_data *p2p, const u8 *sa,
pos = next;
/* Query Response */
if (pos + 2 > end) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG, "P2P: Too short Query "
"Response");
p2p_dbg(p2p, "Too short Query Response");
return;
}
slen = WPA_GET_LE16(pos);
pos += 2;
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG, "P2P: Query Response Length: %d",
slen);
p2p_dbg(p2p, "Query Response Length: %d", slen);
if (pos + slen > end) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG, "P2P: Not enough Query "
"Response data");
p2p_dbg(p2p, "Not enough Query Response data");
return;
}
if (slen == 0) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG, "P2P: No Query Response "
"data");
p2p_dbg(p2p, "No Query Response data");
return;
}
end = pos + slen;
@ -790,34 +734,29 @@ void p2p_rx_gas_comeback_resp(struct p2p_data *p2p, const u8 *sa,
if (pos + 4 > end)
return;
if (WPA_GET_LE16(pos) != ANQP_VENDOR_SPECIFIC) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: Unsupported ANQP Info ID %u", WPA_GET_LE16(pos));
p2p_dbg(p2p, "Unsupported ANQP Info ID %u", WPA_GET_LE16(pos));
return;
}
pos += 2;
slen = WPA_GET_LE16(pos);
pos += 2;
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG, "P2P: ANQP Query Response "
"length: %u", slen);
p2p_dbg(p2p, "ANQP Query Response length: %u", slen);
if (slen < 3 + 1) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: Invalid ANQP Query Response length");
p2p_dbg(p2p, "Invalid ANQP Query Response length");
return;
}
if (pos + 4 > end)
return;
if (WPA_GET_BE24(pos) != OUI_WFA) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: Unsupported ANQP OUI %06x", WPA_GET_BE24(pos));
p2p_dbg(p2p, "Unsupported ANQP OUI %06x", WPA_GET_BE24(pos));
return;
}
pos += 3;
if (*pos != P2P_OUI_TYPE) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: Unsupported ANQP vendor type %u", *pos);
p2p_dbg(p2p, "Unsupported ANQP vendor type %u", *pos);
return;
}
pos++;
@ -825,27 +764,23 @@ void p2p_rx_gas_comeback_resp(struct p2p_data *p2p, const u8 *sa,
if (pos + 2 > end)
return;
p2p->sd_rx_update_indic = WPA_GET_LE16(pos);
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: Service Update Indicator: %u", p2p->sd_rx_update_indic);
p2p_dbg(p2p, "Service Update Indicator: %u", p2p->sd_rx_update_indic);
pos += 2;
skip_nqp_header:
if (wpabuf_resize(&p2p->sd_rx_resp, end - pos) < 0)
return;
wpabuf_put_data(p2p->sd_rx_resp, pos, end - pos);
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG, "P2P: Current SD reassembly "
"buffer length: %u",
p2p_dbg(p2p, "Current SD reassembly buffer length: %u",
(unsigned int) wpabuf_len(p2p->sd_rx_resp));
if (more_frags) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG, "P2P: More fragments "
"remains");
p2p_dbg(p2p, "More fragments remains");
/* TODO: what would be a good size limit? */
if (wpabuf_len(p2p->sd_rx_resp) > 64000) {
wpabuf_free(p2p->sd_rx_resp);
p2p->sd_rx_resp = NULL;
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG, "P2P: Too long "
"SD response - drop it");
p2p_dbg(p2p, "Too long SD response - drop it");
return;
}
p2p_send_gas_comeback_req(p2p, sa, dialog_token, rx_freq);
@ -859,8 +794,7 @@ skip_nqp_header:
if (p2p->sd_query) {
if (!p2p->sd_query->for_all_peers) {
struct p2p_sd_query *q;
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: Remove completed SD query %p",
p2p_dbg(p2p, "Remove completed SD query %p",
p2p->sd_query);
q = p2p->sd_query;
p2p_unlink_sd_query(p2p, p2p->sd_query);
@ -903,7 +837,7 @@ void * p2p_sd_request(struct p2p_data *p2p, const u8 *dst,
q->next = p2p->sd_queries;
p2p->sd_queries = q;
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG, "P2P: Added SD Query %p", q);
p2p_dbg(p2p, "Added SD Query %p", q);
if (dst == NULL) {
struct p2p_device *dev;
@ -937,8 +871,7 @@ void p2p_sd_service_update(struct p2p_data *p2p)
int p2p_sd_cancel_request(struct p2p_data *p2p, void *req)
{
if (p2p_unlink_sd_query(p2p, req)) {
wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG,
"P2P: Cancel pending SD query %p", req);
p2p_dbg(p2p, "Cancel pending SD query %p", req);
p2p_free_sd_query(req);
return 0;
}

View File

@ -2929,6 +2929,13 @@ static int wpas_go_connected(void *ctx, const u8 *dev_addr)
}
static void wpas_p2p_debug_print(void *ctx, int level, const char *msg)
{
struct wpa_supplicant *wpa_s = ctx;
wpa_msg(wpa_s, level, "P2P: %s", msg);
}
/**
* wpas_p2p_init - Initialize P2P module for %wpa_supplicant
* @global: Pointer to global data from wpa_supplicant_init()
@ -2967,8 +2974,8 @@ int wpas_p2p_init(struct wpa_global *global, struct wpa_supplicant *wpa_s)
}
os_memset(&p2p, 0, sizeof(p2p));
p2p.msg_ctx = wpa_s;
p2p.cb_ctx = wpa_s;
p2p.debug_print = wpas_p2p_debug_print;
p2p.p2p_scan = wpas_p2p_scan;
p2p.send_action = wpas_send_action;
p2p.send_action_done = wpas_send_action_done;