Skip to content

Commit

Permalink
Store second VAP's channel, passphrase configured via wlan_tag #2
Browse files Browse the repository at this point in the history
The second VAP interface is started with wlan_tag #2 with the respective
channel and passphrase. Add the provision to store them for the second
VAP.

Also sets use_5g if ap_is_dual is set.

Signed-off-by: Jouni Malinen <[email protected]>
  • Loading branch information
Xin Deng authored and Jouni Malinen committed Oct 15, 2021
1 parent 47b1ccc commit b78d1c2
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 10 deletions.
52 changes: 42 additions & 10 deletions ap.c
Original file line number Diff line number Diff line change
Expand Up @@ -757,12 +757,17 @@ static enum sigma_cmd_result cmd_ap_set_wireless(struct sigma_dut *dut,

val = get_param(cmd, "CHANNEL");
if (val) {
const char *pos;
dut->ap_channel = atoi(val);
pos = strchr(val, ';');
if (pos) {
pos++;
dut->ap_channel_1 = atoi(pos);
if (wlan_tag == 1) {
const char *pos;

dut->ap_channel = atoi(val);
pos = strchr(val, ';');
if (pos) {
pos++;
dut->ap_channel_1 = atoi(pos);
}
} else {
dut->ap_tag_channel[wlan_tag - 2] = atoi(val);
}
}

Expand All @@ -777,7 +782,10 @@ static enum sigma_cmd_result cmd_ap_set_wireless(struct sigma_dut *dut,
/* Overwrite the AP channel with DFS channel if configured */
val = get_param(cmd, "dfs_chan");
if (val) {
dut->ap_channel = atoi(val);
if (wlan_tag == 1)
dut->ap_channel = atoi(val);
else
dut->ap_tag_channel[wlan_tag - 2] = atoi(val);
}

val = get_param(cmd, "dfs_mode");
Expand All @@ -801,8 +809,8 @@ static enum sigma_cmd_result cmd_ap_set_wireless(struct sigma_dut *dut,
pos = strchr(str, ';');
if (pos)
*pos++ = '\0';

dut->ap_is_dual = 0;
if (wlan_tag != 2)
dut->ap_is_dual = 0;
dut->ap_mode = get_mode(str);
if (dut->ap_mode == AP_inval) {
send_resp(dut, conn, SIGMA_INVALID,
Expand Down Expand Up @@ -868,6 +876,9 @@ static enum sigma_cmd_result cmd_ap_set_wireless(struct sigma_dut *dut,
break;
}

if (dut->ap_is_dual)
dut->use_5g = 1;

val = get_param(cmd, "WME");
if (val) {
if (strcasecmp(val, "on") == 0)
Expand Down Expand Up @@ -2238,8 +2249,25 @@ static enum sigma_cmd_result cmd_ap_set_security(struct sigma_dut *dut,
"errorCode,Unsupported KEYMGNT");
return 0;
}
return 1;
}

val = get_param(cmd, "PSK");
if (!val)
val = get_param(cmd, "passphrase");
if (val) {
if (strlen(val) > 64) {
sigma_dut_print(dut, DUT_MSG_ERROR,
"Too long PSK/passphrase");
return -1;
}
if (strlen(val) >
sizeof(dut->ap_tag_passphrase[wlan_tag - 2]) - 1)
return -1;
strlcpy(dut->ap_tag_passphrase[wlan_tag - 2], val,
sizeof(dut->ap_tag_passphrase[wlan_tag - 2]));
}

return 1;
}

val = get_param(cmd, "KEYMGNT");
Expand Down Expand Up @@ -9397,9 +9425,13 @@ static enum sigma_cmd_result cmd_ap_reset_default(struct sigma_dut *dut,
/*
* Reset all tagged SSIDs to NULL-string and all key management
* to open.
* Reset all tagged passphrases to NULL-string and all channel
* to zero.
*/
dut->ap_tag_ssid[i][0] = '\0';
dut->ap_tag_key_mgmt[i] = AP2_OPEN;
dut->ap_tag_passphrase[i][0] = '\0';
dut->ap_tag_channel[i] = 0;
}

drv = get_driver_type(dut);
Expand Down
2 changes: 2 additions & 0 deletions sigma_dut.h
Original file line number Diff line number Diff line change
Expand Up @@ -508,6 +508,7 @@ struct sigma_dut {
AP_inval
} ap_mode;
int ap_channel;
int ap_tag_channel[MAX_WLAN_TAGS - 1];
int ap_rts;
int ap_frgmnt;
int ap_bcnint;
Expand Down Expand Up @@ -608,6 +609,7 @@ struct sigma_dut {
int ap_sae_pk_omit;
int sae_confirm_immediate;
char ap_passphrase[101];
char ap_tag_passphrase[MAX_WLAN_TAGS - 1][101];
char ap_psk[65];
char *ap_sae_passwords;
char *ap_sae_pk_modifier;
Expand Down

0 comments on commit b78d1c2

Please sign in to comment.