P2P: Mark P2P events global (not specific to interface)

This removes the "IFNAME=<ifname> " prefix from P2P events that are
received through the global control interface since these events are not
really specific to any network interface, but the full device.

Signed-hostap: Jouni Malinen <j@w1.fi>
This commit is contained in:
Jouni Malinen 2013-05-18 18:59:51 +03:00
parent ed496f131f
commit 92c4465b75

View file

@ -306,7 +306,7 @@ static int wpas_p2p_group_delete(struct wpa_supplicant *wpa_s,
gtype = "GO";
if (wpa_s->cross_connect_in_use) {
wpa_s->cross_connect_in_use = 0;
wpa_msg(wpa_s->parent, MSG_INFO,
wpa_msg_global(wpa_s->parent, MSG_INFO,
P2P_EVENT_CROSS_CONNECT_DISABLE "%s %s",
wpa_s->ifname, wpa_s->cross_connect_uplink);
}
@ -331,7 +331,7 @@ static int wpas_p2p_group_delete(struct wpa_supplicant *wpa_s,
break;
}
if (removal_reason != P2P_GROUP_REMOVAL_SILENT) {
wpa_msg(wpa_s->parent, MSG_INFO,
wpa_msg_global(wpa_s->parent, MSG_INFO,
P2P_EVENT_GROUP_REMOVED "%s %s%s",
wpa_s->ifname, gtype, reason);
}
@ -640,14 +640,15 @@ static void wpas_group_formation_completed(struct wpa_supplicant *wpa_s,
wpa_s->p2p_in_provisioning = 0;
if (!success) {
wpa_msg(wpa_s->parent, MSG_INFO,
wpa_msg_global(wpa_s->parent, MSG_INFO,
P2P_EVENT_GROUP_FORMATION_FAILURE);
wpas_p2p_group_delete(wpa_s,
P2P_GROUP_REMOVAL_FORMATION_FAILED);
return;
}
wpa_msg(wpa_s->parent, MSG_INFO, P2P_EVENT_GROUP_FORMATION_SUCCESS);
wpa_msg_global(wpa_s->parent, MSG_INFO,
P2P_EVENT_GROUP_FORMATION_SUCCESS);
ssid = wpa_s->current_ssid;
if (ssid && ssid->mode == WPAS_MODE_P2P_GROUP_FORMATION) {
@ -687,19 +688,20 @@ static void wpas_group_formation_completed(struct wpa_supplicant *wpa_s,
} else if (ssid && ssid->passphrase == NULL && ssid->psk_set) {
char psk[65];
wpa_snprintf_hex(psk, sizeof(psk), ssid->psk, 32);
wpa_msg(wpa_s->parent, MSG_INFO, P2P_EVENT_GROUP_STARTED
"%s GO ssid=\"%s\" freq=%d psk=%s go_dev_addr=" MACSTR
"%s",
wpa_msg_global(wpa_s->parent, MSG_INFO, P2P_EVENT_GROUP_STARTED
"%s GO ssid=\"%s\" freq=%d psk=%s go_dev_addr="
MACSTR "%s",
wpa_s->ifname, ssid_txt, ssid->frequency, psk,
MAC2STR(go_dev_addr),
persistent ? " [PERSISTENT]" : "");
wpas_p2p_cross_connect_setup(wpa_s);
wpas_p2p_set_group_idle_timeout(wpa_s);
} else {
wpa_msg(wpa_s->parent, MSG_INFO, P2P_EVENT_GROUP_STARTED
wpa_msg_global(wpa_s->parent, MSG_INFO, P2P_EVENT_GROUP_STARTED
"%s GO ssid=\"%s\" freq=%d passphrase=\"%s\" "
"go_dev_addr=" MACSTR "%s",
wpa_s->ifname, ssid_txt, ssid ? ssid->frequency : 0,
wpa_s->ifname, ssid_txt,
ssid ? ssid->frequency : 0,
ssid && ssid->passphrase ? ssid->passphrase : "",
MAC2STR(go_dev_addr),
persistent ? " [PERSISTENT]" : "");
@ -825,26 +827,30 @@ static void p2p_go_configured(void *ctx, void *data)
if (wpa_s->global->p2p_group_formation == wpa_s)
wpa_s->global->p2p_group_formation = NULL;
if (os_strlen(params->passphrase) > 0) {
wpa_msg(wpa_s->parent, MSG_INFO, P2P_EVENT_GROUP_STARTED
"%s GO ssid=\"%s\" freq=%d passphrase=\"%s\" "
"go_dev_addr=" MACSTR "%s", wpa_s->ifname,
wpa_msg_global(wpa_s->parent, MSG_INFO,
P2P_EVENT_GROUP_STARTED
"%s GO ssid=\"%s\" freq=%d "
"passphrase=\"%s\" go_dev_addr=" MACSTR
"%s", wpa_s->ifname,
wpa_ssid_txt(ssid->ssid, ssid->ssid_len),
ssid->frequency, params->passphrase,
MAC2STR(wpa_s->global->p2p_dev_addr),
params->persistent_group ? " [PERSISTENT]" :
"");
params->persistent_group ?
" [PERSISTENT]" : "");
} else {
char psk[65];
wpa_snprintf_hex(psk, sizeof(psk), params->psk,
sizeof(params->psk));
wpa_msg(wpa_s->parent, MSG_INFO, P2P_EVENT_GROUP_STARTED
wpa_msg_global(wpa_s->parent, MSG_INFO,
P2P_EVENT_GROUP_STARTED
"%s GO ssid=\"%s\" freq=%d psk=%s "
"go_dev_addr=" MACSTR "%s", wpa_s->ifname,
"go_dev_addr=" MACSTR "%s",
wpa_s->ifname,
wpa_ssid_txt(ssid->ssid, ssid->ssid_len),
ssid->frequency, psk,
MAC2STR(wpa_s->global->p2p_dev_addr),
params->persistent_group ? " [PERSISTENT]" :
"");
params->persistent_group ?
" [PERSISTENT]" : "");
}
if (params->persistent_group)
@ -918,8 +924,8 @@ static void wpas_start_wps_go(struct wpa_supplicant *wpa_s,
if (os_strlen(params->passphrase) > 0) {
ssid->passphrase = os_strdup(params->passphrase);
if (ssid->passphrase == NULL) {
wpa_msg(wpa_s, MSG_ERROR, "P2P: Failed to copy "
"passphrase for GO");
wpa_msg_global(wpa_s, MSG_ERROR,
"P2P: Failed to copy passphrase for GO");
wpa_config_remove_network(wpa_s->conf, ssid->id);
return;
}
@ -1115,7 +1121,8 @@ void wpas_go_neg_completed(void *ctx, struct p2p_go_neg_results *res)
}
if (res->status) {
wpa_msg(wpa_s, MSG_INFO, P2P_EVENT_GO_NEG_FAILURE "status=%d",
wpa_msg_global(wpa_s, MSG_INFO,
P2P_EVENT_GO_NEG_FAILURE "status=%d",
res->status);
wpas_notify_p2p_go_neg_completed(wpa_s, res);
wpas_p2p_remove_pending_group_interface(wpa_s);
@ -1125,7 +1132,7 @@ void wpas_go_neg_completed(void *ctx, struct p2p_go_neg_results *res)
if (wpa_s->p2p_go_ht40)
res->ht40 = 1;
wpa_msg(wpa_s, MSG_INFO, P2P_EVENT_GO_NEG_SUCCESS);
wpa_msg_global(wpa_s, MSG_INFO, P2P_EVENT_GO_NEG_SUCCESS);
wpas_notify_p2p_go_neg_completed(wpa_s, res);
if (res->role_go && wpa_s->p2p_persistent_id >= 0) {
@ -1185,7 +1192,7 @@ void wpas_go_neg_completed(void *ctx, struct p2p_go_neg_results *res)
void wpas_go_neg_req_rx(void *ctx, const u8 *src, u16 dev_passwd_id)
{
struct wpa_supplicant *wpa_s = ctx;
wpa_msg(wpa_s, MSG_INFO, P2P_EVENT_GO_NEG_REQUEST MACSTR
wpa_msg_global(wpa_s, MSG_INFO, P2P_EVENT_GO_NEG_REQUEST MACSTR
" dev_passwd_id=%u", MAC2STR(src), dev_passwd_id);
wpas_notify_p2p_go_neg_req(wpa_s, src, dev_passwd_id);
@ -1200,7 +1207,7 @@ void wpas_dev_found(void *ctx, const u8 *addr,
struct wpa_supplicant *wpa_s = ctx;
char devtype[WPS_DEV_TYPE_BUFSIZE];
wpa_msg(wpa_s, MSG_INFO, P2P_EVENT_DEVICE_FOUND MACSTR
wpa_msg_global(wpa_s, MSG_INFO, P2P_EVENT_DEVICE_FOUND MACSTR
" p2p_dev_addr=" MACSTR
" pri_dev_type=%s name='%s' config_methods=0x%x "
"dev_capab=0x%x group_capab=0x%x",
@ -1219,7 +1226,7 @@ static void wpas_dev_lost(void *ctx, const u8 *dev_addr)
{
struct wpa_supplicant *wpa_s = ctx;
wpa_msg(wpa_s, MSG_INFO, P2P_EVENT_DEVICE_LOST
wpa_msg_global(wpa_s, MSG_INFO, P2P_EVENT_DEVICE_LOST
"p2p_dev_addr=" MACSTR, MAC2STR(dev_addr));
wpas_notify_p2p_device_lost(wpa_s, dev_addr);
@ -1229,7 +1236,7 @@ static void wpas_dev_lost(void *ctx, const u8 *dev_addr)
static void wpas_find_stopped(void *ctx)
{
struct wpa_supplicant *wpa_s = ctx;
wpa_msg(wpa_s, MSG_INFO, P2P_EVENT_FIND_STOPPED);
wpa_msg_global(wpa_s, MSG_INFO, P2P_EVENT_FIND_STOPPED);
}
@ -2214,16 +2221,16 @@ static void wpas_prov_disc_local_display(struct wpa_supplicant *wpa_s,
const u8 *peer, const char *params,
unsigned int generated_pin)
{
wpa_msg(wpa_s, MSG_INFO, P2P_EVENT_PROV_DISC_SHOW_PIN MACSTR " %08d%s",
MAC2STR(peer), generated_pin, params);
wpa_msg_global(wpa_s, MSG_INFO, P2P_EVENT_PROV_DISC_SHOW_PIN MACSTR
" %08d%s", MAC2STR(peer), generated_pin, params);
}
static void wpas_prov_disc_local_keypad(struct wpa_supplicant *wpa_s,
const u8 *peer, const char *params)
{
wpa_msg(wpa_s, MSG_INFO, P2P_EVENT_PROV_DISC_ENTER_PIN MACSTR "%s",
MAC2STR(peer), params);
wpa_msg_global(wpa_s, MSG_INFO, P2P_EVENT_PROV_DISC_ENTER_PIN MACSTR
"%s", MAC2STR(peer), params);
}
@ -2275,8 +2282,8 @@ void wpas_prov_disc_req(void *ctx, const u8 *peer, u16 config_methods,
} else if (config_methods & WPS_CONFIG_KEYPAD)
wpas_prov_disc_local_keypad(wpa_s, peer, params);
else if (config_methods & WPS_CONFIG_PUSHBUTTON)
wpa_msg(wpa_s, MSG_INFO, P2P_EVENT_PROV_DISC_PBC_REQ MACSTR
"%s", MAC2STR(peer), params);
wpa_msg_global(wpa_s, MSG_INFO, P2P_EVENT_PROV_DISC_PBC_REQ
MACSTR "%s", MAC2STR(peer), params);
wpas_notify_p2p_provision_discovery(wpa_s, peer, 1 /* request */,
P2P_PROV_DISC_SUCCESS,
@ -2314,8 +2321,8 @@ void wpas_prov_disc_resp(void *ctx, const u8 *peer, u16 config_methods)
wpas_prov_disc_local_display(wpa_s, peer, params,
generated_pin);
} else if (config_methods & WPS_CONFIG_PUSHBUTTON)
wpa_msg(wpa_s, MSG_INFO, P2P_EVENT_PROV_DISC_PBC_RESP MACSTR
"%s", MAC2STR(peer), params);
wpa_msg_global(wpa_s, MSG_INFO, P2P_EVENT_PROV_DISC_PBC_RESP
MACSTR "%s", MAC2STR(peer), params);
wpas_notify_p2p_provision_discovery(wpa_s, peer, 0 /* response */,
P2P_PROV_DISC_SUCCESS,
@ -2344,7 +2351,7 @@ static void wpas_prov_disc_fail(void *ctx, const u8 *peer,
return;
}
wpa_msg(wpa_s, MSG_INFO, P2P_EVENT_PROV_DISC_FAILURE
wpa_msg_global(wpa_s, MSG_INFO, P2P_EVENT_PROV_DISC_FAILURE
" p2p_dev_addr=" MACSTR " status=%d",
MAC2STR(peer), status);
@ -2497,13 +2504,15 @@ static void wpas_invitation_received(void *ctx, const u8 *sa, const u8 *bssid,
if (!s) {
if (bssid) {
wpa_msg(wpa_s, MSG_INFO, P2P_EVENT_INVITATION_RECEIVED
wpa_msg_global(wpa_s, MSG_INFO,
P2P_EVENT_INVITATION_RECEIVED
"sa=" MACSTR " go_dev_addr=" MACSTR
" bssid=" MACSTR " unknown-network",
MAC2STR(sa), MAC2STR(go_dev_addr),
MAC2STR(bssid));
} else {
wpa_msg(wpa_s, MSG_INFO, P2P_EVENT_INVITATION_RECEIVED
wpa_msg_global(wpa_s, MSG_INFO,
P2P_EVENT_INVITATION_RECEIVED
"sa=" MACSTR " go_dev_addr=" MACSTR
" unknown-network",
MAC2STR(sa), MAC2STR(go_dev_addr));
@ -2512,12 +2521,13 @@ static void wpas_invitation_received(void *ctx, const u8 *sa, const u8 *bssid,
}
if (s->mode == WPAS_MODE_P2P_GO && op_freq) {
wpa_msg(wpa_s, MSG_INFO, P2P_EVENT_INVITATION_RECEIVED "sa="
MACSTR " persistent=%d freq=%d",
wpa_msg_global(wpa_s, MSG_INFO, P2P_EVENT_INVITATION_RECEIVED
"sa=" MACSTR " persistent=%d freq=%d",
MAC2STR(sa), s->id, op_freq);
} else {
wpa_msg(wpa_s, MSG_INFO, P2P_EVENT_INVITATION_RECEIVED "sa="
MACSTR " persistent=%d", MAC2STR(sa), s->id);
wpa_msg_global(wpa_s, MSG_INFO, P2P_EVENT_INVITATION_RECEIVED
"sa=" MACSTR " persistent=%d",
MAC2STR(sa), s->id);
}
}
@ -2589,11 +2599,11 @@ static void wpas_invitation_result(void *ctx, int status, const u8 *bssid,
struct wpa_ssid *ssid;
if (bssid) {
wpa_msg(wpa_s, MSG_INFO, P2P_EVENT_INVITATION_RESULT
wpa_msg_global(wpa_s, MSG_INFO, P2P_EVENT_INVITATION_RESULT
"status=%d " MACSTR,
status, MAC2STR(bssid));
} else {
wpa_msg(wpa_s, MSG_INFO, P2P_EVENT_INVITATION_RESULT
wpa_msg_global(wpa_s, MSG_INFO, P2P_EVENT_INVITATION_RESULT
"status=%d ", status);
}
wpas_notify_p2p_invitation_result(wpa_s, status, bssid);
@ -2932,7 +2942,7 @@ 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);
wpa_msg_global(wpa_s, level, "P2P: %s", msg);
}
@ -3266,12 +3276,13 @@ static void wpas_p2p_check_join_scan_limit(struct wpa_supplicant *wpa_s)
eloop_cancel_timeout(wpas_p2p_join_scan, wpa_s, NULL);
if (wpa_s->p2p_auto_pd) {
wpa_s->p2p_auto_pd = 0;
wpa_msg(wpa_s, MSG_INFO, P2P_EVENT_PROV_DISC_FAILURE
wpa_msg_global(wpa_s, MSG_INFO,
P2P_EVENT_PROV_DISC_FAILURE
" p2p_dev_addr=" MACSTR " status=N/A",
MAC2STR(wpa_s->pending_join_dev_addr));
return;
}
wpa_msg(wpa_s->parent, MSG_INFO,
wpa_msg_global(wpa_s->parent, MSG_INFO,
P2P_EVENT_GROUP_FORMATION_FAILURE);
}
}
@ -3396,7 +3407,8 @@ static void wpas_p2p_scan_res_join(struct wpa_supplicant *wpa_s,
wpa_s->pending_pd_config_methods, join,
0, wpa_s->user_initiated_pd) < 0) {
wpa_s->p2p_auto_pd = 0;
wpa_msg(wpa_s, MSG_INFO, P2P_EVENT_PROV_DISC_FAILURE
wpa_msg_global(wpa_s, MSG_INFO,
P2P_EVENT_PROV_DISC_FAILURE
" p2p_dev_addr=" MACSTR " status=N/A",
MAC2STR(wpa_s->pending_join_dev_addr));
}
@ -3460,7 +3472,7 @@ static void wpas_p2p_scan_res_join(struct wpa_supplicant *wpa_s,
u16 method;
if (wpas_check_freq_conflict(wpa_s, freq) > 0) {
wpa_msg(wpa_s->parent, MSG_INFO,
wpa_msg_global(wpa_s->parent, MSG_INFO,
P2P_EVENT_GROUP_FORMATION_FAILURE
"reason=FREQ_CONFLICT");
return;
@ -4164,13 +4176,14 @@ wpas_p2p_get_group_iface(struct wpa_supplicant *wpa_s, int addr_allocated,
if (wpas_p2p_add_group_interface(wpa_s, go ? WPA_IF_P2P_GO :
WPA_IF_P2P_CLIENT) < 0) {
wpa_msg(wpa_s, MSG_ERROR, "P2P: Failed to add group interface");
wpa_msg_global(wpa_s, MSG_ERROR,
"P2P: Failed to add group interface");
return NULL;
}
group_wpa_s = wpas_p2p_init_group_interface(wpa_s, go);
if (group_wpa_s == NULL) {
wpa_msg(wpa_s, MSG_ERROR, "P2P: Failed to initialize group "
"interface");
wpa_msg_global(wpa_s, MSG_ERROR,
"P2P: Failed to initialize group interface");
wpas_p2p_remove_pending_group_interface(wpa_s);
return NULL;
}
@ -4974,16 +4987,16 @@ void wpas_p2p_completed(struct wpa_supplicant *wpa_s)
if (ssid->passphrase == NULL && ssid->psk_set) {
char psk[65];
wpa_snprintf_hex(psk, sizeof(psk), ssid->psk, 32);
wpa_msg(wpa_s->parent, MSG_INFO, P2P_EVENT_GROUP_STARTED
"%s client ssid=\"%s\" freq=%d psk=%s go_dev_addr="
MACSTR "%s",
wpa_msg_global(wpa_s->parent, MSG_INFO, P2P_EVENT_GROUP_STARTED
"%s client ssid=\"%s\" freq=%d psk=%s "
"go_dev_addr=" MACSTR "%s",
wpa_s->ifname, ssid_txt, freq, psk,
MAC2STR(go_dev_addr),
persistent ? " [PERSISTENT]" : "");
} else {
wpa_msg(wpa_s->parent, MSG_INFO, P2P_EVENT_GROUP_STARTED
"%s client ssid=\"%s\" freq=%d passphrase=\"%s\" "
"go_dev_addr=" MACSTR "%s",
wpa_msg_global(wpa_s->parent, MSG_INFO, P2P_EVENT_GROUP_STARTED
"%s client ssid=\"%s\" freq=%d "
"passphrase=\"%s\" go_dev_addr=" MACSTR "%s",
wpa_s->ifname, ssid_txt, freq,
ssid->passphrase ? ssid->passphrase : "",
MAC2STR(go_dev_addr),
@ -5319,9 +5332,10 @@ int wpas_p2p_set_cross_connect(struct wpa_supplicant *wpa_s, int enabled)
iface->cross_connect_enabled = 0;
iface->cross_connect_in_use = 0;
wpa_msg(iface->parent, MSG_INFO,
wpa_msg_global(iface->parent, MSG_INFO,
P2P_EVENT_CROSS_CONNECT_DISABLE "%s %s",
iface->ifname, iface->cross_connect_uplink);
iface->ifname,
iface->cross_connect_uplink);
}
}
@ -5348,7 +5362,7 @@ static void wpas_p2p_enable_cross_connect(struct wpa_supplicant *uplink)
continue;
iface->cross_connect_in_use = 1;
wpa_msg(iface->parent, MSG_INFO,
wpa_msg_global(iface->parent, MSG_INFO,
P2P_EVENT_CROSS_CONNECT_ENABLE "%s %s",
iface->ifname, iface->cross_connect_uplink);
}
@ -5368,7 +5382,7 @@ static void wpas_p2p_disable_cross_connect(struct wpa_supplicant *uplink)
if (!iface->cross_connect_in_use)
continue;
wpa_msg(iface->parent, MSG_INFO,
wpa_msg_global(iface->parent, MSG_INFO,
P2P_EVENT_CROSS_CONNECT_DISABLE "%s %s",
iface->ifname, iface->cross_connect_uplink);
iface->cross_connect_in_use = 0;
@ -5430,7 +5444,7 @@ static void wpas_p2p_cross_connect_setup(struct wpa_supplicant *wpa_s)
break;
wpa_s->cross_connect_in_use = 1;
wpa_msg(wpa_s->parent, MSG_INFO,
wpa_msg_global(wpa_s->parent, MSG_INFO,
P2P_EVENT_CROSS_CONNECT_ENABLE "%s %s",
wpa_s->ifname, wpa_s->cross_connect_uplink);
break;