aboutsummaryrefslogtreecommitdiffstats
path: root/hostapd/hostapd_cli.c
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2012-06-28 10:25:48 (GMT)
committerJouni Malinen <j@w1.fi>2012-06-28 10:25:48 (GMT)
commit3cf7a59d4f4345c24f99e5422a680cec6b9356d0 (patch)
treecf6f42aa1653b9591a525f9cff7b5cfd4a5ef93c /hostapd/hostapd_cli.c
parent5bb7ae1f0ccca1474d8972dab582d136fef8d65b (diff)
downloadhostap-3cf7a59d4f4345c24f99e5422a680cec6b9356d0.zip
hostap-3cf7a59d4f4345c24f99e5422a680cec6b9356d0.tar.gz
hostap-3cf7a59d4f4345c24f99e5422a680cec6b9356d0.tar.bz2
WPS: Add new mechanism for generation NFC configuration token
The new hostapd ctrl_iface command WPS_NFC_CONFIG_TOKEN can now be used to fetch payload for an NFC configuration token so that an external program can be used to write this on an NFC tag. Signed-hostap: Jouni Malinen <j@w1.fi>
Diffstat (limited to 'hostapd/hostapd_cli.c')
-rw-r--r--hostapd/hostapd_cli.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/hostapd/hostapd_cli.c b/hostapd/hostapd_cli.c
index 2d0445e..ed52187 100644
--- a/hostapd/hostapd_cli.c
+++ b/hostapd/hostapd_cli.c
@@ -76,6 +76,7 @@ static const char *commands_help =
#endif /* CONFIG_WPS_OOB */
#ifdef CONFIG_WPS_NFC
" wps_nfc_tag_read <hexdump> report read NFC tag with WPS data\n"
+" wps_nfc_config_token <WPS/NDEF> build NFC configuration token\n"
#endif /* CONFIG_WPS_NFC */
" wps_ap_pin <cmd> [params..] enable/disable AP PIN\n"
" wps_config <SSID> <auth> <encr> <key> configure AP\n"
@@ -461,6 +462,28 @@ static int hostapd_cli_cmd_wps_nfc_tag_read(struct wpa_ctrl *ctrl, int argc,
return ret;
}
+
+
+static int hostapd_cli_cmd_wps_nfc_config_token(struct wpa_ctrl *ctrl,
+ int argc, char *argv[])
+{
+ char cmd[64];
+ int res;
+
+ if (argc != 1) {
+ printf("Invalid 'wps_nfc_config_token' command - one argument "
+ "is required.\n");
+ return -1;
+ }
+
+ res = os_snprintf(cmd, sizeof(cmd), "WPS_NFC_CONFIG_TOKEN %s",
+ argv[0]);
+ if (res < 0 || (size_t) res >= sizeof(cmd) - 1) {
+ printf("Too long WPS_NFC_CONFIG_TOKEN command.\n");
+ return -1;
+ }
+ return wpa_ctrl_command(ctrl, cmd);
+}
#endif /* CONFIG_WPS_NFC */
@@ -763,6 +786,7 @@ static struct hostapd_cli_cmd hostapd_cli_commands[] = {
#endif /* CONFIG_WPS_OOB */
#ifdef CONFIG_WPS_NFC
{ "wps_nfc_tag_read", hostapd_cli_cmd_wps_nfc_tag_read },
+ { "wps_nfc_config_token", hostapd_cli_cmd_wps_nfc_config_token },
#endif /* CONFIG_WPS_NFC */
{ "wps_ap_pin", hostapd_cli_cmd_wps_ap_pin },
{ "wps_config", hostapd_cli_cmd_wps_config },