P2P: Let WPS code know if it is used in a P2P group
This commit is contained in:
parent
e3768e7c94
commit
9fa243b295
5 changed files with 20 additions and 14 deletions
|
@ -183,7 +183,7 @@ static int wpa_supplicant_ctrl_iface_wps_pbc(struct wpa_supplicant *wpa_s,
|
|||
return wpa_supplicant_ap_wps_pbc(wpa_s, _bssid);
|
||||
#endif /* CONFIG_AP */
|
||||
|
||||
return wpas_wps_start_pbc(wpa_s, _bssid);
|
||||
return wpas_wps_start_pbc(wpa_s, _bssid, 0);
|
||||
}
|
||||
|
||||
|
||||
|
@ -214,7 +214,7 @@ static int wpa_supplicant_ctrl_iface_wps_pin(struct wpa_supplicant *wpa_s,
|
|||
#endif /* CONFIG_AP */
|
||||
|
||||
if (pin) {
|
||||
ret = wpas_wps_start_pin(wpa_s, _bssid, pin);
|
||||
ret = wpas_wps_start_pin(wpa_s, _bssid, pin, 0);
|
||||
if (ret < 0)
|
||||
return -1;
|
||||
ret = os_snprintf(buf, buflen, "%s", pin);
|
||||
|
@ -223,7 +223,7 @@ static int wpa_supplicant_ctrl_iface_wps_pin(struct wpa_supplicant *wpa_s,
|
|||
return ret;
|
||||
}
|
||||
|
||||
ret = wpas_wps_start_pin(wpa_s, _bssid, NULL);
|
||||
ret = wpas_wps_start_pin(wpa_s, _bssid, NULL, 0);
|
||||
if (ret < 0)
|
||||
return -1;
|
||||
|
||||
|
|
|
@ -231,11 +231,11 @@ DBusMessage * wpas_dbus_handler_wps_start(DBusMessage *message,
|
|||
ret = wpas_wps_start_reg(wpa_s, params.bssid, params.pin,
|
||||
NULL);
|
||||
else if (params.type == 1) {
|
||||
ret = wpas_wps_start_pin(wpa_s, params.bssid, params.pin);
|
||||
ret = wpas_wps_start_pin(wpa_s, params.bssid, params.pin, 0);
|
||||
if (ret > 0)
|
||||
os_snprintf(npin, sizeof(npin), "%08d", ret);
|
||||
} else
|
||||
ret = wpas_wps_start_pbc(wpa_s, params.bssid);
|
||||
ret = wpas_wps_start_pbc(wpa_s, params.bssid, 0);
|
||||
|
||||
if (ret < 0) {
|
||||
wpa_printf(MSG_DEBUG, "dbus: WPS.Start wpas_wps_failed in "
|
||||
|
|
|
@ -43,9 +43,9 @@ DBusMessage * wpas_dbus_iface_wps_pbc(DBusMessage *message,
|
|||
return wpas_dbus_new_invalid_opts_error(message, NULL);
|
||||
|
||||
if (!os_strcmp(arg_bssid, "any"))
|
||||
ret = wpas_wps_start_pbc(wpa_s, NULL);
|
||||
ret = wpas_wps_start_pbc(wpa_s, NULL, 0);
|
||||
else if (!hwaddr_aton(arg_bssid, bssid))
|
||||
ret = wpas_wps_start_pbc(wpa_s, bssid);
|
||||
ret = wpas_wps_start_pbc(wpa_s, bssid, 0);
|
||||
else {
|
||||
return wpas_dbus_new_invalid_opts_error(message,
|
||||
"Invalid BSSID");
|
||||
|
@ -94,9 +94,9 @@ DBusMessage * wpas_dbus_iface_wps_pin(DBusMessage *message,
|
|||
}
|
||||
|
||||
if (os_strlen(pin) > 0)
|
||||
ret = wpas_wps_start_pin(wpa_s, _bssid, pin);
|
||||
ret = wpas_wps_start_pin(wpa_s, _bssid, pin, 0);
|
||||
else
|
||||
ret = wpas_wps_start_pin(wpa_s, _bssid, NULL);
|
||||
ret = wpas_wps_start_pin(wpa_s, _bssid, NULL, 0);
|
||||
|
||||
if (ret < 0) {
|
||||
return dbus_message_new_error(message,
|
||||
|
|
|
@ -665,13 +665,16 @@ static void wpas_wps_reassoc(struct wpa_supplicant *wpa_s,
|
|||
}
|
||||
|
||||
|
||||
int wpas_wps_start_pbc(struct wpa_supplicant *wpa_s, const u8 *bssid)
|
||||
int wpas_wps_start_pbc(struct wpa_supplicant *wpa_s, const u8 *bssid,
|
||||
int p2p_group)
|
||||
{
|
||||
struct wpa_ssid *ssid;
|
||||
wpas_clear_wps(wpa_s);
|
||||
ssid = wpas_wps_add_network(wpa_s, 0, bssid);
|
||||
if (ssid == NULL)
|
||||
return -1;
|
||||
ssid->temporary = 1;
|
||||
ssid->p2p_group = p2p_group;
|
||||
wpa_config_set(ssid, "phase1", "\"pbc=1\"", 0);
|
||||
if (wpa_s->wps_fragment_size)
|
||||
ssid->eap.fragment_size = wpa_s->wps_fragment_size;
|
||||
|
@ -683,7 +686,7 @@ int wpas_wps_start_pbc(struct wpa_supplicant *wpa_s, const u8 *bssid)
|
|||
|
||||
|
||||
int wpas_wps_start_pin(struct wpa_supplicant *wpa_s, const u8 *bssid,
|
||||
const char *pin)
|
||||
const char *pin, int p2p_group)
|
||||
{
|
||||
struct wpa_ssid *ssid;
|
||||
char val[128];
|
||||
|
@ -693,6 +696,8 @@ int wpas_wps_start_pin(struct wpa_supplicant *wpa_s, const u8 *bssid,
|
|||
ssid = wpas_wps_add_network(wpa_s, 0, bssid);
|
||||
if (ssid == NULL)
|
||||
return -1;
|
||||
ssid->temporary = 1;
|
||||
ssid->p2p_group = p2p_group;
|
||||
if (pin)
|
||||
os_snprintf(val, sizeof(val), "\"pin=%s\"", pin);
|
||||
else {
|
||||
|
@ -751,7 +756,7 @@ int wpas_wps_start_oob(struct wpa_supplicant *wpa_s, char *device_type,
|
|||
if ((wps->oob_conf.oob_method == OOB_METHOD_DEV_PWD_E ||
|
||||
wps->oob_conf.oob_method == OOB_METHOD_DEV_PWD_R) &&
|
||||
wpas_wps_start_pin(wpa_s, NULL,
|
||||
wpabuf_head(wps->oob_conf.dev_password)) < 0)
|
||||
wpabuf_head(wps->oob_conf.dev_password), 0) < 0)
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -35,9 +35,10 @@ int wpas_wps_init(struct wpa_supplicant *wpa_s);
|
|||
void wpas_wps_deinit(struct wpa_supplicant *wpa_s);
|
||||
int wpas_wps_eapol_cb(struct wpa_supplicant *wpa_s);
|
||||
enum wps_request_type wpas_wps_get_req_type(struct wpa_ssid *ssid);
|
||||
int wpas_wps_start_pbc(struct wpa_supplicant *wpa_s, const u8 *bssid);
|
||||
int wpas_wps_start_pbc(struct wpa_supplicant *wpa_s, const u8 *bssid,
|
||||
int p2p_group);
|
||||
int wpas_wps_start_pin(struct wpa_supplicant *wpa_s, const u8 *bssid,
|
||||
const char *pin);
|
||||
const char *pin, int p2p_group);
|
||||
int wpas_wps_start_oob(struct wpa_supplicant *wpa_s, char *device_type,
|
||||
char *path, char *method, char *name);
|
||||
int wpas_wps_start_reg(struct wpa_supplicant *wpa_s, const u8 *bssid,
|
||||
|
|
Loading…
Reference in a new issue