You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2022/06/16 15:40:43 UTC

[GitHub] [incubator-nuttx-apps] anchao commented on a diff in pull request #1200: wireless/wapi: authentication parameters should update before key set

anchao commented on code in PR #1200:
URL: https://github.com/apache/incubator-nuttx-apps/pull/1200#discussion_r899226533


##########
wireless/wapi/src/wapi.c:
##########
@@ -521,15 +521,64 @@ static int wapi_essid_cmd(int sock, int argc, FAR char **argv)
 static int wapi_psk_cmd(int sock, int argc, FAR char **argv)
 {
   enum wpa_alg_e alg_flag;
+  uint8_t auth_wpa;
+  int cipher;
+  int ret;
 
   /* Convert input strings to values */
 
   alg_flag = (enum wpa_alg_e)wapi_str2ndx(argv[2], g_wapi_alg_flags);
 
-  /* Set the Passphrase */
+  if (argc > 3)
+    {
+      auth_wpa = atoi(argv[3]);
+    }
+  else
+    {
+      auth_wpa = CONFIG_NETINIT_WAPI_AUTHWPA;
+    }
+
+  switch (alg_flag)
+    {
+      case WPA_ALG_NONE:
+        cipher = IW_AUTH_CIPHER_NONE;
+        break;
+
+      case WPA_ALG_WEP:
+        cipher = IW_AUTH_CIPHER_WEP40;
+        break;
 
-  return wpa_driver_wext_set_key_ext(sock, argv[0], alg_flag,
-                                     argv[1], strlen(argv[1]));
+      case WPA_ALG_TKIP:
+        cipher = IW_AUTH_CIPHER_TKIP;
+        break;
+
+      case WPA_ALG_CCMP:
+        cipher = IW_AUTH_CIPHER_CCMP;
+        break;
+
+      default:
+        return -1;
+    }
+
+  ret = wpa_driver_wext_set_auth_param(sock, argv[0],
+                                       IW_AUTH_WPA_VERSION,
+                                       auth_wpa);
+  if (ret >= 0)
+    {
+      ret = wpa_driver_wext_set_auth_param(sockfd, ifname,

Review Comment:
   Done



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org