P2P: Add group ifname to P2P-PROV-DISC-* events
If Provision Discovery Request is sent for GO role (i.e., P2P Group ID attribute is included), add the group interface name to the control interface event on the GO. This makes it easier to figure out which ctrl_iface needs to be used for wps_pbc/wps_pin command to authorize the joining P2P client. Signed-hostap: Jouni Malinen <j@w1.fi>
This commit is contained in:
parent
ec437d9e74
commit
c3f4278445
6 changed files with 33 additions and 10 deletions
|
@ -3196,7 +3196,8 @@ static void test_sd_response(void *ctx, const u8 *sa, u16 update_indic,
|
||||||
static void test_prov_disc_req(void *ctx, const u8 *peer, u16 config_methods,
|
static void test_prov_disc_req(void *ctx, const u8 *peer, u16 config_methods,
|
||||||
const u8 *dev_addr, const u8 *pri_dev_type,
|
const u8 *dev_addr, const u8 *pri_dev_type,
|
||||||
const char *dev_name, u16 supp_config_methods,
|
const char *dev_name, u16 supp_config_methods,
|
||||||
u8 dev_capab, u8 group_capab)
|
u8 dev_capab, u8 group_capab,
|
||||||
|
const u8 *group_id, size_t group_id_len)
|
||||||
{
|
{
|
||||||
wpa_printf(MSG_DEBUG, "%s(peer=" MACSTR " config_methods=0x%x)",
|
wpa_printf(MSG_DEBUG, "%s(peer=" MACSTR " config_methods=0x%x)",
|
||||||
__func__, MAC2STR(peer), config_methods);
|
__func__, MAC2STR(peer), config_methods);
|
||||||
|
|
|
@ -594,6 +594,8 @@ struct p2p_config {
|
||||||
* @supp_config_methods: Supported configuration Methods
|
* @supp_config_methods: Supported configuration Methods
|
||||||
* @dev_capab: Device Capabilities
|
* @dev_capab: Device Capabilities
|
||||||
* @group_capab: Group Capabilities
|
* @group_capab: Group Capabilities
|
||||||
|
* @group_id: P2P Group ID (or %NULL if not included)
|
||||||
|
* @group_id_len: Length of P2P Group ID
|
||||||
*
|
*
|
||||||
* This callback is used to indicate reception of a Provision Discovery
|
* This callback is used to indicate reception of a Provision Discovery
|
||||||
* Request frame that the P2P module accepted.
|
* Request frame that the P2P module accepted.
|
||||||
|
@ -601,7 +603,8 @@ struct p2p_config {
|
||||||
void (*prov_disc_req)(void *ctx, const u8 *peer, u16 config_methods,
|
void (*prov_disc_req)(void *ctx, const u8 *peer, u16 config_methods,
|
||||||
const u8 *dev_addr, const u8 *pri_dev_type,
|
const u8 *dev_addr, const u8 *pri_dev_type,
|
||||||
const char *dev_name, u16 supp_config_methods,
|
const char *dev_name, u16 supp_config_methods,
|
||||||
u8 dev_capab, u8 group_capab);
|
u8 dev_capab, u8 group_capab,
|
||||||
|
const u8 *group_id, size_t group_id_len);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* prov_disc_resp - Callback on Provisiong Discovery Response
|
* prov_disc_resp - Callback on Provisiong Discovery Response
|
||||||
|
|
|
@ -191,8 +191,8 @@ out:
|
||||||
msg.device_name, msg.config_methods,
|
msg.device_name, msg.config_methods,
|
||||||
msg.capability ? msg.capability[0] : 0,
|
msg.capability ? msg.capability[0] : 0,
|
||||||
msg.capability ? msg.capability[1] :
|
msg.capability ? msg.capability[1] :
|
||||||
0);
|
0,
|
||||||
|
msg.group_id, msg.group_id_len);
|
||||||
}
|
}
|
||||||
p2p_parse_free(&msg);
|
p2p_parse_free(&msg);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2375,7 +2375,8 @@ void wpa_supplicant_event(void *ctx, enum wpa_event_type event,
|
||||||
data->p2p_prov_disc_req.dev_name,
|
data->p2p_prov_disc_req.dev_name,
|
||||||
data->p2p_prov_disc_req.supp_config_methods,
|
data->p2p_prov_disc_req.supp_config_methods,
|
||||||
data->p2p_prov_disc_req.dev_capab,
|
data->p2p_prov_disc_req.dev_capab,
|
||||||
data->p2p_prov_disc_req.group_capab);
|
data->p2p_prov_disc_req.group_capab,
|
||||||
|
NULL, 0);
|
||||||
break;
|
break;
|
||||||
case EVENT_P2P_PROV_DISC_RESPONSE:
|
case EVENT_P2P_PROV_DISC_RESPONSE:
|
||||||
wpas_prov_disc_resp(wpa_s, data->p2p_prov_disc_resp.peer,
|
wpas_prov_disc_resp(wpa_s, data->p2p_prov_disc_resp.peer,
|
||||||
|
|
|
@ -1688,13 +1688,28 @@ static void wpas_prov_disc_local_keypad(struct wpa_supplicant *wpa_s,
|
||||||
void wpas_prov_disc_req(void *ctx, const u8 *peer, u16 config_methods,
|
void wpas_prov_disc_req(void *ctx, const u8 *peer, u16 config_methods,
|
||||||
const u8 *dev_addr, const u8 *pri_dev_type,
|
const u8 *dev_addr, const u8 *pri_dev_type,
|
||||||
const char *dev_name, u16 supp_config_methods,
|
const char *dev_name, u16 supp_config_methods,
|
||||||
u8 dev_capab, u8 group_capab)
|
u8 dev_capab, u8 group_capab, const u8 *group_id,
|
||||||
|
size_t group_id_len)
|
||||||
{
|
{
|
||||||
struct wpa_supplicant *wpa_s = ctx;
|
struct wpa_supplicant *wpa_s = ctx;
|
||||||
char devtype[WPS_DEV_TYPE_BUFSIZE];
|
char devtype[WPS_DEV_TYPE_BUFSIZE];
|
||||||
char params[200];
|
char params[300];
|
||||||
u8 empty_dev_type[8];
|
u8 empty_dev_type[8];
|
||||||
unsigned int generated_pin = 0;
|
unsigned int generated_pin = 0;
|
||||||
|
struct wpa_supplicant *group = NULL;
|
||||||
|
|
||||||
|
if (group_id) {
|
||||||
|
for (group = wpa_s->global->ifaces; group; group = group->next)
|
||||||
|
{
|
||||||
|
struct wpa_ssid *s = group->current_ssid;
|
||||||
|
if (s != NULL &&
|
||||||
|
s->mode == WPAS_MODE_P2P_GO &&
|
||||||
|
group_id_len - ETH_ALEN == s->ssid_len &&
|
||||||
|
os_memcmp(group_id + ETH_ALEN, s->ssid,
|
||||||
|
s->ssid_len) == 0)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (pri_dev_type == NULL) {
|
if (pri_dev_type == NULL) {
|
||||||
os_memset(empty_dev_type, 0, sizeof(empty_dev_type));
|
os_memset(empty_dev_type, 0, sizeof(empty_dev_type));
|
||||||
|
@ -1702,11 +1717,13 @@ void wpas_prov_disc_req(void *ctx, const u8 *peer, u16 config_methods,
|
||||||
}
|
}
|
||||||
os_snprintf(params, sizeof(params), " p2p_dev_addr=" MACSTR
|
os_snprintf(params, sizeof(params), " p2p_dev_addr=" MACSTR
|
||||||
" pri_dev_type=%s name='%s' config_methods=0x%x "
|
" pri_dev_type=%s name='%s' config_methods=0x%x "
|
||||||
"dev_capab=0x%x group_capab=0x%x",
|
"dev_capab=0x%x group_capab=0x%x%s%s",
|
||||||
MAC2STR(dev_addr),
|
MAC2STR(dev_addr),
|
||||||
wps_dev_type_bin2str(pri_dev_type, devtype,
|
wps_dev_type_bin2str(pri_dev_type, devtype,
|
||||||
sizeof(devtype)),
|
sizeof(devtype)),
|
||||||
dev_name, supp_config_methods, dev_capab, group_capab);
|
dev_name, supp_config_methods, dev_capab, group_capab,
|
||||||
|
group ? " group=" : "",
|
||||||
|
group ? group->ifname : "");
|
||||||
params[sizeof(params) - 1] = '\0';
|
params[sizeof(params) - 1] = '\0';
|
||||||
|
|
||||||
if (config_methods & WPS_CONFIG_DISPLAY) {
|
if (config_methods & WPS_CONFIG_DISPLAY) {
|
||||||
|
|
|
@ -73,7 +73,8 @@ void wpas_go_neg_req_rx(void *ctx, const u8 *src, u16 dev_passwd_id);
|
||||||
void wpas_prov_disc_req(void *ctx, const u8 *peer, u16 config_methods,
|
void wpas_prov_disc_req(void *ctx, const u8 *peer, u16 config_methods,
|
||||||
const u8 *dev_addr, const u8 *pri_dev_type,
|
const u8 *dev_addr, const u8 *pri_dev_type,
|
||||||
const char *dev_name, u16 supp_config_methods,
|
const char *dev_name, u16 supp_config_methods,
|
||||||
u8 dev_capab, u8 group_capab);
|
u8 dev_capab, u8 group_capab, const u8 *group_id,
|
||||||
|
size_t group_id_len);
|
||||||
void wpas_prov_disc_resp(void *ctx, const u8 *peer, u16 config_methods);
|
void wpas_prov_disc_resp(void *ctx, const u8 *peer, u16 config_methods);
|
||||||
void wpas_sd_request(void *ctx, int freq, const u8 *sa, u8 dialog_token,
|
void wpas_sd_request(void *ctx, int freq, const u8 *sa, u8 dialog_token,
|
||||||
u16 update_indic, const u8 *tlvs, size_t tlvs_len);
|
u16 update_indic, const u8 *tlvs, size_t tlvs_len);
|
||||||
|
|
Loading…
Reference in a new issue