void wps_er_deinit(struct wps_er *er);
void wps_er_set_sel_reg(struct wps_er *er, int sel_reg, u16 dev_passwd_id,
u16 sel_reg_config_methods);
+int wps_er_pbc(struct wps_er *er, const u8 *uuid);
#endif /* WPS_H */
wpabuf_free(msg);
}
+
+
+int wps_er_pbc(struct wps_er *er, const u8 *uuid)
+{
+ if (er == NULL || er->wps == NULL)
+ return -1;
+
+ /*
+ * TODO: Should enable PBC mode only in a single AP based on which AP
+ * the Enrollee (uuid) is using. Now, we may end up enabling multiple
+ * APs in PBC mode which could result in session overlap at the
+ * Enrollee.
+ */
+ if (wps_registrar_button_pushed(er->wps->registrar))
+ return -1;
+
+ return 0;
+}
} else if (os_strncmp(buf, "WPS_ER_PIN ", 11) == 0) {
if (wpa_supplicant_ctrl_iface_wps_er_pin(wpa_s, buf + 11))
reply_len = -1;
+ } else if (os_strncmp(buf, "WPS_ER_PBC ", 11) == 0) {
+ if (wpas_wps_er_pbc(wpa_s, buf + 11))
+ reply_len = -1;
#endif /* CONFIG_WPS_ER */
#endif /* CONFIG_WPS */
#ifdef CONFIG_IBSS_RSN
}
+static int wpa_cli_cmd_wps_er_pbc(struct wpa_ctrl *ctrl, int argc,
+ char *argv[])
+{
+ char cmd[256];
+ int res;
+
+ if (argc != 1) {
+ printf("Invalid WPS_ER_PBC command: need one argument:\n"
+ "- UUID: Specify the Enrollee\n");
+ return -1;
+ }
+
+ res = os_snprintf(cmd, sizeof(cmd), "WPS_ER_PBC %s",
+ argv[0]);
+ if (res < 0 || (size_t) res >= sizeof(cmd) - 1) {
+ printf("Too long WPS_ER_PBC command.\n");
+ return -1;
+ }
+ return wpa_ctrl_command(ctrl, cmd);
+}
+
+
static int wpa_cli_cmd_ibss_rsn(struct wpa_ctrl *ctrl, int argc, char *argv[])
{
char cmd[256];
{ "wps_er_pin", wpa_cli_cmd_wps_er_pin,
cli_cmd_flag_sensitive,
"<UUID> <PIN> = add an Enrollee PIN to External Registrar" },
+ { "wps_er_pbc", wpa_cli_cmd_wps_er_pbc,
+ cli_cmd_flag_none,
+ "<UUID> = accept an Enrollee PBC using External Registrar" },
{ "ibss_rsn", wpa_cli_cmd_ibss_rsn,
cli_cmd_flag_none,
"<addr> = request RSN authentication with <addr> in IBSS" },
return wps_registrar_add_pin(wpa_s->wps->registrar, any ? NULL : u,
(const u8 *) pin, os_strlen(pin), 300);
}
+
+
+int wpas_wps_er_pbc(struct wpa_supplicant *wpa_s, const char *uuid)
+{
+ u8 u[UUID_LEN];
+
+ if (uuid_str2bin(uuid, u))
+ return -1;
+ return wps_er_pbc(wpa_s->wps_er, u);
+}
#endif /* CONFIG_WPS_ER */
int wpas_wps_er_stop(struct wpa_supplicant *wpa_s);
int wpas_wps_er_add_pin(struct wpa_supplicant *wpa_s, const char *uuid,
const char *pin);
+int wpas_wps_er_pbc(struct wpa_supplicant *wpa_s, const char *uuid);
#else /* CONFIG_WPS */