Rename hostapd_parse_rates() to a more generic int list parser

This can be used with other integer lists than just rates.

Signed-hostap: Simon Wunderlich <siwu@hrz.tu-chemnitz.de>
This commit is contained in:
Simon Wunderlich 2013-05-09 20:21:41 +03:00 committed by Jouni Malinen
parent b113a171ac
commit 732118eca3

View file

@ -710,14 +710,14 @@ static int hostapd_config_read_wep(struct hostapd_wep_keys *wep, int keyidx,
} }
static int hostapd_parse_rates(int **rate_list, char *val) static int hostapd_parse_intlist(int **int_list, char *val)
{ {
int *list; int *list;
int count; int count;
char *pos, *end; char *pos, *end;
os_free(*rate_list); os_free(*int_list);
*rate_list = NULL; *int_list = NULL;
pos = val; pos = val;
count = 0; count = 0;
@ -744,7 +744,7 @@ static int hostapd_parse_rates(int **rate_list, char *val)
} }
list[count] = -1; list[count] = -1;
*rate_list = list; *int_list = list;
return 0; return 0;
} }
@ -2356,13 +2356,14 @@ static int hostapd_config_fill(struct hostapd_config *conf,
} else } else
conf->send_probe_response = val; conf->send_probe_response = val;
} else if (os_strcmp(buf, "supported_rates") == 0) { } else if (os_strcmp(buf, "supported_rates") == 0) {
if (hostapd_parse_rates(&conf->supported_rates, pos)) { if (hostapd_parse_intlist(&conf->supported_rates, pos))
{
wpa_printf(MSG_ERROR, "Line %d: invalid rate " wpa_printf(MSG_ERROR, "Line %d: invalid rate "
"list", line); "list", line);
errors++; errors++;
} }
} else if (os_strcmp(buf, "basic_rates") == 0) { } else if (os_strcmp(buf, "basic_rates") == 0) {
if (hostapd_parse_rates(&conf->basic_rates, pos)) { if (hostapd_parse_intlist(&conf->basic_rates, pos)) {
wpa_printf(MSG_ERROR, "Line %d: invalid rate " wpa_printf(MSG_ERROR, "Line %d: invalid rate "
"list", line); "list", line);
errors++; errors++;
@ -2934,7 +2935,7 @@ static int hostapd_config_fill(struct hostapd_config *conf,
} else if (os_strcmp(buf, "sae_anti_clogging_threshold") == 0) { } else if (os_strcmp(buf, "sae_anti_clogging_threshold") == 0) {
bss->sae_anti_clogging_threshold = atoi(pos); bss->sae_anti_clogging_threshold = atoi(pos);
} else if (os_strcmp(buf, "sae_groups") == 0) { } else if (os_strcmp(buf, "sae_groups") == 0) {
if (hostapd_parse_rates(&bss->sae_groups, pos)) { if (hostapd_parse_intlist(&bss->sae_groups, pos)) {
wpa_printf(MSG_ERROR, "Line %d: Invalid " wpa_printf(MSG_ERROR, "Line %d: Invalid "
"sae_groups value '%s'", line, pos); "sae_groups value '%s'", line, pos);
return 1; return 1;