summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 5d34ab6)
raw | patch | inline | side by side (parent: 5d34ab6)
author | Jouni Malinen <j@w1.fi> | |
Sun, 15 Nov 2009 16:46:03 +0000 (18:46 +0200) | ||
committer | Jouni Malinen <j@w1.fi> | |
Sun, 15 Nov 2009 16:46:03 +0000 (18:46 +0200) |
This will need some additional code in wps_er_pbc() to handle PBC mode
enabling for a single AP only. For now, this can only be expected to work
when the ER is connected to a single AP.
enabling for a single AP only. For now, this can only be expected to work
when the ER is connected to a single AP.
diff --git a/src/wps/wps.h b/src/wps/wps.h
index e9aace54b0cceb8e3f2d300e8ec233715e7eeff8..14c6c58102b133d02368724b8a81126f6d017598 100644 (file)
--- a/src/wps/wps.h
+++ b/src/wps/wps.h
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 */
diff --git a/src/wps/wps_er.c b/src/wps/wps_er.c
index fb6d5a6bae916c698e604b44b451e38c59de8494..eac31e919fb271f81f167bbd604d8e57adfc0ddd 100644 (file)
--- a/src/wps/wps_er.c
+++ b/src/wps/wps_er.c
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;
+}
index 9451bca28efc6e3cc7106115d10f171e726aa6d9..d7321339933736cec18c24dc8d3e5d78ecc75c29 100644 (file)
} 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
index 84dc8c00f829cbd9078de3e74e55bdf14b323e58..11a1e46c6f91a19721501fa837b4ae0a110fab22 100644 (file)
--- a/wpa_supplicant/wpa_cli.c
+++ b/wpa_supplicant/wpa_cli.c
}
+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" },
index 62d1cd69265b2f6e210ec10380f1e3ec075bbdc5..a2193d10b4f09f79ce9829f97471f09a157cebc5 100644 (file)
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 */
index 503a4cd49f0277b05b33b2548795d1971a1f39b6..db70edd3b70b0b02d5511994edbcf8d532545f2e 100644 (file)
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 */