WPS 2.0: Add support for AuthorizedMACs attribute
[mech_eap.git] / hostapd / hostapd_cli.c
index 889018a..4f22e85 100644 (file)
@@ -89,11 +89,12 @@ static const char *commands_help =
 "   sa_query <addr>      send SA Query to a station\n"
 #endif /* CONFIG_IEEE80211W */
 #ifdef CONFIG_WPS
-"   wps_pin <uuid> <pin> [timeout]  add WPS Enrollee PIN (Device Password)\n"
+"   wps_pin <uuid> <pin> [timeout] [addr]  add WPS Enrollee PIN\n"
 "   wps_pbc              indicate button pushed to initiate PBC\n"
 #ifdef CONFIG_WPS_OOB
 "   wps_oob <type> <path> <method>  use WPS with out-of-band (UFD)\n"
 #endif /* CONFIG_WPS_OOB */
+"   wps_ap_pin <cmd> [params..]  enable/disable AP PIN\n"
 #endif /* CONFIG_WPS */
 "   help                 show this usage help\n"
 "   interface [ifname]   show interfaces/select interface\n"
@@ -351,13 +352,16 @@ static int hostapd_cli_cmd_sa_query(struct wpa_ctrl *ctrl, int argc,
 static int hostapd_cli_cmd_wps_pin(struct wpa_ctrl *ctrl, int argc,
                                   char *argv[])
 {
-       char buf[64];
+       char buf[256];
        if (argc < 2) {
                printf("Invalid 'wps_pin' command - at least two arguments, "
                       "UUID and PIN, are required.\n");
                return -1;
        }
-       if (argc > 2)
+       if (argc > 3)
+               snprintf(buf, sizeof(buf), "WPS_PIN %s %s %s %s",
+                        argv[0], argv[1], argv[2], argv[3]);
+       else if (argc > 2)
                snprintf(buf, sizeof(buf), "WPS_PIN %s %s %s",
                         argv[0], argv[1], argv[2]);
        else
@@ -405,6 +409,27 @@ static int hostapd_cli_cmd_wps_oob(struct wpa_ctrl *ctrl, int argc,
        return wpa_ctrl_command(ctrl, cmd);
 }
 #endif /* CONFIG_WPS_OOB */
+
+
+static int hostapd_cli_cmd_wps_ap_pin(struct wpa_ctrl *ctrl, int argc,
+                                     char *argv[])
+{
+       char buf[64];
+       if (argc < 1) {
+               printf("Invalid 'wps_ap_pin' command - at least one argument "
+                      "is required.\n");
+               return -1;
+       }
+       if (argc > 2)
+               snprintf(buf, sizeof(buf), "WPS_AP_PIN %s %s %s",
+                        argv[0], argv[1], argv[2]);
+       else if (argc > 1)
+               snprintf(buf, sizeof(buf), "WPS_AP_PIN %s %s",
+                        argv[0], argv[1]);
+       else
+               snprintf(buf, sizeof(buf), "WPS_AP_PIN %s", argv[0]);
+       return wpa_ctrl_command(ctrl, buf);
+}
 #endif /* CONFIG_WPS */
 
 
@@ -567,6 +592,7 @@ static struct hostapd_cli_cmd hostapd_cli_commands[] = {
 #ifdef CONFIG_WPS_OOB
        { "wps_oob", hostapd_cli_cmd_wps_oob },
 #endif /* CONFIG_WPS_OOB */
+       { "wps_ap_pin", hostapd_cli_cmd_wps_ap_pin },
 #endif /* CONFIG_WPS */
        { "help", hostapd_cli_cmd_help },
        { "interface", hostapd_cli_cmd_interface },