Skip to content

Commit

Permalink
sim_wifidriver.c:resolve issue in wapi save_config & wapi reconnect c…
Browse files Browse the repository at this point in the history
…ommand
  • Loading branch information
wangchen61698 authored and xiaoxiang781216 committed Dec 23, 2024
1 parent 4a8e8a5 commit 1714571
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions arch/sim/src/sim/sim_wifidriver.c
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ struct sim_netdev_s
int key_mgmt;
int proto;
int auth_alg;
int auth_type;
int pairwise_chiper;
int group_cipher;
uint8_t mode; /* IW_MODE_INFRA/ IW_MODE_MASTER */
Expand Down Expand Up @@ -1151,11 +1152,15 @@ static int wifidriver_set_auth(struct sim_netdev_s *wifidev,

wifidev->proto = value >> 1;

ninfo("proto=%s\n", get_authstr(value));
ninfo("auth_type=%s\n", get_authstr(value));

if (wifidev->mode == IW_MODE_INFRA)
{
ret = WPA_SET_NETWORK(wifidev, "proto %s", get_authstr(value));
if (ret == 0)
{
wifidev->auth_type = value;
}
}
else if(wifidev->mode == IW_MODE_MASTER)
{
Expand Down Expand Up @@ -1207,15 +1212,20 @@ static int wifidriver_get_auth(struct sim_netdev_s *wifidev,
struct iwreq *pwrq)
{
int ret = 0;
int flag = pwrq->u.param.flags & IW_AUTH_INDEX;

switch (wifidev->mode)
switch (flag)
{
case IW_MODE_INFRA:
case IW_AUTH_WPA_VERSION:
pwrq->u.param.value = wifidev->auth_type;
break;
case IW_MODE_MASTER:

case IW_AUTH_CIPHER_PAIRWISE:
pwrq->u.param.value = wifidev->pairwise_chiper;
break;
default:
break;
nerr("ERROR: Unknown cmd %d\n", flag);
return -ENOSYS;
}

return ret;
Expand Down

0 comments on commit 1714571

Please sign in to comment.