Fix RegulatoryDomain to allow empty value

This commit is contained in:
Vivek Kumar Dutta 2023-07-25 17:27:33 +05:30 committed by Amin Ben Romdhane
parent a641b786b0
commit fe1b84a2a4
2 changed files with 7 additions and 3 deletions

View file

@ -60,7 +60,7 @@ char *RateAdjAlgorithm[] = {"B", "C", NULL};
char *PIN[] = {"^\\d{4}|\\d{8}$", NULL};
char *DestinationAddress[] = {"^\\d+/\\d+$", NULL};
char *RegulatoryDomain[] = {"^[A-Z][A-Z][ OI]$", NULL};
char *RegulatoryDomain[] = {"^[A-Z][A-Z]$", "^[A-Z][A-Z][ OI]$", NULL};
char *ConformingAction[] = {"^Null$", "^Drop$", "^[0-9]|[1-5][0-9]|6[0-3]$", "^:[0-7]$", "^([0-9]|[1-5][0-9]|6[0-3]):[0-7]$", NULL};
char *IPv4Address[] = {"^$", "^((25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])$", NULL};
char *IPv6Address[] = {"^$", "^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$", NULL};

View file

@ -1213,12 +1213,16 @@ static int set_WiFiRadio_RegulatoryDomain(char *refparam, struct dmctx *ctx, voi
{
switch (action) {
case VALUECHECK:
if (bbfdm_validate_string(ctx, value, 3, 3, NULL, RegulatoryDomain))
if (bbfdm_validate_string(ctx, value, 2, 3, NULL, RegulatoryDomain))
return FAULT_9007;
break;
case VALUESET:
dmuci_set_value_by_section((((struct wifi_radio_args *)data)->sections)->dmmap_section, "country", value);
// uci only support country code, so strip I/O from value before setting
if (DM_STRLEN(value) == 3)
value[2] = '\0';
dmuci_set_value_by_section((((struct wifi_radio_args *)data)->sections)->config_section, "country", value);
break;
}