mirror of
https://dev.iopsys.eu/bbf/bbfdm.git
synced 2025-12-10 07:44:39 +01:00
Feature #11250: Add support for fault messages
This commit is contained in:
parent
d685dc7ab0
commit
a641b786b0
55 changed files with 1758 additions and 944 deletions
|
|
@ -90,4 +90,7 @@ All supported tools are presented in this file[BBFDM Tools](./docs/guide/tools.m
|
|||
| STUN parameters | stunc | https://dev.iopsys.eu/bbf/stunc.git |
|
||||
| Device.XPON. | ponmngr | https://dev.iopsys.eu/hal/ponmngr.git |
|
||||
| Device.UPNP. | ssdpd | https://github.com/miniupnp/miniupnp.git |
|
||||
| Device.Users. | usermngr | https://dev.iopsys.eu/bbf/usermngr.git |
|
||||
| Device.PeriodicStatistics. | periodicstats | https://dev.iopsys.eu/bbf/periodicstats.git |
|
||||
| Device.SoftwareModules. | swmodd | https://dev.iopsys.eu/lcm/swmodd.git |
|
||||
| Device.Services.VoiceService. | tr104 | https://dev.iopsys.eu/voice/tr104.git |
|
||||
|
|
|
|||
|
|
@ -115,13 +115,14 @@ static void __ubus_callback(struct ubus_request *req, int type __attribute__((un
|
|||
struct blob_attr *cur = NULL;
|
||||
bool print_msg = false;
|
||||
int rem = 0;
|
||||
const struct blobmsg_policy p[6] = {
|
||||
const struct blobmsg_policy p[7] = {
|
||||
{ "path", BLOBMSG_TYPE_STRING },
|
||||
{ "data", BLOBMSG_TYPE_STRING },
|
||||
{ "type", BLOBMSG_TYPE_STRING },
|
||||
{ "fault", BLOBMSG_TYPE_INT32 },
|
||||
{ "input", BLOBMSG_TYPE_ARRAY },
|
||||
{ "output", BLOBMSG_TYPE_ARRAY },
|
||||
{ "fault_msg", BLOBMSG_TYPE_STRING }
|
||||
};
|
||||
|
||||
if (msg == NULL || req == NULL)
|
||||
|
|
@ -141,15 +142,15 @@ static void __ubus_callback(struct ubus_request *req, int type __attribute__((un
|
|||
}
|
||||
|
||||
blobmsg_for_each_attr(cur, parameters, rem) {
|
||||
struct blob_attr *tb[6] = {0};
|
||||
struct blob_attr *tb[7] = {0};
|
||||
|
||||
blobmsg_parse(p, 6, tb, blobmsg_data(cur), blobmsg_len(cur));
|
||||
blobmsg_parse(p, 7, tb, blobmsg_data(cur), blobmsg_len(cur));
|
||||
|
||||
char *name = tb[0] ? blobmsg_get_string(tb[0]) : "";
|
||||
char *data = tb[1] ? blobmsg_get_string(tb[1]) : "";
|
||||
|
||||
if (tb[3]) {
|
||||
printf("ERROR: %u retrieving %s\n", blobmsg_get_u32(tb[3]), name);
|
||||
printf("Fault %u: %s\n", blobmsg_get_u32(tb[3]), tb[6] ? blobmsg_get_string(tb[6]) : "");
|
||||
cli_data->ubus_status = false;
|
||||
return;
|
||||
}
|
||||
|
|
@ -183,9 +184,9 @@ static void __ubus_callback(struct ubus_request *req, int type __attribute__((un
|
|||
|
||||
if (input) {
|
||||
blobmsg_for_each_attr(in_cur, input, in_rem) {
|
||||
struct blob_attr *in_tb[6] = {0};
|
||||
struct blob_attr *in_tb[7] = {0};
|
||||
|
||||
blobmsg_parse(p, 6, in_tb, blobmsg_data(in_cur), blobmsg_len(in_cur));
|
||||
blobmsg_parse(p, 7, in_tb, blobmsg_data(in_cur), blobmsg_len(in_cur));
|
||||
|
||||
char *arg = in_tb[0] ? blobmsg_get_string(in_tb[0]) : "";
|
||||
printf("%s input:%s\n", name, arg);
|
||||
|
|
@ -194,9 +195,9 @@ static void __ubus_callback(struct ubus_request *req, int type __attribute__((un
|
|||
|
||||
if (output) {
|
||||
blobmsg_for_each_attr(out_cur, output, out_rem) {
|
||||
struct blob_attr *out_tb[6] = {0};
|
||||
struct blob_attr *out_tb[7] = {0};
|
||||
|
||||
blobmsg_parse(p, 6, out_tb, blobmsg_data(out_cur), blobmsg_len(out_cur));
|
||||
blobmsg_parse(p, 7, out_tb, blobmsg_data(out_cur), blobmsg_len(out_cur));
|
||||
|
||||
char *arg = out_tb[0] ? blobmsg_get_string(out_tb[0]) : "";
|
||||
printf("%s output:%s\n", name, arg);
|
||||
|
|
@ -209,9 +210,9 @@ static void __ubus_callback(struct ubus_request *req, int type __attribute__((un
|
|||
|
||||
if (input) {
|
||||
blobmsg_for_each_attr(in_cur, input, in_rem) {
|
||||
struct blob_attr *in_tb[6] = {0};
|
||||
struct blob_attr *in_tb[7] = {0};
|
||||
|
||||
blobmsg_parse(p, 6, in_tb, blobmsg_data(in_cur), blobmsg_len(in_cur));
|
||||
blobmsg_parse(p, 7, in_tb, blobmsg_data(in_cur), blobmsg_len(in_cur));
|
||||
|
||||
char *arg = in_tb[0] ? blobmsg_get_string(in_tb[0]) : "";
|
||||
printf("%s event_arg:%s\n", name, arg);
|
||||
|
|
@ -385,7 +386,7 @@ static int in_dotso_out_cli_exec_set(cli_data_t *cli_data, char *argv[])
|
|||
printf("%s => Set value is successfully done\n", cli_data->bbf_ctx.in_param);
|
||||
bbf_entry_restart_services(NULL, true);
|
||||
} else {
|
||||
printf("ERROR: %d retrieving %s => %s\n", err, cli_data->bbf_ctx.in_param, cli_data->bbf_ctx.in_value);
|
||||
printf("Fault %d: %s\n", err, cli_data->bbf_ctx.fault_msg);
|
||||
bbf_entry_revert_changes(NULL);
|
||||
err = EXIT_FAILURE;
|
||||
}
|
||||
|
|
@ -423,7 +424,7 @@ static int in_dotso_out_cli_exec_add(cli_data_t *cli_data, char *argv[])
|
|||
printf("Added %s%s.\n", cli_data->bbf_ctx.in_param, cli_data->bbf_ctx.addobj_instance);
|
||||
bbf_entry_restart_services(NULL, true);
|
||||
} else {
|
||||
printf("ERROR: %d retrieving %s\n", err, cli_data->bbf_ctx.in_param);
|
||||
printf("Fault %d: %s\n", err, cli_data->bbf_ctx.fault_msg);
|
||||
bbf_entry_revert_changes(NULL);
|
||||
err = EXIT_FAILURE;
|
||||
}
|
||||
|
|
@ -461,7 +462,7 @@ static int in_dotso_out_cli_exec_del(cli_data_t *cli_data, char *argv[])
|
|||
printf("Deleted %s\n", cli_data->bbf_ctx.in_param);
|
||||
bbf_entry_restart_services(NULL, true);
|
||||
} else {
|
||||
printf("ERROR: %d retrieving %s\n", err, cli_data->bbf_ctx.in_param);
|
||||
printf("Fault %d: %s\n", err, cli_data->bbf_ctx.fault_msg);
|
||||
bbf_entry_revert_changes(NULL);
|
||||
err = EXIT_FAILURE;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -813,7 +813,7 @@ static int resolve_path(struct dmctx *bbf_ctx, char *qPath, size_t pos, struct l
|
|||
|
||||
if (check == false && list_empty(&plist_local)) {
|
||||
free_path_list(&plist_local);
|
||||
return bbf_fault_map(bbf_ctx->dm_type, FAULT_9005);
|
||||
return bbf_fault_map(bbf_ctx, FAULT_9005);
|
||||
}
|
||||
|
||||
refresh_path_list(resolved_plist, &plist_local);
|
||||
|
|
@ -843,7 +843,7 @@ int get_resolved_paths(struct dmctx *bbf_ctx, char *qpath, struct list_head *res
|
|||
}
|
||||
} else {
|
||||
INFO("Not able to get base path");
|
||||
fault = bbf_fault_map(bbf_ctx->dm_type, FAULT_9005);
|
||||
fault = bbf_fault_map(bbf_ctx, FAULT_9005);
|
||||
}
|
||||
|
||||
if (fault)
|
||||
|
|
|
|||
|
|
@ -173,8 +173,8 @@ void fill_err_code_table(bbfdm_data_t *data, int fault)
|
|||
{
|
||||
void *table = blobmsg_open_table(&data->bb, NULL);
|
||||
blobmsg_add_string(&data->bb, "path", data->bbf_ctx.in_param ? data->bbf_ctx.in_param : "");
|
||||
blobmsg_add_u32(&data->bb, "fault", bbf_fault_map(data->bbf_ctx.dm_type, fault));
|
||||
bb_add_string(&data->bb, "fault_msg", "");
|
||||
blobmsg_add_u32(&data->bb, "fault", bbf_fault_map(&data->bbf_ctx, fault));
|
||||
bb_add_string(&data->bb, "fault_msg", data->bbf_ctx.fault_msg);
|
||||
blobmsg_close_table(&data->bb, table);
|
||||
}
|
||||
|
||||
|
|
@ -183,8 +183,8 @@ void fill_err_code_array(bbfdm_data_t *data, int fault)
|
|||
void *array = blobmsg_open_array(&data->bb, "results");
|
||||
void *table = blobmsg_open_table(&data->bb, NULL);
|
||||
blobmsg_add_string(&data->bb, "path", data->bbf_ctx.in_param);
|
||||
blobmsg_add_u32(&data->bb, "fault", bbf_fault_map(data->bbf_ctx.dm_type, fault));
|
||||
bb_add_string(&data->bb, "fault_msg", "");
|
||||
blobmsg_add_u32(&data->bb, "fault", bbf_fault_map(&data->bbf_ctx, fault));
|
||||
bb_add_string(&data->bb, "fault_msg", data->bbf_ctx.fault_msg);
|
||||
blobmsg_close_table(&data->bb, table);
|
||||
blobmsg_close_array(&data->bb, array);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ static int bbfdm_dm_operate(bbfdm_data_t *data)
|
|||
}
|
||||
} else {
|
||||
blobmsg_add_u32(&data->bb, "fault", fault);
|
||||
bb_add_string(&data->bb, "fault_msg", "");
|
||||
bb_add_string(&data->bb, "fault_msg", data->bbf_ctx.fault_msg);
|
||||
}
|
||||
|
||||
blobmsg_close_table(&data->bb, global_table);
|
||||
|
|
|
|||
|
|
@ -39,8 +39,13 @@ function exec_cmd_verbose()
|
|||
function install_libusermngr()
|
||||
{
|
||||
# clone and compile libusermngr
|
||||
rm -rf /opt/dev/usermngr
|
||||
[ -d "/opt/dev/usermngr" ] && rm -rf /opt/dev/usermngr
|
||||
|
||||
if [ -n "${USERMNGR_BRANCH}" ]; then
|
||||
exec_cmd git clone -b ${USERMNGR_BRANCH} https://gitlab-ci-token:${CI_JOB_TOKEN}@dev.iopsys.eu/bbf/usermngr.git /opt/dev/usermngr
|
||||
else
|
||||
exec_cmd git clone -b devel https://gitlab-ci-token:${CI_JOB_TOKEN}@dev.iopsys.eu/bbf/usermngr.git /opt/dev/usermngr
|
||||
fi
|
||||
|
||||
echo "Compiling libusermngr"
|
||||
exec_cmd_verbose make clean -C /opt/dev/usermngr/src/
|
||||
|
|
@ -109,8 +114,13 @@ function install_libwifi_dataelements()
|
|||
function install_libperiodicstats()
|
||||
{
|
||||
# clone and compile libperiodicstats
|
||||
rm -rf /opt/dev/periodicstats
|
||||
[ -d "/opt/dev/periodicstats" ] && rm -rf /opt/dev/periodicstats
|
||||
|
||||
if [ -n "${PERIODICSTATS_BRANCH}" ]; then
|
||||
exec_cmd git clone -b ${PERIODICSTATS_BRANCH} https://gitlab-ci-token:${CI_JOB_TOKEN}@dev.iopsys.eu/bbf/periodicstats.git /opt/dev/periodicstats
|
||||
else
|
||||
exec_cmd git clone -b devel https://gitlab-ci-token:${CI_JOB_TOKEN}@dev.iopsys.eu/bbf/periodicstats.git /opt/dev/periodicstats
|
||||
fi
|
||||
|
||||
echo "Compiling libperiodicstats"
|
||||
exec_cmd_verbose make clean -C /opt/dev/periodicstats/
|
||||
|
|
@ -125,8 +135,13 @@ function install_libperiodicstats()
|
|||
function install_libcwmpdm()
|
||||
{
|
||||
# clone and compile libcwmpdm
|
||||
rm -rf /opt/dev/icwmp
|
||||
[ -d "/opt/dev/icwmp" ] && rm -rf /opt/dev/icwmp
|
||||
|
||||
if [ -n "${ICWMP_BRANCH}" ]; then
|
||||
exec_cmd git clone -b ${ICWMP_BRANCH} --depth 1 https://gitlab-ci-token:${CI_JOB_TOKEN}@dev.iopsys.eu/bbf/icwmp.git /opt/dev/icwmp
|
||||
else
|
||||
exec_cmd git clone -b devel --depth 1 https://gitlab-ci-token:${CI_JOB_TOKEN}@dev.iopsys.eu/bbf/icwmp.git /opt/dev/icwmp
|
||||
fi
|
||||
|
||||
echo "Compiling libcwmpdm"
|
||||
cd /opt/dev/icwmp
|
||||
|
|
|
|||
|
|
@ -178,72 +178,100 @@ void bbf_find_dmmap_section_by_option(char *dmmap_package, char *section_type, c
|
|||
return get_dmmap_section_of_config_section_eq(dmmap_package, section_type, option_name, option_value, dmmap_section);
|
||||
}
|
||||
|
||||
int bbf_validate_string(char *value, int min_length, int max_length, char *enumeration[], char *pattern[])
|
||||
__attribute__ ((deprecated)) int bbf_validate_string(char *value, int min_length, int max_length, char *enumeration[], char *pattern[])
|
||||
{
|
||||
return dm_validate_string(value, min_length, max_length, enumeration, pattern);
|
||||
struct dmctx ctx = {0};
|
||||
|
||||
return bbfdm_validate_string(&ctx, value, min_length, max_length, enumeration, pattern);
|
||||
}
|
||||
|
||||
int bbf_validate_boolean(char *value)
|
||||
__attribute__ ((deprecated)) int bbf_validate_boolean(char *value)
|
||||
{
|
||||
return dm_validate_boolean(value);
|
||||
struct dmctx ctx = {0};
|
||||
|
||||
return bbfdm_validate_boolean(&ctx, value);
|
||||
}
|
||||
|
||||
int bbf_validate_unsignedInt(char *value, struct range_args r_args[], int r_args_size)
|
||||
__attribute__ ((deprecated)) int bbf_validate_unsignedInt(char *value, struct range_args r_args[], int r_args_size)
|
||||
{
|
||||
return dm_validate_unsignedInt(value, r_args, r_args_size);
|
||||
struct dmctx ctx = {0};
|
||||
|
||||
return bbfdm_validate_unsignedInt(&ctx, value, r_args, r_args_size);
|
||||
}
|
||||
|
||||
int bbf_validate_int(char *value, struct range_args r_args[], int r_args_size)
|
||||
__attribute__ ((deprecated)) int bbf_validate_int(char *value, struct range_args r_args[], int r_args_size)
|
||||
{
|
||||
return dm_validate_int(value, r_args, r_args_size);
|
||||
struct dmctx ctx = {0};
|
||||
|
||||
return bbfdm_validate_int(&ctx, value, r_args, r_args_size);
|
||||
}
|
||||
|
||||
int bbf_validate_unsignedLong(char *value, struct range_args r_args[], int r_args_size)
|
||||
__attribute__ ((deprecated)) int bbf_validate_unsignedLong(char *value, struct range_args r_args[], int r_args_size)
|
||||
{
|
||||
return dm_validate_unsignedLong(value, r_args, r_args_size);
|
||||
struct dmctx ctx = {0};
|
||||
|
||||
return bbfdm_validate_unsignedLong(&ctx, value, r_args, r_args_size);
|
||||
}
|
||||
|
||||
int bbf_validate_long(char *value, struct range_args r_args[], int r_args_size)
|
||||
__attribute__ ((deprecated)) int bbf_validate_long(char *value, struct range_args r_args[], int r_args_size)
|
||||
{
|
||||
return dm_validate_long(value, r_args, r_args_size);
|
||||
struct dmctx ctx = {0};
|
||||
|
||||
return bbfdm_validate_long(&ctx, value, r_args, r_args_size);
|
||||
}
|
||||
|
||||
int bbf_validate_dateTime(char *value)
|
||||
__attribute__ ((deprecated)) int bbf_validate_dateTime(char *value)
|
||||
{
|
||||
return dm_validate_dateTime(value);
|
||||
struct dmctx ctx = {0};
|
||||
|
||||
return bbfdm_validate_dateTime(&ctx, value);
|
||||
}
|
||||
|
||||
int bbf_validate_hexBinary(char *value, struct range_args r_args[], int r_args_size)
|
||||
__attribute__ ((deprecated)) int bbf_validate_hexBinary(char *value, struct range_args r_args[], int r_args_size)
|
||||
{
|
||||
return dm_validate_hexBinary(value, r_args, r_args_size);
|
||||
struct dmctx ctx = {0};
|
||||
|
||||
return bbfdm_validate_hexBinary(&ctx, value, r_args, r_args_size);
|
||||
}
|
||||
|
||||
int bbf_validate_string_list(char *value, int min_item, int max_item, int max_size, int min, int max, char *enumeration[], char *pattern[])
|
||||
__attribute__ ((deprecated)) int bbf_validate_string_list(char *value, int min_item, int max_item, int max_size, int min, int max, char *enumeration[], char *pattern[])
|
||||
{
|
||||
return dm_validate_string_list(value, min_item,max_item, max_size, min, max, enumeration, pattern);
|
||||
struct dmctx ctx = {0};
|
||||
|
||||
return bbfdm_validate_string_list(&ctx, value, min_item,max_item, max_size, min, max, enumeration, pattern);
|
||||
}
|
||||
|
||||
int bbf_validate_unsignedInt_list(char *value, int min_item, int max_item, int max_size, struct range_args r_args[], int r_args_size)
|
||||
__attribute__ ((deprecated)) int bbf_validate_unsignedInt_list(char *value, int min_item, int max_item, int max_size, struct range_args r_args[], int r_args_size)
|
||||
{
|
||||
return dm_validate_unsignedInt_list(value, min_item, max_item, max_size, r_args, r_args_size);
|
||||
struct dmctx ctx = {0};
|
||||
|
||||
return bbfdm_validate_unsignedInt_list(&ctx, value, min_item, max_item, max_size, r_args, r_args_size);
|
||||
}
|
||||
|
||||
int bbf_validate_int_list(char *value, int min_item, int max_item, int max_size, struct range_args r_args[], int r_args_size)
|
||||
__attribute__ ((deprecated)) int bbf_validate_int_list(char *value, int min_item, int max_item, int max_size, struct range_args r_args[], int r_args_size)
|
||||
{
|
||||
return dm_validate_int_list(value, min_item, max_item, max_size, r_args, r_args_size);
|
||||
struct dmctx ctx = {0};
|
||||
|
||||
return bbfdm_validate_int_list(&ctx, value, min_item, max_item, max_size, r_args, r_args_size);
|
||||
}
|
||||
|
||||
int bbf_validate_unsignedLong_list(char *value, int min_item, int max_item, int max_size, struct range_args r_args[], int r_args_size)
|
||||
__attribute__ ((deprecated)) int bbf_validate_unsignedLong_list(char *value, int min_item, int max_item, int max_size, struct range_args r_args[], int r_args_size)
|
||||
{
|
||||
return dm_validate_unsignedLong_list(value, min_item, max_item, max_size, r_args, r_args_size);
|
||||
struct dmctx ctx = {0};
|
||||
|
||||
return bbfdm_validate_unsignedLong_list(&ctx, value, min_item, max_item, max_size, r_args, r_args_size);
|
||||
}
|
||||
|
||||
int bbf_validate_long_list(char *value, int min_item, int max_item, int max_size, struct range_args r_args[], int r_args_size)
|
||||
__attribute__ ((deprecated)) int bbf_validate_long_list(char *value, int min_item, int max_item, int max_size, struct range_args r_args[], int r_args_size)
|
||||
{
|
||||
return dm_validate_long_list(value, min_item, max_item, max_size, r_args, r_args_size);
|
||||
struct dmctx ctx = {0};
|
||||
|
||||
return bbfdm_validate_long_list(&ctx, value, min_item, max_item, max_size, r_args, r_args_size);
|
||||
}
|
||||
|
||||
int bbf_validate_hexBinary_list(char *value, int min_item, int max_item, int max_size, struct range_args r_args[], int r_args_size)
|
||||
__attribute__ ((deprecated)) int bbf_validate_hexBinary_list(char *value, int min_item, int max_item, int max_size, struct range_args r_args[], int r_args_size)
|
||||
{
|
||||
return dm_validate_hexBinary_list(value, min_item, max_item, max_size, r_args, r_args_size);
|
||||
struct dmctx ctx = {0};
|
||||
|
||||
return bbfdm_validate_hexBinary_list(&ctx, value, min_item, max_item, max_size, r_args, r_args_size);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -120,7 +120,7 @@ typedef struct dm_leaf_s {
|
|||
int (*getvalue)(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
|
||||
int (*setvalue)(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
|
||||
int bbfdm_type;
|
||||
char version[10]; //To be removed
|
||||
char version[10] __attribute__((deprecated));
|
||||
char *default_value;
|
||||
} DMLEAF;
|
||||
|
||||
|
|
@ -139,7 +139,7 @@ typedef struct dm_obj_s {
|
|||
int (*get_linker)(char *refparam, struct dmctx *dmctx, void *data, char *instance, char **linker);
|
||||
int bbfdm_type;
|
||||
const char **unique_keys;
|
||||
char version[10]; //To be removed later
|
||||
char version[10] __attribute__((deprecated));
|
||||
} DMOBJ;
|
||||
|
||||
struct dm_parameter {
|
||||
|
|
@ -180,6 +180,7 @@ struct dmctx {
|
|||
bool nextlevel;
|
||||
bool iswildcard;
|
||||
int faultcode;
|
||||
char fault_msg[256];
|
||||
int setaction;
|
||||
char *in_param;
|
||||
char *in_value;
|
||||
|
|
@ -410,11 +411,15 @@ struct range_args {
|
|||
const char *max;
|
||||
};
|
||||
|
||||
struct dmmap_dup
|
||||
{
|
||||
struct dmmap_dup {
|
||||
struct list_head list;
|
||||
struct uci_section *config_section;
|
||||
struct uci_section *dmmap_section;
|
||||
};
|
||||
|
||||
struct dm_fault {
|
||||
int code;
|
||||
char *description;
|
||||
};
|
||||
|
||||
#endif //__DMAPI_H__
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -266,20 +266,21 @@ void convert_hex_to_string(const char *hex, char *str, size_t size);
|
|||
void convert_str_option_to_hex(unsigned int tag, const char *str, char *hex, size_t size);
|
||||
void convert_hex_option_to_string(unsigned int tag, const char *hex, char *str, size_t size);
|
||||
bool match(const char *string, const char *pattern);
|
||||
int dm_validate_string(char *value, int min_length, int max_length, char *enumeration[], char *pattern[]);
|
||||
int dm_validate_boolean(char *value);
|
||||
int dm_validate_unsignedInt(char *value, struct range_args r_args[], int r_args_size);
|
||||
int dm_validate_int(char *value, struct range_args r_args[], int r_args_size);
|
||||
int dm_validate_unsignedLong(char *value, struct range_args r_args[], int r_args_size);
|
||||
int dm_validate_long(char *value, struct range_args r_args[], int r_args_size);
|
||||
int dm_validate_dateTime(char *value);
|
||||
int dm_validate_hexBinary(char *value, struct range_args r_args[], int r_args_size);
|
||||
int dm_validate_string_list(char *value, int min_item, int max_item, int max_size, int min, int max, char *enumeration[], char *pattern[]);
|
||||
int dm_validate_unsignedInt_list(char *value, int min_item, int max_item, int max_size, struct range_args r_args[], int r_args_size);
|
||||
int dm_validate_int_list(char *value, int min_item, int max_item, int max_size, struct range_args r_args[], int r_args_size);
|
||||
int dm_validate_unsignedLong_list(char *value, int min_item, int max_item, int max_size, struct range_args r_args[], int r_args_size);
|
||||
int dm_validate_long_list(char *value, int min_item, int max_item, int max_size, struct range_args r_args[], int r_args_size);
|
||||
int dm_validate_hexBinary_list(char *value, int min_item, int max_item, int max_size, struct range_args r_args[], int r_args_size);
|
||||
void bbfdm_set_fault_message(struct dmctx *ctx, const char *format, ...);
|
||||
int bbfdm_validate_boolean(struct dmctx *ctx, char *value);
|
||||
int bbfdm_validate_unsignedInt(struct dmctx *ctx, char *value, struct range_args r_args[], int r_args_size);
|
||||
int bbfdm_validate_int(struct dmctx *ctx, char *value, struct range_args r_args[], int r_args_size);
|
||||
int bbfdm_validate_unsignedLong(struct dmctx *ctx, char *value, struct range_args r_args[], int r_args_size);
|
||||
int bbfdm_validate_long(struct dmctx *ctx, char *value, struct range_args r_args[], int r_args_size);
|
||||
int bbfdm_validate_string(struct dmctx *ctx, char *value, int min_length, int max_length, char *enumeration[], char *pattern[]);
|
||||
int bbfdm_validate_dateTime(struct dmctx *ctx, char *value);
|
||||
int bbfdm_validate_hexBinary(struct dmctx *ctx, char *value, struct range_args r_args[], int r_args_size);
|
||||
int bbfdm_validate_unsignedInt_list(struct dmctx *ctx, char *value, int min_item, int max_item, int max_size, struct range_args r_args[], int r_args_size);
|
||||
int bbfdm_validate_int_list(struct dmctx *ctx, char *value, int min_item, int max_item, int max_size, struct range_args r_args[], int r_args_size);
|
||||
int bbfdm_validate_unsignedLong_list(struct dmctx *ctx, char *value, int min_item, int max_item, int max_size, struct range_args r_args[], int r_args_size);
|
||||
int bbfdm_validate_long_list(struct dmctx *ctx, char *value, int min_item, int max_item, int max_size, struct range_args r_args[], int r_args_size);
|
||||
int bbfdm_validate_string_list(struct dmctx *ctx, char *value, int min_item, int max_item, int max_size, int min, int max, char *enumeration[], char *pattern[]);
|
||||
int bbfdm_validate_hexBinary_list(struct dmctx *ctx, char *value, int min_item, int max_item, int max_size, struct range_args r_args[], int r_args_size);
|
||||
char *base64_decode(const char *src);
|
||||
void string_to_mac(const char *str, size_t str_len, char *out, size_t out_len);
|
||||
bool folder_exists(const char *path);
|
||||
|
|
@ -297,4 +298,22 @@ char *ifaddrs_get_global_ipv6(char *interface_name);
|
|||
bool validate_blob_message(struct blob_attr *src, struct blob_attr *dst);
|
||||
void strip_lead_trail_whitespace(char *str);
|
||||
int dm_buf_to_file(char *buf, const char *filename);
|
||||
|
||||
/* Deprecated functions */
|
||||
__attribute__ ((deprecated)) int dm_validate_string(char *value, int min_length, int max_length, char *enumeration[], char *pattern[]);
|
||||
__attribute__ ((deprecated)) int dm_validate_boolean(char *value);
|
||||
__attribute__ ((deprecated)) int dm_validate_unsignedInt(char *value, struct range_args r_args[], int r_args_size);
|
||||
__attribute__ ((deprecated)) int dm_validate_int(char *value, struct range_args r_args[], int r_args_size);
|
||||
__attribute__ ((deprecated)) int dm_validate_unsignedLong(char *value, struct range_args r_args[], int r_args_size);
|
||||
__attribute__ ((deprecated)) int dm_validate_long(char *value, struct range_args r_args[], int r_args_size);
|
||||
__attribute__ ((deprecated)) int dm_validate_dateTime(char *value);
|
||||
__attribute__ ((deprecated)) int dm_validate_hexBinary(char *value, struct range_args r_args[], int r_args_size);
|
||||
__attribute__ ((deprecated)) int dm_validate_string_list(char *value, int min_item, int max_item, int max_size, int min, int max, char *enumeration[], char *pattern[]);
|
||||
__attribute__ ((deprecated)) int dm_validate_unsignedInt_list(char *value, int min_item, int max_item, int max_size, struct range_args r_args[], int r_args_size);
|
||||
__attribute__ ((deprecated)) int dm_validate_int_list(char *value, int min_item, int max_item, int max_size, struct range_args r_args[], int r_args_size);
|
||||
__attribute__ ((deprecated)) int dm_validate_unsignedLong_list(char *value, int min_item, int max_item, int max_size, struct range_args r_args[], int r_args_size);
|
||||
__attribute__ ((deprecated)) int dm_validate_long_list(char *value, int min_item, int max_item, int max_size, struct range_args r_args[], int r_args_size);
|
||||
__attribute__ ((deprecated)) int dm_validate_hexBinary_list(char *value, int min_item, int max_item, int max_size, struct range_args r_args[], int r_args_size);
|
||||
/************************/
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -20,6 +20,28 @@
|
|||
LIST_HEAD(head_package_change);
|
||||
LIST_HEAD(global_memhead);
|
||||
|
||||
static struct dm_fault DM_FAULT_ARRAY[] = {
|
||||
{ FAULT_9000, "Method not supported" },
|
||||
{ FAULT_9001, "Request denied (no reason specified)" },
|
||||
{ FAULT_9002, "Internal error" },
|
||||
{ FAULT_9003, "Invalid arguments" },
|
||||
{ FAULT_9004, "Resources exceeded" },
|
||||
{ FAULT_9005, "Invalid parameter name" },
|
||||
{ FAULT_9006, "Invalid parameter type" },
|
||||
{ FAULT_9007, "Invalid parameter value" },
|
||||
{ FAULT_9008, "Attempt to set a non-writable parameter" },
|
||||
{ USP_FAULT_GENERAL_FAILURE, "general failure"},
|
||||
{ USP_FAULT_MESSAGE_NOT_UNDERSTOOD, "message was not understood"},
|
||||
{ USP_FAULT_REQUEST_DENIED, "Cannot or will not process message"},
|
||||
{ USP_FAULT_INTERNAL_ERROR, "Message failed due to an internal error"},
|
||||
{ USP_FAULT_INVALID_ARGUMENT, "invalid values in the request elements"},
|
||||
{ USP_FAULT_RESOURCES_EXCEEDED, "Message failed due to memory or processing limitations"},
|
||||
{ USP_FAULT_INVALID_TYPE, "Unable to convert string value to correct data type"},
|
||||
{ USP_FAULT_INVALID_VALUE, "Out of range or invalid enumeration"},
|
||||
{ USP_FAULT_PARAM_READ_ONLY, "Attempted to write to a read only parameter"},
|
||||
{ USP_FAULT_INVALID_PATH, "Path is not present in the data model schema"},
|
||||
};
|
||||
|
||||
void bbf_ctx_init(struct dmctx *ctx, DMOBJ *tEntryObj,
|
||||
DM_MAP_VENDOR *tVendorExtension[],
|
||||
DM_MAP_VENDOR_EXCLUDE *tVendorExtensionExclude)
|
||||
|
|
@ -57,82 +79,114 @@ void bbf_ctx_clean_sub(struct dmctx *ctx)
|
|||
free_all_list_parameter(ctx);
|
||||
}
|
||||
|
||||
int bbf_fault_map(unsigned int dm_type, int fault)
|
||||
static char *get_fault_message(int fault_code)
|
||||
{
|
||||
for (int i = 0; i < ARRAY_SIZE(DM_FAULT_ARRAY); i++)
|
||||
if (DM_FAULT_ARRAY[i].code == fault_code)
|
||||
return DM_FAULT_ARRAY[i].description;
|
||||
|
||||
return "BBFDM: Internal error";
|
||||
}
|
||||
|
||||
int bbf_fault_map(struct dmctx *ctx, int fault)
|
||||
{
|
||||
int out_fault;
|
||||
|
||||
if (dm_type == BBFDM_USP) {
|
||||
if (!fault)
|
||||
return 0;
|
||||
|
||||
if (ctx->dm_type == BBFDM_USP) {
|
||||
switch(fault) {
|
||||
case FAULT_9000:
|
||||
bbfdm_set_fault_message(ctx, "%s", get_fault_message(USP_FAULT_MESSAGE_NOT_UNDERSTOOD));
|
||||
out_fault = USP_FAULT_MESSAGE_NOT_UNDERSTOOD;
|
||||
break;
|
||||
case FAULT_9001:
|
||||
bbfdm_set_fault_message(ctx, "%s", get_fault_message(USP_FAULT_REQUEST_DENIED));
|
||||
out_fault = USP_FAULT_REQUEST_DENIED;
|
||||
break;
|
||||
case FAULT_9002:
|
||||
bbfdm_set_fault_message(ctx, "%s", get_fault_message(USP_FAULT_INTERNAL_ERROR));
|
||||
out_fault = USP_FAULT_INTERNAL_ERROR;
|
||||
break;
|
||||
case FAULT_9003:
|
||||
bbfdm_set_fault_message(ctx, "%s", get_fault_message(USP_FAULT_INVALID_ARGUMENT));
|
||||
out_fault = USP_FAULT_INVALID_ARGUMENT;
|
||||
break;
|
||||
case FAULT_9004:
|
||||
case FAULT_9027:
|
||||
bbfdm_set_fault_message(ctx, "%s", get_fault_message(USP_FAULT_RESOURCES_EXCEEDED));
|
||||
out_fault = USP_FAULT_RESOURCES_EXCEEDED;
|
||||
break;
|
||||
case FAULT_9005:
|
||||
bbfdm_set_fault_message(ctx, "%s", get_fault_message(USP_FAULT_INVALID_PATH));
|
||||
out_fault = USP_FAULT_INVALID_PATH;
|
||||
break;
|
||||
case FAULT_9006:
|
||||
bbfdm_set_fault_message(ctx, "%s", get_fault_message(USP_FAULT_INVALID_TYPE));
|
||||
out_fault = USP_FAULT_INVALID_TYPE;
|
||||
break;
|
||||
case FAULT_9007:
|
||||
bbfdm_set_fault_message(ctx, "%s", get_fault_message(USP_FAULT_PARAM_READ_ONLY));
|
||||
out_fault = USP_FAULT_INVALID_VALUE;
|
||||
break;
|
||||
case FAULT_9008:
|
||||
bbfdm_set_fault_message(ctx, "%s", get_fault_message(USP_FAULT_PARAM_READ_ONLY));
|
||||
out_fault = USP_FAULT_PARAM_READ_ONLY;
|
||||
break;
|
||||
default:
|
||||
if (fault >= FAULT_9000)
|
||||
if (fault >= FAULT_9000) {
|
||||
bbfdm_set_fault_message(ctx, "%s", get_fault_message(USP_FAULT_GENERAL_FAILURE));
|
||||
out_fault = USP_FAULT_GENERAL_FAILURE;
|
||||
else
|
||||
} else {
|
||||
bbfdm_set_fault_message(ctx, "%s", get_fault_message(fault));
|
||||
out_fault = fault;
|
||||
}
|
||||
} else if (dm_type == BBFDM_CWMP) {
|
||||
}
|
||||
} else if (ctx->dm_type == BBFDM_CWMP) {
|
||||
switch(fault) {
|
||||
case USP_FAULT_GENERAL_FAILURE:
|
||||
out_fault = FAULT_9002;
|
||||
break;
|
||||
case USP_FAULT_MESSAGE_NOT_UNDERSTOOD:
|
||||
bbfdm_set_fault_message(ctx, "%s", get_fault_message(FAULT_9000));
|
||||
out_fault = FAULT_9000;
|
||||
break;
|
||||
case USP_FAULT_REQUEST_DENIED:
|
||||
bbfdm_set_fault_message(ctx, "%s", get_fault_message(FAULT_9001));
|
||||
out_fault = FAULT_9001;
|
||||
break;
|
||||
case USP_FAULT_GENERAL_FAILURE:
|
||||
case USP_FAULT_INTERNAL_ERROR:
|
||||
bbfdm_set_fault_message(ctx, "%s", get_fault_message(FAULT_9002));
|
||||
out_fault = FAULT_9002;
|
||||
break;
|
||||
case USP_FAULT_INVALID_ARGUMENT:
|
||||
bbfdm_set_fault_message(ctx, "%s", get_fault_message(FAULT_9003));
|
||||
out_fault = FAULT_9003;
|
||||
break;
|
||||
case USP_FAULT_RESOURCES_EXCEEDED:
|
||||
bbfdm_set_fault_message(ctx, "%s", get_fault_message(FAULT_9004));
|
||||
out_fault = FAULT_9004;
|
||||
break;
|
||||
case USP_FAULT_INVALID_PATH:
|
||||
bbfdm_set_fault_message(ctx, "%s", get_fault_message(FAULT_9005));
|
||||
out_fault = FAULT_9005;
|
||||
break;
|
||||
case USP_FAULT_INVALID_TYPE:
|
||||
bbfdm_set_fault_message(ctx, "%s", get_fault_message(FAULT_9006));
|
||||
out_fault = FAULT_9006;
|
||||
break;
|
||||
case USP_FAULT_INVALID_VALUE:
|
||||
bbfdm_set_fault_message(ctx, "%s", get_fault_message(FAULT_9007));
|
||||
out_fault = FAULT_9007;
|
||||
break;
|
||||
case USP_FAULT_PARAM_READ_ONLY:
|
||||
bbfdm_set_fault_message(ctx, "%s", get_fault_message(FAULT_9008));
|
||||
out_fault = FAULT_9008;
|
||||
break;
|
||||
case USP_FAULT_INVALID_PATH:
|
||||
out_fault = FAULT_9005;
|
||||
break;
|
||||
default:
|
||||
bbfdm_set_fault_message(ctx, "%s", get_fault_message(fault));
|
||||
out_fault = fault;
|
||||
}
|
||||
} else {
|
||||
bbfdm_set_fault_message(ctx, "%s", get_fault_message(fault));
|
||||
out_fault = fault;
|
||||
}
|
||||
|
||||
|
|
@ -142,12 +196,17 @@ int bbf_fault_map(unsigned int dm_type, int fault)
|
|||
int bbf_entry_method(struct dmctx *ctx, int cmd)
|
||||
{
|
||||
int fault = 0;
|
||||
ctx->fault_msg[0] = 0;
|
||||
|
||||
if (!ctx || !ctx->dm_entryobj)
|
||||
return bbf_fault_map(ctx->dm_type, USP_FAULT_INVALID_CONFIGURATION);
|
||||
if (!ctx->dm_entryobj) {
|
||||
bbfdm_set_fault_message(ctx, "Root entry was not defined.");
|
||||
return bbf_fault_map(ctx, FAULT_9002);
|
||||
}
|
||||
|
||||
if (!ctx->in_param)
|
||||
return bbf_fault_map(ctx->dm_type, USP_FAULT_INVALID_PATH);
|
||||
if (!ctx->in_param) {
|
||||
bbfdm_set_fault_message(ctx, "Path should not be blank.");
|
||||
return bbf_fault_map(ctx, FAULT_9005);
|
||||
}
|
||||
|
||||
load_plugins(ctx);
|
||||
|
||||
|
|
@ -197,7 +256,7 @@ int bbf_entry_method(struct dmctx *ctx, int cmd)
|
|||
}
|
||||
|
||||
dmuci_save();
|
||||
return bbf_fault_map(ctx->dm_type, fault);
|
||||
return bbf_fault_map(ctx, fault);
|
||||
}
|
||||
|
||||
void bbf_global_clean(DMOBJ *dm_entryobj)
|
||||
|
|
@ -225,6 +284,7 @@ int dm_entry_validate_allowed_objects(struct dmctx *ctx, char *value, char *obje
|
|||
}
|
||||
}
|
||||
|
||||
bbfdm_set_fault_message(ctx, "'%s' value is not allowed.", value);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ void bbf_ctx_init_sub(struct dmctx *ctx, DMOBJ *tEntryObj,
|
|||
DM_MAP_VENDOR_EXCLUDE *tVendorExtensionExclude);
|
||||
void bbf_ctx_clean_sub(struct dmctx *ctx);
|
||||
|
||||
int bbf_fault_map(unsigned int dm_type, int fault);
|
||||
int bbf_fault_map(struct dmctx *ctx, int fault);
|
||||
|
||||
int bbf_entry_method(struct dmctx *ctx, int cmd);
|
||||
|
||||
|
|
|
|||
|
|
@ -524,7 +524,7 @@ void bbf_find_dmmap_section_by_option(char *dmmap_package, char *section_type, c
|
|||
|
||||
/*********************************************************************//**
|
||||
**
|
||||
** bbf_validate_string
|
||||
** bbfdm_validate_string
|
||||
**
|
||||
** This API is to validate a string value
|
||||
**
|
||||
|
|
@ -537,24 +537,25 @@ void bbf_find_dmmap_section_by_option(char *dmmap_package, char *section_type, c
|
|||
** \return 0 if the string value is valid, -1 otherwise
|
||||
**
|
||||
**************************************************************************/
|
||||
int bbf_validate_string(char *value, int min_length, int max_length, char *enumeration[], char *pattern[]);
|
||||
int bbfdm_validate_string(struct dmctx *ctx, char *value, int min_length, int max_length, char *enumeration[], char *pattern[]);
|
||||
|
||||
/*********************************************************************//**
|
||||
**
|
||||
** bbf_validate_boolean
|
||||
** bbfdm_validate_boolean
|
||||
**
|
||||
** This API is to validate a bool value
|
||||
**
|
||||
** \param ctx - pointer to the bbf context
|
||||
** \param value - pointer to the value to validate
|
||||
**
|
||||
** \return 0 if the bool value is valid, -1 otherwise
|
||||
**
|
||||
**************************************************************************/
|
||||
int bbf_validate_boolean(char *value);
|
||||
int bbfdm_validate_boolean(struct dmctx *ctx, char *value);
|
||||
|
||||
/*********************************************************************//**
|
||||
**
|
||||
** bbf_validate_unsignedInt
|
||||
** bbfdm_validate_unsignedInt
|
||||
**
|
||||
** This API is to validate an unsigned int value
|
||||
**
|
||||
|
|
@ -565,11 +566,11 @@ int bbf_validate_boolean(char *value);
|
|||
** \return 0 if the unsigned int value is valid, -1 otherwise
|
||||
**
|
||||
**************************************************************************/
|
||||
int bbf_validate_unsignedInt(char *value, struct range_args r_args[], int r_args_size);
|
||||
int bbfdm_validate_unsignedInt(struct dmctx *ctx, char *value, struct range_args r_args[], int r_args_size);
|
||||
|
||||
/*********************************************************************//**
|
||||
**
|
||||
** bbf_validate_int
|
||||
** bbfdm_validate_int
|
||||
**
|
||||
** This API is to validate a int value
|
||||
**
|
||||
|
|
@ -580,11 +581,11 @@ int bbf_validate_unsignedInt(char *value, struct range_args r_args[], int r_args
|
|||
** \return 0 if the int value is valid, -1 otherwise
|
||||
**
|
||||
**************************************************************************/
|
||||
int bbf_validate_int(char *value, struct range_args r_args[], int r_args_size);
|
||||
int bbfdm_validate_int(struct dmctx *ctx, char *value, struct range_args r_args[], int r_args_size);
|
||||
|
||||
/*********************************************************************//**
|
||||
**
|
||||
** bbf_validate_unsignedLong
|
||||
** bbfdm_validate_unsignedLong
|
||||
**
|
||||
** This API is to validate a unsigned long value
|
||||
**
|
||||
|
|
@ -595,11 +596,11 @@ int bbf_validate_int(char *value, struct range_args r_args[], int r_args_size);
|
|||
** \return 0 if the unsigned long value is valid, -1 otherwise
|
||||
**
|
||||
**************************************************************************/
|
||||
int bbf_validate_unsignedLong(char *value, struct range_args r_args[], int r_args_size);
|
||||
int bbfdm_validate_unsignedLong(struct dmctx *ctx, char *value, struct range_args r_args[], int r_args_size);
|
||||
|
||||
/*********************************************************************//**
|
||||
**
|
||||
** bbf_validate_long
|
||||
** bbfdm_validate_long
|
||||
**
|
||||
** This API is to validate a long value
|
||||
**
|
||||
|
|
@ -610,11 +611,11 @@ int bbf_validate_unsignedLong(char *value, struct range_args r_args[], int r_arg
|
|||
** \return 0 if the long value is valid, -1 otherwise
|
||||
**
|
||||
**************************************************************************/
|
||||
int bbf_validate_long(char *value, struct range_args r_args[], int r_args_size);
|
||||
int bbfdm_validate_long(struct dmctx *ctx, char *value, struct range_args r_args[], int r_args_size);
|
||||
|
||||
/*********************************************************************//**
|
||||
**
|
||||
** bbf_validate_dateTime
|
||||
** bbfdm_validate_dateTime
|
||||
**
|
||||
** This API is to validate a date time value
|
||||
**
|
||||
|
|
@ -623,11 +624,11 @@ int bbf_validate_long(char *value, struct range_args r_args[], int r_args_size);
|
|||
** \return 0 if the date time value is valid, -1 otherwise
|
||||
**
|
||||
**************************************************************************/
|
||||
int bbf_validate_dateTime(char *value);
|
||||
int bbfdm_validate_dateTime(struct dmctx *ctx, char *value);
|
||||
|
||||
/*********************************************************************//**
|
||||
**
|
||||
** bbf_validate_hexBinary
|
||||
** bbfdm_validate_hexBinary
|
||||
**
|
||||
** This API is to validate a hexbinary value
|
||||
**
|
||||
|
|
@ -638,11 +639,11 @@ int bbf_validate_dateTime(char *value);
|
|||
** \return 0 if the hexbinary value is valid, -1 otherwise
|
||||
**
|
||||
**************************************************************************/
|
||||
int bbf_validate_hexBinary(char *value, struct range_args r_args[], int r_args_size);
|
||||
int bbfdm_validate_hexBinary(struct dmctx *ctx, char *value, struct range_args r_args[], int r_args_size);
|
||||
|
||||
/*********************************************************************//**
|
||||
**
|
||||
** bbf_validate_string_list
|
||||
** bbfdm_validate_string_list
|
||||
**
|
||||
** This API is to validate a list of string value
|
||||
**
|
||||
|
|
@ -658,11 +659,11 @@ int bbf_validate_hexBinary(char *value, struct range_args r_args[], int r_args_s
|
|||
** \return 0 if the list of string value is valid, -1 otherwise
|
||||
**
|
||||
**************************************************************************/
|
||||
int bbf_validate_string_list(char *value, int min_item, int max_item, int max_size, int min, int max, char *enumeration[], char *pattern[]);
|
||||
int bbfdm_validate_string_list(struct dmctx *ctx, char *value, int min_item, int max_item, int max_size, int min, int max, char *enumeration[], char *pattern[]);
|
||||
|
||||
/*********************************************************************//**
|
||||
**
|
||||
** bbf_validate_unsignedInt_list
|
||||
** bbfdm_validate_unsignedInt_list
|
||||
**
|
||||
** This API is to validate a list of unsigned int value
|
||||
**
|
||||
|
|
@ -676,11 +677,11 @@ int bbf_validate_string_list(char *value, int min_item, int max_item, int max_si
|
|||
** \return 0 if the list of unsigned int value is valid, -1 otherwise
|
||||
**
|
||||
**************************************************************************/
|
||||
int bbf_validate_unsignedInt_list(char *value, int min_item, int max_item, int max_size, struct range_args r_args[], int r_args_size);
|
||||
int bbfdm_validate_unsignedInt_list(struct dmctx *ctx, char *value, int min_item, int max_item, int max_size, struct range_args r_args[], int r_args_size);
|
||||
|
||||
/*********************************************************************//**
|
||||
**
|
||||
** bbf_validate_int_list
|
||||
** bbfdm_validate_int_list
|
||||
**
|
||||
** This API is to validate a list of int value
|
||||
**
|
||||
|
|
@ -694,11 +695,11 @@ int bbf_validate_unsignedInt_list(char *value, int min_item, int max_item, int m
|
|||
** \return 0 if the list of int value is valid, -1 otherwise
|
||||
**
|
||||
**************************************************************************/
|
||||
int bbf_validate_int_list(char *value, int min_item, int max_item, int max_size, struct range_args r_args[], int r_args_size);
|
||||
int bbfdm_validate_int_list(struct dmctx *ctx, char *value, int min_item, int max_item, int max_size, struct range_args r_args[], int r_args_size);
|
||||
|
||||
/*********************************************************************//**
|
||||
**
|
||||
** bbf_validate_unsignedLong_list
|
||||
** bbfdm_validate_unsignedLong_list
|
||||
**
|
||||
** This API is to validate a list of unsigned long value
|
||||
**
|
||||
|
|
@ -712,11 +713,11 @@ int bbf_validate_int_list(char *value, int min_item, int max_item, int max_size,
|
|||
** \return 0 if the list of unsigned long value is valid, -1 otherwise
|
||||
**
|
||||
**************************************************************************/
|
||||
int bbf_validate_unsignedLong_list(char *value, int min_item, int max_item, int max_size, struct range_args r_args[], int r_args_size);
|
||||
int bbfdm_validate_unsignedLong_list(struct dmctx *ctx, char *value, int min_item, int max_item, int max_size, struct range_args r_args[], int r_args_size);
|
||||
|
||||
/*********************************************************************//**
|
||||
**
|
||||
** bbf_validate_long_list
|
||||
** bbfdm_validate_long_list
|
||||
**
|
||||
** This API is to validate a list of long value
|
||||
**
|
||||
|
|
@ -730,11 +731,11 @@ int bbf_validate_unsignedLong_list(char *value, int min_item, int max_item, int
|
|||
** \return 0 if the list of long value is valid, -1 otherwise
|
||||
**
|
||||
**************************************************************************/
|
||||
int bbf_validate_long_list(char *value, int min_item, int max_item, int max_size, struct range_args r_args[], int r_args_size);
|
||||
int bbfdm_validate_long_list(struct dmctx *ctx, char *value, int min_item, int max_item, int max_size, struct range_args r_args[], int r_args_size);
|
||||
|
||||
/*********************************************************************//**
|
||||
**
|
||||
** bbf_validate_hexBinary_list
|
||||
** bbfdm_validate_hexBinary_list
|
||||
**
|
||||
** This API is to validate a list of hexBinary value
|
||||
**
|
||||
|
|
@ -748,6 +749,28 @@ int bbf_validate_long_list(char *value, int min_item, int max_item, int max_size
|
|||
** \return 0 if the list of hexBinary value is valid, -1 otherwise
|
||||
**
|
||||
**************************************************************************/
|
||||
int bbf_validate_hexBinary_list(char *value, int min_item, int max_item, int max_size, struct range_args r_args[], int r_args_size);
|
||||
int bbfdm_validate_hexBinary_list(struct dmctx *ctx, char *value, int min_item, int max_item, int max_size, struct range_args r_args[], int r_args_size);
|
||||
|
||||
|
||||
/**********************
|
||||
*
|
||||
* BBF DEPRECATED APIs
|
||||
*
|
||||
**********************/
|
||||
|
||||
__attribute__ ((deprecated)) int bbf_validate_string(char *value, int min_length, int max_length, char *enumeration[], char *pattern[]);
|
||||
__attribute__ ((deprecated)) int bbf_validate_boolean(char *value);
|
||||
__attribute__ ((deprecated)) int bbf_validate_unsignedInt(char *value, struct range_args r_args[], int r_args_size);
|
||||
__attribute__ ((deprecated)) int bbf_validate_int(char *value, struct range_args r_args[], int r_args_size);
|
||||
__attribute__ ((deprecated)) int bbf_validate_unsignedLong(char *value, struct range_args r_args[], int r_args_size);
|
||||
__attribute__ ((deprecated)) int bbf_validate_long(char *value, struct range_args r_args[], int r_args_size);
|
||||
__attribute__ ((deprecated)) int bbf_validate_dateTime(char *value);
|
||||
__attribute__ ((deprecated)) int bbf_validate_hexBinary(char *value, struct range_args r_args[], int r_args_size);
|
||||
__attribute__ ((deprecated)) int bbf_validate_string_list(char *value, int min_item, int max_item, int max_size, int min, int max, char *enumeration[], char *pattern[]);
|
||||
__attribute__ ((deprecated)) int bbf_validate_unsignedInt_list(char *value, int min_item, int max_item, int max_size, struct range_args r_args[], int r_args_size);
|
||||
__attribute__ ((deprecated)) int bbf_validate_int_list(char *value, int min_item, int max_item, int max_size, struct range_args r_args[], int r_args_size);
|
||||
__attribute__ ((deprecated)) int bbf_validate_unsignedLong_list(char *value, int min_item, int max_item, int max_size, struct range_args r_args[], int r_args_size);
|
||||
__attribute__ ((deprecated)) int bbf_validate_long_list(char *value, int min_item, int max_item, int max_size, struct range_args r_args[], int r_args_size);
|
||||
__attribute__ ((deprecated)) int bbf_validate_hexBinary_list(char *value, int min_item, int max_item, int max_size, struct range_args r_args[], int r_args_size);
|
||||
|
||||
#endif //__LIBBBFDM_API_H__
|
||||
|
|
|
|||
|
|
@ -1148,7 +1148,7 @@ static int fill_string_arguments(struct json_object *json_obj, int *min_length,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int dm_validate_value(json_object *json_obj, char *value)
|
||||
static int dm_validate_value(struct dmctx *ctx, json_object *json_obj, char *value)
|
||||
{
|
||||
struct json_object *type_obj = NULL;
|
||||
|
||||
|
|
@ -1164,10 +1164,10 @@ static int dm_validate_value(json_object *json_obj, char *value)
|
|||
return -1;
|
||||
|
||||
if (strcmp(type, "boolean") == 0) {
|
||||
if (dm_validate_boolean(value))
|
||||
if (bbfdm_validate_boolean(ctx, value))
|
||||
return FAULT_9007;
|
||||
} else if (strcmp(type, "dateTime") == 0) {
|
||||
if (dm_validate_dateTime(value))
|
||||
if (bbfdm_validate_dateTime(ctx, value))
|
||||
return FAULT_9007;
|
||||
} else if (strcmp(type, "unsignedInt") == 0 || strcmp(type, "unsignedLong") == 0 ||
|
||||
strcmp(type, "hexBinary") == 0 || strcmp(type, "int") == 0 || strcmp(type, "long") == 0) {
|
||||
|
|
@ -1184,11 +1184,11 @@ static int dm_validate_value(json_object *json_obj, char *value)
|
|||
return -1;
|
||||
}
|
||||
|
||||
if ((strcmp(type, "unsignedInt") == 0 && dm_validate_unsignedInt(value, range_arg, range_len)) ||
|
||||
(strcmp(type, "unsignedLong") == 0 && dm_validate_unsignedLong(value, range_arg, range_len)) ||
|
||||
(strcmp(type, "hexBinary") == 0 && dm_validate_hexBinary(value, range_arg, range_len)) ||
|
||||
(strcmp(type, "int") == 0 && dm_validate_int(value, range_arg, range_len)) ||
|
||||
(strcmp(type, "long") == 0 && dm_validate_long(value, range_arg, range_len)))
|
||||
if ((strcmp(type, "unsignedInt") == 0 && bbfdm_validate_unsignedInt(ctx, value, range_arg, range_len)) ||
|
||||
(strcmp(type, "unsignedLong") == 0 && bbfdm_validate_unsignedLong(ctx, value, range_arg, range_len)) ||
|
||||
(strcmp(type, "hexBinary") == 0 && bbfdm_validate_hexBinary(ctx, value, range_arg, range_len)) ||
|
||||
(strcmp(type, "int") == 0 && bbfdm_validate_int(ctx, value, range_arg, range_len)) ||
|
||||
(strcmp(type, "long") == 0 && bbfdm_validate_long(ctx, value, range_arg, range_len)))
|
||||
return FAULT_9007;
|
||||
} else if (strcmp(type, "string") == 0) {
|
||||
struct json_object *list_obj = NULL;
|
||||
|
|
@ -1247,24 +1247,24 @@ static int dm_validate_value(json_object *json_obj, char *value)
|
|||
return -1;
|
||||
}
|
||||
|
||||
if ((strcmp(datatype, "unsignedInt") == 0 && dm_validate_unsignedInt_list(value, min_item, max_item, max_size, range_arg, range_len)) ||
|
||||
(strcmp(datatype, "unsignedLong") == 0 && dm_validate_unsignedLong_list(value, min_item, max_item, max_size, range_arg, range_len)) ||
|
||||
(strcmp(datatype, "hexBinary") == 0 && dm_validate_hexBinary_list(value, min_item, max_item, max_size, range_arg, range_len)) ||
|
||||
(strcmp(datatype, "int") == 0 && dm_validate_int_list(value, min_item, max_item, max_size, range_arg, range_len)) ||
|
||||
(strcmp(datatype, "long") == 0 && dm_validate_long_list(value, min_item, max_item, max_size, range_arg, range_len)))
|
||||
if ((strcmp(datatype, "unsignedInt") == 0 && bbfdm_validate_unsignedInt_list(ctx, value, min_item, max_item, max_size, range_arg, range_len)) ||
|
||||
(strcmp(datatype, "unsignedLong") == 0 && bbfdm_validate_unsignedLong_list(ctx, value, min_item, max_item, max_size, range_arg, range_len)) ||
|
||||
(strcmp(datatype, "hexBinary") == 0 && bbfdm_validate_hexBinary_list(ctx, value, min_item, max_item, max_size, range_arg, range_len)) ||
|
||||
(strcmp(datatype, "int") == 0 && bbfdm_validate_int_list(ctx, value, min_item, max_item, max_size, range_arg, range_len)) ||
|
||||
(strcmp(datatype, "long") == 0 && bbfdm_validate_long_list(ctx, value, min_item, max_item, max_size, range_arg, range_len)))
|
||||
return FAULT_9007;
|
||||
} else if (strcmp(datatype, "string") == 0) {
|
||||
if (fill_string_arguments(list_obj, &min_length, &max_length, enum_tab, pattern_tab))
|
||||
return -1;
|
||||
|
||||
if (dm_validate_string_list(value, min_item, max_item, max_size, min_length, max_length, *enum_tab ? enum_tab : NULL, *pattern_tab ? pattern_tab : NULL))
|
||||
if (bbfdm_validate_string_list(ctx, value, min_item, max_item, max_size, min_length, max_length, *enum_tab ? enum_tab : NULL, *pattern_tab ? pattern_tab : NULL))
|
||||
return FAULT_9007;
|
||||
}
|
||||
} else {
|
||||
if (fill_string_arguments(json_obj, &min_length, &max_length, enum_tab, pattern_tab))
|
||||
return -1;
|
||||
|
||||
if (dm_validate_string(value, min_length, max_length, *enum_tab ? enum_tab : NULL, *pattern_tab ? pattern_tab : NULL))
|
||||
if (bbfdm_validate_string(ctx, value, min_length, max_length, *enum_tab ? enum_tab : NULL, *pattern_tab ? pattern_tab : NULL))
|
||||
return FAULT_9007;
|
||||
}
|
||||
} else {
|
||||
|
|
@ -1507,7 +1507,7 @@ static int setvalue_param(char *refparam, struct dmctx *ctx, void *data, char *i
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_value(param_obj, value))
|
||||
if (dm_validate_value(ctx, param_obj, value))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ static int set_ip_ping_diagnostics_state(char *refparam, struct dmctx *ctx, void
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, -1, DiagnosticsState, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, -1, DiagnosticsState, NULL))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -72,7 +72,7 @@ static int set_ip_ping_interface(char *refparam, struct dmctx *ctx, void *data,
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 256, NULL, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 256, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
|
||||
if (dm_entry_validate_allowed_objects(ctx, value, allowed_objects))
|
||||
|
|
@ -97,7 +97,7 @@ static int set_ip_ping_protocolversion(char *refparam, struct dmctx *ctx, void *
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, -1, ProtocolVersion, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, -1, ProtocolVersion, NULL))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -118,7 +118,7 @@ static int set_ip_ping_host(char *refparam, struct dmctx *ctx, void *data, char
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 256, NULL, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 256, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -139,7 +139,7 @@ static int set_ip_ping_repetition_number(char *refparam, struct dmctx *ctx, void
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_unsignedInt(value, RANGE_ARGS{{"1",NULL}}, 1))
|
||||
if (bbfdm_validate_unsignedInt(ctx, value, RANGE_ARGS{{"1",NULL}}, 1))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -160,7 +160,7 @@ static int set_ip_ping_timeout(char *refparam, struct dmctx *ctx, void *data, ch
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_unsignedInt(value, RANGE_ARGS{{"1",NULL}}, 1))
|
||||
if (bbfdm_validate_unsignedInt(ctx, value, RANGE_ARGS{{"1",NULL}}, 1))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -181,7 +181,7 @@ static int set_ip_ping_block_size(char *refparam, struct dmctx *ctx, void *data,
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_unsignedInt(value, RANGE_ARGS{{"1","65535"}}, 1))
|
||||
if (bbfdm_validate_unsignedInt(ctx, value, RANGE_ARGS{{"1","65535"}}, 1))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -202,7 +202,7 @@ static int set_ip_ping_DSCP(char *refparam, struct dmctx *ctx, void *data, char
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_unsignedInt(value, RANGE_ARGS{{"0","63"}}, 1))
|
||||
if (bbfdm_validate_unsignedInt(ctx, value, RANGE_ARGS{{"0","63"}}, 1))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -281,7 +281,7 @@ static int set_IPDiagnosticsTraceRoute_DiagnosticsState(char *refparam, struct d
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, -1, DiagnosticsState, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, -1, DiagnosticsState, NULL))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -305,7 +305,7 @@ static int set_IPDiagnosticsTraceRoute_Interface(char *refparam, struct dmctx *c
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 256, NULL, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 256, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
|
||||
if (dm_entry_validate_allowed_objects(ctx, value, allowed_objects))
|
||||
|
|
@ -330,7 +330,7 @@ static int set_IPDiagnosticsTraceRoute_ProtocolVersion(char *refparam, struct dm
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, -1, ProtocolVersion, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, -1, ProtocolVersion, NULL))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -351,7 +351,7 @@ static int set_IPDiagnosticsTraceRoute_Host(char *refparam, struct dmctx *ctx, v
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 256, NULL, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 256, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -372,7 +372,7 @@ static int set_IPDiagnosticsTraceRoute_NumberOfTries(char *refparam, struct dmct
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_unsignedInt(value, RANGE_ARGS{{"1","3"}}, 1))
|
||||
if (bbfdm_validate_unsignedInt(ctx, value, RANGE_ARGS{{"1","3"}}, 1))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -393,7 +393,7 @@ static int set_IPDiagnosticsTraceRoute_Timeout(char *refparam, struct dmctx *ctx
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_unsignedInt(value, RANGE_ARGS{{"1",NULL}}, 1))
|
||||
if (bbfdm_validate_unsignedInt(ctx, value, RANGE_ARGS{{"1",NULL}}, 1))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -414,7 +414,7 @@ static int set_IPDiagnosticsTraceRoute_DataBlockSize(char *refparam, struct dmct
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_unsignedInt(value, RANGE_ARGS{{"1","65535"}}, 1))
|
||||
if (bbfdm_validate_unsignedInt(ctx, value, RANGE_ARGS{{"1","65535"}}, 1))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -435,7 +435,7 @@ static int set_IPDiagnosticsTraceRoute_DSCP(char *refparam, struct dmctx *ctx, v
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_unsignedInt(value, RANGE_ARGS{{"0","63"}}, 1))
|
||||
if (bbfdm_validate_unsignedInt(ctx, value, RANGE_ARGS{{"0","63"}}, 1))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -456,7 +456,7 @@ static int set_IPDiagnosticsTraceRoute_MaxHopCount(char *refparam, struct dmctx
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_unsignedInt(value, RANGE_ARGS{{"1","64"}}, 1))
|
||||
if (bbfdm_validate_unsignedInt(ctx, value, RANGE_ARGS{{"1","64"}}, 1))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -523,7 +523,7 @@ static int set_IPDiagnosticsDownloadDiagnostics_DiagnosticsState(char *refparam,
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, -1, DiagnosticsState, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, -1, DiagnosticsState, NULL))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -547,7 +547,7 @@ static int set_IPDiagnosticsDownloadDiagnostics_Interface(char *refparam, struct
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 256, NULL, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 256, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
|
||||
if (dm_entry_validate_allowed_objects(ctx, value, allowed_objects))
|
||||
|
|
@ -572,7 +572,7 @@ static int set_IPDiagnosticsDownloadDiagnostics_DownloadURL(char *refparam, stru
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 256, NULL, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 256, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -605,7 +605,7 @@ static int set_IPDiagnosticsDownloadDiagnostics_DSCP(char *refparam, struct dmct
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_unsignedInt(value, RANGE_ARGS{{"0","63"}}, 1))
|
||||
if (bbfdm_validate_unsignedInt(ctx, value, RANGE_ARGS{{"0","63"}}, 1))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -626,7 +626,7 @@ static int set_IPDiagnosticsDownloadDiagnostics_EthernetPriority(char *refparam,
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_unsignedInt(value, RANGE_ARGS{{"0","7"}}, 1))
|
||||
if (bbfdm_validate_unsignedInt(ctx, value, RANGE_ARGS{{"0","7"}}, 1))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -647,7 +647,7 @@ static int set_IPDiagnosticsDownloadDiagnostics_ProtocolVersion(char *refparam,
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, -1, ProtocolVersion, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, -1, ProtocolVersion, NULL))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -668,7 +668,7 @@ static int set_IPDiagnosticsDownloadDiagnostics_NumberOfConnections(char *refpar
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_unsignedInt(value, RANGE_ARGS{{"1",NULL}}, 1))
|
||||
if (bbfdm_validate_unsignedInt(ctx, value, RANGE_ARGS{{"1",NULL}}, 1))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -776,7 +776,7 @@ static int set_IPDiagnosticsDownloadDiagnostics_EnablePerConnectionResults(char
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_boolean(value))
|
||||
if (bbfdm_validate_boolean(ctx, value))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -849,7 +849,7 @@ static int set_IPDiagnosticsUploadDiagnostics_DiagnosticsState(char *refparam, s
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, -1, DiagnosticsState, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, -1, DiagnosticsState, NULL))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -873,7 +873,7 @@ static int set_IPDiagnosticsUploadDiagnostics_Interface(char *refparam, struct d
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 256, NULL, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 256, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
|
||||
if (dm_entry_validate_allowed_objects(ctx, value, allowed_objects))
|
||||
|
|
@ -898,7 +898,7 @@ static int set_IPDiagnosticsUploadDiagnostics_UploadURL(char *refparam, struct d
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 256, NULL, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 256, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -925,7 +925,7 @@ static int set_IPDiagnosticsUploadDiagnostics_DSCP(char *refparam, struct dmctx
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_unsignedInt(value, RANGE_ARGS{{"0","63"}}, 1))
|
||||
if (bbfdm_validate_unsignedInt(ctx, value, RANGE_ARGS{{"0","63"}}, 1))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -946,7 +946,7 @@ static int set_IPDiagnosticsUploadDiagnostics_EthernetPriority(char *refparam, s
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_unsignedInt(value, RANGE_ARGS{{"0","7"}}, 1))
|
||||
if (bbfdm_validate_unsignedInt(ctx, value, RANGE_ARGS{{"0","7"}}, 1))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -967,7 +967,7 @@ static int set_IPDiagnosticsUploadDiagnostics_TestFileLength(char *refparam, str
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_unsignedInt(value, RANGE_ARGS{{NULL,NULL}}, 1))
|
||||
if (bbfdm_validate_unsignedInt(ctx, value, RANGE_ARGS{{NULL,NULL}}, 1))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -988,7 +988,7 @@ static int set_IPDiagnosticsUploadDiagnostics_ProtocolVersion(char *refparam, st
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, -1, ProtocolVersion, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, -1, ProtocolVersion, NULL))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -1009,7 +1009,7 @@ static int set_IPDiagnosticsUploadDiagnostics_NumberOfConnections(char *refparam
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_unsignedInt(value, RANGE_ARGS{{"1",NULL}}, 1))
|
||||
if (bbfdm_validate_unsignedInt(ctx, value, RANGE_ARGS{{"1",NULL}}, 1))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -1117,7 +1117,7 @@ static int set_IPDiagnosticsUploadDiagnostics_EnablePerConnectionResults(char *r
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_boolean(value))
|
||||
if (bbfdm_validate_boolean(ctx, value))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -1191,7 +1191,7 @@ static int set_IPDiagnosticsUDPEchoDiagnostics_DiagnosticsState(char *refparam,
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, -1, DiagnosticsState, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, -1, DiagnosticsState, NULL))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -1215,7 +1215,7 @@ static int set_IPDiagnosticsUDPEchoDiagnostics_Interface(char *refparam, struct
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 256, NULL, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 256, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
|
||||
if (dm_entry_validate_allowed_objects(ctx, value, allowed_objects))
|
||||
|
|
@ -1240,7 +1240,7 @@ static int set_IPDiagnosticsUDPEchoDiagnostics_Host(char *refparam, struct dmctx
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 256, NULL, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 256, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -1261,7 +1261,7 @@ static int set_IPDiagnosticsUDPEchoDiagnostics_Port(char *refparam, struct dmctx
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_unsignedInt(value, RANGE_ARGS{{"1","65535"}}, 1))
|
||||
if (bbfdm_validate_unsignedInt(ctx, value, RANGE_ARGS{{"1","65535"}}, 1))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -1282,7 +1282,7 @@ static int set_IPDiagnosticsUDPEchoDiagnostics_NumberOfRepetitions(char *refpara
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_unsignedInt(value, RANGE_ARGS{{"1",NULL}}, 1))
|
||||
if (bbfdm_validate_unsignedInt(ctx, value, RANGE_ARGS{{"1",NULL}}, 1))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -1303,7 +1303,7 @@ static int set_IPDiagnosticsUDPEchoDiagnostics_Timeout(char *refparam, struct dm
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_unsignedInt(value, RANGE_ARGS{{"1",NULL}}, 1))
|
||||
if (bbfdm_validate_unsignedInt(ctx, value, RANGE_ARGS{{"1",NULL}}, 1))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -1324,7 +1324,7 @@ static int set_IPDiagnosticsUDPEchoDiagnostics_DataBlockSize(char *refparam, str
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_unsignedInt(value, RANGE_ARGS{{"1","65535"}}, 1))
|
||||
if (bbfdm_validate_unsignedInt(ctx, value, RANGE_ARGS{{"1","65535"}}, 1))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -1345,7 +1345,7 @@ static int set_IPDiagnosticsUDPEchoDiagnostics_DSCP(char *refparam, struct dmctx
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_unsignedInt(value, RANGE_ARGS{{"0","63"}}, 1))
|
||||
if (bbfdm_validate_unsignedInt(ctx, value, RANGE_ARGS{{"0","63"}}, 1))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -1366,7 +1366,7 @@ static int set_IPDiagnosticsUDPEchoDiagnostics_InterTransmissionTime(char *refpa
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_unsignedInt(value, RANGE_ARGS{{"1","65535"}}, 1))
|
||||
if (bbfdm_validate_unsignedInt(ctx, value, RANGE_ARGS{{"1","65535"}}, 1))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -1387,7 +1387,7 @@ static int set_IPDiagnosticsUDPEchoDiagnostics_ProtocolVersion(char *refparam, s
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, -1, ProtocolVersion, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, -1, ProtocolVersion, NULL))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -1448,7 +1448,7 @@ static int set_IPDiagnosticsServerSelectionDiagnostics_DiagnosticsState(char *re
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, -1, DiagnosticsState, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, -1, DiagnosticsState, NULL))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -1472,7 +1472,7 @@ static int set_IPDiagnosticsServerSelectionDiagnostics_Interface(char *refparam,
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 256, NULL, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 256, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
|
||||
if (dm_entry_validate_allowed_objects(ctx, value, allowed_objects))
|
||||
|
|
@ -1497,7 +1497,7 @@ static int set_IPDiagnosticsServerSelectionDiagnostics_ProtocolVersion(char *ref
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, -1, ProtocolVersion, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, -1, ProtocolVersion, NULL))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -1518,7 +1518,7 @@ static int set_IPDiagnosticsServerSelectionDiagnostics_Protocol(char *refparam,
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, -1, ServerSelectionProtocol, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, -1, ServerSelectionProtocol, NULL))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -1539,7 +1539,7 @@ static int set_IPDiagnosticsServerSelectionDiagnostics_HostList(char *refparam,
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string_list(value, -1, 10, -1, -1, 256, NULL, NULL))
|
||||
if (bbfdm_validate_string_list(ctx, value, -1, 10, -1, -1, 256, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -1560,7 +1560,7 @@ static int set_IPDiagnosticsServerSelectionDiagnostics_NumberOfRepetitions(char
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_unsignedInt(value, RANGE_ARGS{{"1",NULL}}, 1))
|
||||
if (bbfdm_validate_unsignedInt(ctx, value, RANGE_ARGS{{"1",NULL}}, 1))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -1581,7 +1581,7 @@ static int set_IPDiagnosticsServerSelectionDiagnostics_Timeout(char *refparam, s
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_unsignedInt(value, RANGE_ARGS{{"1",NULL}}, 1))
|
||||
if (bbfdm_validate_unsignedInt(ctx, value, RANGE_ARGS{{"1",NULL}}, 1))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -1704,8 +1704,11 @@ static int operate_IPDiagnostics_IPPing(char *refparam, struct dmctx *ctx, void
|
|||
json_object *res = NULL;
|
||||
|
||||
char *ipping_host = dmjson_get_value((json_object *)value, 1, "Host");
|
||||
if (ipping_host[0] == '\0')
|
||||
if (ipping_host[0] == '\0') {
|
||||
bbfdm_set_fault_message(ctx, "IPPing: 'Host' input should be defined");
|
||||
return USP_FAULT_INVALID_ARGUMENT;
|
||||
}
|
||||
|
||||
char *ip_interface = dmjson_get_value((json_object *)value, 1, "Interface");
|
||||
char *ipping_interface = get_diagnostics_interface_option(ctx, ip_interface);
|
||||
char *ipping_proto = dmjson_get_value((json_object *)value, 1, "ProtocolVersion");
|
||||
|
|
@ -1728,8 +1731,10 @@ static int operate_IPDiagnostics_IPPing(char *refparam, struct dmctx *ctx, void
|
|||
},
|
||||
8, &res);
|
||||
|
||||
if (res == NULL)
|
||||
if (res == NULL) {
|
||||
bbfdm_set_fault_message(ctx, "IPPing: ubus 'bbf.diag ipping' method doesn't exist");
|
||||
return USP_FAULT_COMMAND_FAILURE;
|
||||
}
|
||||
|
||||
char *ipping_status = dmjson_get_value(res, 1, "Status");
|
||||
char *ipping_ip_address_used = dmjson_get_value(res, 1, "IPAddressUsed");
|
||||
|
|
@ -1802,8 +1807,10 @@ static int operate_IPDiagnostics_TraceRoute(char *refparam, struct dmctx *ctx, v
|
|||
int idx = 0;
|
||||
|
||||
char *host = dmjson_get_value((json_object *)value, 1, "Host");
|
||||
if (host[0] == '\0')
|
||||
if (host[0] == '\0') {
|
||||
bbfdm_set_fault_message(ctx, "TraceRoute: 'Host' input should be defined");
|
||||
return USP_FAULT_INVALID_ARGUMENT;
|
||||
}
|
||||
|
||||
char *ip_interface = dmjson_get_value((json_object *)value, 1, "Interface");
|
||||
char *interface = get_diagnostics_interface_option(ctx, ip_interface);
|
||||
|
|
@ -1832,13 +1839,16 @@ static int operate_IPDiagnostics_TraceRoute(char *refparam, struct dmctx *ctx, v
|
|||
fgets(output, sizeof(output) , pp);
|
||||
pclose(pp);
|
||||
} else {
|
||||
bbfdm_set_fault_message(ctx, "TraceRoute: 'sh %s {input}' command failed to run", TRACEROUTE_DIAGNOSTIC_PATH);
|
||||
return USP_FAULT_COMMAND_FAILURE;
|
||||
}
|
||||
|
||||
json_object *res = (DM_STRLEN(output)) ? json_tokener_parse(output) : NULL;
|
||||
|
||||
if (res == NULL)
|
||||
if (res == NULL) {
|
||||
bbfdm_set_fault_message(ctx, "TraceRoute: there is no output from '%s' script", TRACEROUTE_DIAGNOSTIC_PATH);
|
||||
return USP_FAULT_COMMAND_FAILURE;
|
||||
}
|
||||
|
||||
char *status = dmjson_get_value(res, 1, "Status");
|
||||
char *ip_address_used = dmjson_get_value(res, 1, "IPAddressUsed");
|
||||
|
|
@ -1930,13 +1940,17 @@ static int operate_IPDiagnostics_DownloadDiagnostics(char *refparam, struct dmct
|
|||
char cmd[2096] = {0};
|
||||
char *download_url = dmjson_get_value((json_object *)value, 1, "DownloadURL");
|
||||
|
||||
if (download_url[0] == '\0')
|
||||
if (download_url[0] == '\0') {
|
||||
bbfdm_set_fault_message(ctx, "DownloadDiagnostics: 'DownloadURL' input should be defined");
|
||||
return USP_FAULT_INVALID_ARGUMENT;
|
||||
}
|
||||
|
||||
if (strncmp(download_url, HTTP_URI, strlen(HTTP_URI)) != 0 &&
|
||||
strncmp(download_url, FTP_URI, strlen(FTP_URI)) != 0 &&
|
||||
strchr(download_url,'@') != NULL)
|
||||
strchr(download_url,'@') != NULL) {
|
||||
bbfdm_set_fault_message(ctx, "DownloadDiagnostics: '%s' DownloadURL is not a correct url value", download_url);
|
||||
return USP_FAULT_INVALID_ARGUMENT;
|
||||
}
|
||||
|
||||
char *ip_interface = dmjson_get_value((json_object *)value, 1, "Interface");
|
||||
char *download_interface = get_diagnostics_interface_option(ctx, ip_interface);
|
||||
|
|
@ -1963,13 +1977,16 @@ static int operate_IPDiagnostics_DownloadDiagnostics(char *refparam, struct dmct
|
|||
fgets(output, sizeof(output) , pp);
|
||||
pclose(pp);
|
||||
} else {
|
||||
bbfdm_set_fault_message(ctx, "DownloadDiagnostics: 'sh %s {input}' command failed to run", DOWNLOAD_DIAGNOSTIC_PATH);
|
||||
return USP_FAULT_COMMAND_FAILURE;
|
||||
}
|
||||
|
||||
json_object *res = (DM_STRLEN(output)) ? json_tokener_parse(output) : NULL;
|
||||
|
||||
if (res == NULL)
|
||||
if (res == NULL) {
|
||||
bbfdm_set_fault_message(ctx, "DownloadDiagnostics: there is no output from '%s' script", DOWNLOAD_DIAGNOSTIC_PATH);
|
||||
return USP_FAULT_COMMAND_FAILURE;
|
||||
}
|
||||
|
||||
char *status = dmjson_get_value(res, 1, "Status");
|
||||
char *ip_address_used = dmjson_get_value(res, 1, "IPAddressUsed");
|
||||
|
|
@ -2064,8 +2081,10 @@ static int operate_IPDiagnostics_UploadDiagnostics(char *refparam, struct dmctx
|
|||
char cmd[2096] = {0};
|
||||
char *upload_url = dmjson_get_value((json_object *)value, 1, "UploadURL");
|
||||
|
||||
if (upload_url[0] == '\0')
|
||||
if (upload_url[0] == '\0') {
|
||||
bbfdm_set_fault_message(ctx, "UploadDiagnostics: 'UploadURL' input should be defined");
|
||||
return USP_FAULT_INVALID_ARGUMENT;
|
||||
}
|
||||
|
||||
if (strncmp(upload_url, HTTP_URI, strlen(HTTP_URI)) != 0 &&
|
||||
strncmp(upload_url, FTP_URI, strlen(FTP_URI)) != 0 &&
|
||||
|
|
@ -2073,8 +2092,10 @@ static int operate_IPDiagnostics_UploadDiagnostics(char *refparam, struct dmctx
|
|||
return USP_FAULT_INVALID_ARGUMENT;
|
||||
|
||||
char *upload_test_file_length = dmjson_get_value((json_object *)value, 1, "TestFileLength");
|
||||
if (upload_test_file_length[0] == '\0')
|
||||
if (upload_test_file_length[0] == '\0') {
|
||||
bbfdm_set_fault_message(ctx, "UploadDiagnostics: 'TestFileLength' input should be defined");
|
||||
return USP_FAULT_INVALID_ARGUMENT;
|
||||
}
|
||||
|
||||
char *ip_interface = dmjson_get_value((json_object *)value, 1, "Interface");
|
||||
char *upload_interface = get_diagnostics_interface_option(ctx, ip_interface);
|
||||
|
|
@ -2102,13 +2123,16 @@ static int operate_IPDiagnostics_UploadDiagnostics(char *refparam, struct dmctx
|
|||
fgets(output, sizeof(output) , pp);
|
||||
pclose(pp);
|
||||
} else {
|
||||
bbfdm_set_fault_message(ctx, "UploadDiagnostics: 'sh %s {input}' command failed to run", UPLOAD_DIAGNOSTIC_PATH);
|
||||
return USP_FAULT_COMMAND_FAILURE;
|
||||
}
|
||||
|
||||
json_object *res = (DM_STRLEN(output)) ? json_tokener_parse(output) : NULL;
|
||||
|
||||
if (res == NULL)
|
||||
if (res == NULL) {
|
||||
bbfdm_set_fault_message(ctx, "UploadDiagnostics: there is no output from '%s' script", UPLOAD_DIAGNOSTIC_PATH);
|
||||
return USP_FAULT_COMMAND_FAILURE;
|
||||
}
|
||||
|
||||
char *upload_status = dmjson_get_value(res, 1, "Status");
|
||||
char *upload_ip_address_used = dmjson_get_value(res, 1, "IPAddressUsed");
|
||||
|
|
@ -2188,8 +2212,10 @@ static int operate_IPDiagnostics_UDPEchoDiagnostics(char *refparam, struct dmctx
|
|||
json_object *res = NULL;
|
||||
|
||||
char *udpecho_host = dmjson_get_value((json_object *)value, 1, "Host");
|
||||
if (udpecho_host[0] == '\0')
|
||||
if (udpecho_host[0] == '\0') {
|
||||
bbfdm_set_fault_message(ctx, "UDPEchoDiagnostics: 'Host' input should be defined");
|
||||
return USP_FAULT_INVALID_ARGUMENT;
|
||||
}
|
||||
|
||||
char *udpecho_port = dmjson_get_value((json_object *)value, 1, "Port");
|
||||
char *ip_interface = dmjson_get_value((json_object *)value, 1, "Interface");
|
||||
|
|
@ -2217,8 +2243,10 @@ static int operate_IPDiagnostics_UDPEchoDiagnostics(char *refparam, struct dmctx
|
|||
},
|
||||
10, &res);
|
||||
|
||||
if (res == NULL)
|
||||
if (res == NULL) {
|
||||
bbfdm_set_fault_message(ctx, "UDPEchoDiagnostics: ubus 'bbf.diag udpecho' method doesn't exist");
|
||||
return USP_FAULT_COMMAND_FAILURE;
|
||||
}
|
||||
|
||||
char *status = dmjson_get_value(res, 1, "Status");
|
||||
char *ip_address_used = dmjson_get_value(res, 1, "IPAddressUsed");
|
||||
|
|
@ -2274,8 +2302,10 @@ static int operate_IPDiagnostics_ServerSelectionDiagnostics(char *refparam, stru
|
|||
json_object *res = NULL;
|
||||
|
||||
char *hostlist = dmjson_get_value((json_object *)value, 1, "HostList");
|
||||
if (hostlist[0] == '\0')
|
||||
if (hostlist[0] == '\0') {
|
||||
bbfdm_set_fault_message(ctx, "ServerSelectionDiagnostics: 'HostList' input should be defined");
|
||||
return USP_FAULT_INVALID_ARGUMENT;
|
||||
}
|
||||
|
||||
char *port = dmjson_get_value((json_object *)value, 1, "Port");
|
||||
char *protocol_used = dmjson_get_value((json_object *)value, 1, "Protocol");
|
||||
|
|
@ -2299,8 +2329,10 @@ static int operate_IPDiagnostics_ServerSelectionDiagnostics(char *refparam, stru
|
|||
},
|
||||
8, &res);
|
||||
|
||||
if (res == NULL)
|
||||
if (res == NULL) {
|
||||
bbfdm_set_fault_message(ctx, "ServerSelectionDiagnostics: ubus 'bbf.diag serverselection' method doesn't exist");
|
||||
return USP_FAULT_COMMAND_FAILURE;
|
||||
}
|
||||
|
||||
char *status = dmjson_get_value(res, 1, "Status");
|
||||
char *fasthost = dmjson_get_value(res, 1, "FastestHost");
|
||||
|
|
|
|||
|
|
@ -174,7 +174,7 @@ static int set_atm_destination_address(char *refparam, struct dmctx *ctx, void *
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 256, NULL, DestinationAddress))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 256, NULL, DestinationAddress))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -212,7 +212,7 @@ static int set_atm_encapsulation(char *refparam, struct dmctx *ctx, void *data,
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, -1, Encapsulation, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, -1, Encapsulation, NULL))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -245,7 +245,7 @@ static int set_atm_link_type(char *refparam, struct dmctx *ctx, void *data, char
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, -1, LinkType, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, -1, LinkType, NULL))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -348,7 +348,7 @@ static int set_atm_enable(char *refparam, struct dmctx *ctx, void *data, char *i
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_boolean(value))
|
||||
if (bbfdm_validate_boolean(ctx, value))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -378,7 +378,7 @@ static int set_atm_alias(char *refparam, struct dmctx *ctx, void *data, char *in
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 64, NULL, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 64, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
|
|||
|
|
@ -1631,7 +1631,7 @@ static int set_BridgingBridge_Enable(char *refparam, struct dmctx *ctx, void *da
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_boolean(value))
|
||||
if (bbfdm_validate_boolean(ctx, value))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -1670,7 +1670,7 @@ static int set_BridgingBridge_Alias(char *refparam, struct dmctx *ctx, void *dat
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 64, NULL, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 64, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -1690,7 +1690,7 @@ static int set_BridgingBridge_Standard(char *refparam, struct dmctx *ctx, void *
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, -1, BridgeStandard, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, -1, BridgeStandard, NULL))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -1733,7 +1733,7 @@ static int set_BridgingBridgeSTP_Enable(char *refparam, struct dmctx *ctx, void
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_boolean(value))
|
||||
if (bbfdm_validate_boolean(ctx, value))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -1774,7 +1774,7 @@ static int set_BridgingBridgeSTP_Protocol(char *refparam, struct dmctx *ctx, voi
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, -1, Protocol, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, -1, Protocol, NULL))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -1793,7 +1793,7 @@ static int set_BridgingBridgeSTP_BridgePriority(char *refparam, struct dmctx *ct
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_unsignedInt(value, RANGE_ARGS{{"0","61440"}}, 1))
|
||||
if (bbfdm_validate_unsignedInt(ctx, value, RANGE_ARGS{{"0","61440"}}, 1))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -1820,7 +1820,7 @@ static int set_BridgingBridgeSTP_HelloTime(char *refparam, struct dmctx *ctx, vo
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_unsignedInt(value, RANGE_ARGS{{"100","1000"}}, 1))
|
||||
if (bbfdm_validate_unsignedInt(ctx, value, RANGE_ARGS{{"100","1000"}}, 1))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -1849,7 +1849,7 @@ static int set_BridgingBridgeSTP_MaxAge(char *refparam, struct dmctx *ctx, void
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_unsignedInt(value, RANGE_ARGS{{"600","4000"}}, 1))
|
||||
if (bbfdm_validate_unsignedInt(ctx, value, RANGE_ARGS{{"600","4000"}}, 1))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -1871,7 +1871,7 @@ static int set_BridgingBridgeSTP_ForwardingDelay(char *refparam, struct dmctx *c
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_unsignedInt(value, RANGE_ARGS{{"4","30"}}, 1))
|
||||
if (bbfdm_validate_unsignedInt(ctx, value, RANGE_ARGS{{"4","30"}}, 1))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -1897,7 +1897,7 @@ static int set_BridgingBridgePort_Enable(char *refparam, struct dmctx *ctx, void
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_boolean(value))
|
||||
if (bbfdm_validate_boolean(ctx, value))
|
||||
return FAULT_9007;
|
||||
|
||||
return 0;
|
||||
|
|
@ -1963,7 +1963,7 @@ static int set_BridgingBridgePort_Alias(char *refparam, struct dmctx *ctx, void
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 64, NULL, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 64, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -2061,7 +2061,7 @@ static int set_BridgingBridgePort_LowerLayers(char *refparam, struct dmctx *ctx,
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string_list(value, -1, -1, 1024, -1, -1, NULL, NULL))
|
||||
if (bbfdm_validate_string_list(ctx, value, -1, -1, 1024, -1, -1, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
|
||||
if (args->is_management_port)
|
||||
|
|
@ -2174,7 +2174,7 @@ static int set_BridgingBridgePort_ManagementPort(char *refparam, struct dmctx *c
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_boolean(value))
|
||||
if (bbfdm_validate_boolean(ctx, value))
|
||||
return FAULT_9007;
|
||||
|
||||
string_to_bool(value, &b);
|
||||
|
|
@ -2214,7 +2214,7 @@ static int set_BridgingBridgePort_PriorityRegeneration(char *refparam, struct dm
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_unsignedInt_list(value, 8, 8, -1, RANGE_ARGS{{"0","7"}}, 1))
|
||||
if (bbfdm_validate_unsignedInt_list(ctx, value, 8, 8, -1, RANGE_ARGS{{"0","7"}}, 1))
|
||||
return FAULT_9007;
|
||||
|
||||
if (args->is_management_port)
|
||||
|
|
@ -2249,7 +2249,7 @@ static int set_BridgingBridgePort_PVID(char *refparam, struct dmctx *ctx, void *
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_int(value, RANGE_ARGS{{"1","4094"}}, 1))
|
||||
if (bbfdm_validate_int(ctx, value, RANGE_ARGS{{"1","4094"}}, 1))
|
||||
return FAULT_9007;
|
||||
|
||||
if (args->is_management_port)
|
||||
|
|
@ -2320,7 +2320,7 @@ static int set_BridgingBridgePort_TPID(char *refparam, struct dmctx *ctx, void *
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_unsignedInt(value, RANGE_ARGS{{NULL,NULL}}, 1))
|
||||
if (bbfdm_validate_unsignedInt(ctx, value, RANGE_ARGS{{NULL,NULL}}, 1))
|
||||
return FAULT_9007;
|
||||
|
||||
return 0;
|
||||
|
|
@ -2465,7 +2465,7 @@ static int set_BridgingBridgeVLAN_Enable(char *refparam, struct dmctx *ctx, void
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_boolean(value))
|
||||
if (bbfdm_validate_boolean(ctx, value))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -2486,7 +2486,7 @@ static int set_BridgingBridgeVLAN_Alias(char *refparam, struct dmctx *ctx, void
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 64, NULL, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 64, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -2506,7 +2506,7 @@ static int set_BridgingBridgeVLAN_Name(char *refparam, struct dmctx *ctx, void *
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 64, NULL, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 64, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -2533,7 +2533,7 @@ static int set_BridgingBridgeVLAN_VLANID(char *refparam, struct dmctx *ctx, void
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_int(value, RANGE_ARGS{{"1","4094"}}, 1))
|
||||
if (bbfdm_validate_int(ctx, value, RANGE_ARGS{{"1","4094"}}, 1))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -2601,7 +2601,7 @@ static int set_BridgingBridgeVLANPort_Enable(char *refparam, struct dmctx *ctx,
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_boolean(value))
|
||||
if (bbfdm_validate_boolean(ctx, value))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -2624,7 +2624,7 @@ static int set_BridgingBridgeVLANPort_Alias(char *refparam, struct dmctx *ctx, v
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 64, NULL, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 64, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -2666,7 +2666,7 @@ static int set_BridgingBridgeVLANPort_VLAN(char *refparam, struct dmctx *ctx, vo
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 256, NULL, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 256, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
|
||||
if (dm_entry_validate_allowed_objects(ctx, value, allowed_objects))
|
||||
|
|
@ -2747,7 +2747,7 @@ static int set_BridgingBridgeVLANPort_Port(char *refparam, struct dmctx *ctx, vo
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 256, NULL, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 256, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
|
||||
if (dm_entry_validate_allowed_objects(ctx, value, allowed_objects))
|
||||
|
|
@ -2865,7 +2865,7 @@ static int set_BridgingBridgeVLANPort_Untagged(char *refparam, struct dmctx *ctx
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_boolean(value))
|
||||
if (bbfdm_validate_boolean(ctx, value))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -2888,7 +2888,7 @@ static int set_BridgingBridgeProviderBridge_Enable(char *refparam, struct dmctx
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_boolean(value))
|
||||
if (bbfdm_validate_boolean(ctx, value))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -2925,7 +2925,7 @@ static int set_BridgingBridgeProviderBridge_Alias(char *refparam, struct dmctx *
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 64, NULL, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 64, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -2951,7 +2951,7 @@ static int set_BridgingBridgeProviderBridge_SVLANcomponent(char *refparam, struc
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 256, NULL, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 256, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
|
||||
if (dm_entry_validate_allowed_objects(ctx, value, allowed_objects))
|
||||
|
|
@ -2999,7 +2999,7 @@ static int set_BridgingBridgeProviderBridge_CVLANcomponents(char *refparam, stru
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string_list(value, -1, -1, -1, -1, 256, NULL, NULL))
|
||||
if (bbfdm_validate_string_list(ctx, value, -1, -1, -1, -1, 256, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
|
||||
// Validate each item in list and Check if bridge is present
|
||||
|
|
|
|||
|
|
@ -41,9 +41,6 @@
|
|||
#include "routeradvertisement.h"
|
||||
#include "gatewayinfo.h"
|
||||
#include "mqtt.h"
|
||||
#ifdef BBF_TR104
|
||||
#include "servicesvoiceservice.h"
|
||||
#endif
|
||||
#include "ssh.h"
|
||||
#include "userinterface.h"
|
||||
|
||||
|
|
@ -68,12 +65,16 @@ static int get_Device_RootDataModelVersion(char *refparam, struct dmctx *ctx, vo
|
|||
*************************************************************/
|
||||
static int operate_Device_Reboot(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
|
||||
{
|
||||
return !dmubus_call_set("system", "reboot", UBUS_ARGS{0}, 0) ? 0 : USP_FAULT_COMMAND_FAILURE;
|
||||
int res = dmubus_call_set("system", "reboot", UBUS_ARGS{0}, 0);
|
||||
if (res) bbfdm_set_fault_message(ctx, "Reboot: ubus 'system reboot' method doesn't exist");
|
||||
return !res ? 0 : USP_FAULT_COMMAND_FAILURE;
|
||||
}
|
||||
|
||||
static int operate_Device_FactoryReset(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
|
||||
{
|
||||
return !dmcmd_no_wait("/sbin/defaultreset", 0) ? 0 : USP_FAULT_COMMAND_FAILURE;
|
||||
int res = dmcmd_no_wait("/sbin/defaultreset", 0);
|
||||
if (res) bbfdm_set_fault_message(ctx, "FactoryReset: '/sbin/defaultreset' command doesn't exist");
|
||||
return !res ? 0 : USP_FAULT_COMMAND_FAILURE;
|
||||
}
|
||||
|
||||
/**********************************************************************************************************************************
|
||||
|
|
|
|||
|
|
@ -617,7 +617,7 @@ static int set_device_boot_fwimage(char *refparam, struct dmctx *ctx, void *data
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, -1, NULL, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, -1, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
|
||||
if (dm_entry_validate_allowed_objects(ctx, value, allowed_objects))
|
||||
|
|
@ -732,7 +732,7 @@ static int set_device_provisioningcode(char *refparam, struct dmctx *ctx, void *
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 64, NULL, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 64, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -855,7 +855,7 @@ static int set_vcf_alias(char *refparam, struct dmctx *ctx, void *data, char *in
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 64, NULL, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 64, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -877,7 +877,7 @@ static int set_vlf_alias(char *refparam, struct dmctx *ctx, void *data, char *in
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 64, NULL, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 64, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -931,7 +931,7 @@ static int set_DeviceInfoProcessor_Alias(char *refparam, struct dmctx *ctx, void
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 64, NULL, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 64, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -983,7 +983,7 @@ static int set_DeviceInfoSupportedDataModel_Alias(char *refparam, struct dmctx *
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 64, NULL, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 64, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -1043,7 +1043,7 @@ static int set_DeviceInfoFirmwareImage_Alias(char *refparam, struct dmctx *ctx,
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 64, NULL, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 64, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -1103,7 +1103,7 @@ static int set_DeviceInfoFirmwareImage_Available(char *refparam, struct dmctx *c
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_boolean(value))
|
||||
if (bbfdm_validate_boolean(ctx, value))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -1471,16 +1471,16 @@ static int operate_DeviceInfoFirmwareImage_Activate(char *refparam, struct dmctx
|
|||
if (!DM_STRLEN(end_time[i]) || !DM_STRLEN(mode[i]))
|
||||
return USP_FAULT_INVALID_ARGUMENT;
|
||||
|
||||
if (dm_validate_unsignedInt(start_time[i], RANGE_ARGS{{NULL,NULL}}, 1))
|
||||
if (bbfdm_validate_unsignedInt(ctx, start_time[i], RANGE_ARGS{{NULL,NULL}}, 1))
|
||||
return USP_FAULT_INVALID_ARGUMENT;
|
||||
|
||||
if (dm_validate_unsignedInt(end_time[i], RANGE_ARGS{{NULL,NULL}}, 1))
|
||||
if (bbfdm_validate_unsignedInt(ctx, end_time[i], RANGE_ARGS{{NULL,NULL}}, 1))
|
||||
return USP_FAULT_INVALID_ARGUMENT;
|
||||
|
||||
if (DM_STRLEN(max_retries[i]) && dm_validate_int(max_retries[i], RANGE_ARGS{{"-1","10"}}, 1))
|
||||
if (DM_STRLEN(max_retries[i]) && bbfdm_validate_int(ctx, max_retries[i], RANGE_ARGS{{"-1","10"}}, 1))
|
||||
return USP_FAULT_INVALID_ARGUMENT;
|
||||
|
||||
if (dm_validate_string(mode[i], -1, -1, FW_Mode, NULL))
|
||||
if (bbfdm_validate_string(ctx, mode[i], -1, -1, FW_Mode, NULL))
|
||||
return USP_FAULT_INVALID_ARGUMENT;
|
||||
|
||||
if (DM_STRTOL(start_time[i]) > DM_STRTOL(end_time[i]))
|
||||
|
|
|
|||
|
|
@ -1362,7 +1362,7 @@ static int set_DHCPv4ServerPool_Enable(char *refparam, struct dmctx *ctx, void *
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_boolean(value))
|
||||
if (bbfdm_validate_boolean(ctx, value))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -1394,7 +1394,7 @@ static int set_DHCPv4ServerPool_Alias(char *refparam, struct dmctx *ctx, void *d
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 64, NULL, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 64, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -1414,7 +1414,7 @@ static int set_DHCPv4ServerPool_Order(char *refparam, struct dmctx *ctx, void *d
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_unsignedInt(value, RANGE_ARGS{{"1",NULL}}, 1))
|
||||
if (bbfdm_validate_unsignedInt(ctx, value, RANGE_ARGS{{"1",NULL}}, 1))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -1438,7 +1438,7 @@ static int set_DHCPv4ServerPool_Interface(char *refparam, struct dmctx *ctx, voi
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 256, NULL, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 256, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
|
||||
if (dm_entry_validate_allowed_objects(ctx, value, allowed_objects))
|
||||
|
|
@ -1477,7 +1477,7 @@ static int set_DHCPv4ServerPool_AllowedDevices(char *refparam, struct dmctx *ctx
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, -1, allowed_devices, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, -1, allowed_devices, NULL))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -1520,7 +1520,7 @@ static int set_DHCPv4ServerPool_MinAddress(char *refparam, struct dmctx *ctx, vo
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 15, NULL, IPv4Address))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 15, NULL, IPv4Address))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -1581,7 +1581,7 @@ static int set_DHCPv4ServerPool_MaxAddress(char *refparam, struct dmctx *ctx, vo
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 15, NULL, IPv4Address))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 15, NULL, IPv4Address))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -1659,7 +1659,7 @@ static int set_DHCPv4ServerPool_ReservedAddresses(char *refparam, struct dmctx *
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string_list(value, -1, 32, -1, -1, 15, NULL, IPv4Address))
|
||||
if (bbfdm_validate_string_list(ctx, value, -1, 32, -1, -1, 15, NULL, IPv4Address))
|
||||
return FAULT_9007;
|
||||
|
||||
local_value = dmstrdup(value);
|
||||
|
|
@ -1734,7 +1734,7 @@ static int set_DHCPv4ServerPool_SubnetMask(char *refparam, struct dmctx *ctx, vo
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 15, NULL, IPv4Address))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 15, NULL, IPv4Address))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -1758,7 +1758,7 @@ static int set_DHCPv4ServerPool_DNSServers(char *refparam, struct dmctx *ctx, vo
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string_list(value, -1, 4, -1, -1, 15, NULL, IPv4Address))
|
||||
if (bbfdm_validate_string_list(ctx, value, -1, 4, -1, -1, 15, NULL, IPv4Address))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -1778,7 +1778,7 @@ static int set_DHCPv4ServerPool_DomainName(char *refparam, struct dmctx *ctx, vo
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 64, NULL, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 64, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -1801,7 +1801,7 @@ static int set_DHCPv4ServerPool_IPRouters(char *refparam, struct dmctx *ctx, voi
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string_list(value, -1, 4, -1, -1, 15, NULL, IPv4Address))
|
||||
if (bbfdm_validate_string_list(ctx, value, -1, 4, -1, -1, 15, NULL, IPv4Address))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -1847,7 +1847,7 @@ static int set_DHCPv4ServerPool_LeaseTime(char *refparam, struct dmctx *ctx, voi
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_int(value, RANGE_ARGS{{"-1",NULL}}, 1))
|
||||
if (bbfdm_validate_int(ctx, value, RANGE_ARGS{{"-1",NULL}}, 1))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -1899,7 +1899,7 @@ static int set_DHCPv4ServerPoolStaticAddress_Enable(char *refparam, struct dmctx
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_boolean(value))
|
||||
if (bbfdm_validate_boolean(ctx, value))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -1926,7 +1926,7 @@ static int set_DHCPv4ServerPoolStaticAddress_Alias(char *refparam, struct dmctx
|
|||
switch (action) {
|
||||
case VALUECHECK:
|
||||
// Validate value string -> length
|
||||
if (dm_validate_string(value, -1, 64, NULL, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 64, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
|
||||
// Check if alias is assigned by user
|
||||
|
|
@ -1962,7 +1962,7 @@ static int set_DHCPv4ServerPoolStaticAddress_Chaddr(char *refparam, struct dmctx
|
|||
switch (action) {
|
||||
case VALUECHECK:
|
||||
// Validate value string -> MAC Address
|
||||
if (dm_validate_string(value, -1, 17, NULL, MACAddress))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 17, NULL, MACAddress))
|
||||
return FAULT_9007;
|
||||
|
||||
// Check if mac exists
|
||||
|
|
@ -1993,7 +1993,7 @@ static int set_DHCPv4ServerPoolStaticAddress_Yiaddr(char *refparam, struct dmctx
|
|||
switch (action) {
|
||||
case VALUECHECK:
|
||||
// Validate value string -> IPv4 Address
|
||||
if (dm_validate_string(value, -1, 15, NULL, IPv4Address))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 15, NULL, IPv4Address))
|
||||
return FAULT_9007;
|
||||
|
||||
// Check if ip address is out dhcp pool
|
||||
|
|
@ -2040,7 +2040,7 @@ static int set_DHCPv4ServerPoolClient_Alias(char *refparam, struct dmctx *ctx, v
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 64, NULL, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 64, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -2143,7 +2143,7 @@ static int set_DHCPv4Client_Enable(char *refparam, struct dmctx *ctx, void *data
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_boolean(value))
|
||||
if (bbfdm_validate_boolean(ctx, value))
|
||||
return FAULT_9007;
|
||||
|
||||
if (dhcpv4_client->iface_s) {
|
||||
|
|
@ -2179,7 +2179,7 @@ static int set_DHCPv4Client_Alias(char *refparam, struct dmctx *ctx, void *data,
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 64, NULL, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 64, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -2223,7 +2223,7 @@ static int set_DHCPv4Client_Interface(char *refparam, struct dmctx *ctx, void *d
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 256, NULL, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 256, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
|
||||
if (dm_entry_validate_allowed_objects(ctx, value, allowed_objects))
|
||||
|
|
@ -2351,7 +2351,7 @@ static int set_DHCPv4Client_Renew(char *refparam, struct dmctx *ctx, void *data,
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_boolean(value))
|
||||
if (bbfdm_validate_boolean(ctx, value))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -2506,7 +2506,7 @@ static int set_DHCPv4ClientSentOption_Enable(char *refparam, struct dmctx *ctx,
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_boolean(value))
|
||||
if (bbfdm_validate_boolean(ctx, value))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -2554,7 +2554,7 @@ static int set_DHCPv4ClientSentOption_Alias(char *refparam, struct dmctx *ctx, v
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 64, NULL, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 64, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -2579,7 +2579,7 @@ static int set_DHCPv4ClientSentOption_Tag(char *refparam, struct dmctx *ctx, voi
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_unsignedInt(value, RANGE_ARGS{{"1","254"}}, 1))
|
||||
if (bbfdm_validate_unsignedInt(ctx, value, RANGE_ARGS{{"1","254"}}, 1))
|
||||
return FAULT_9007;
|
||||
|
||||
if (dhcp_client_s->option_tag && DM_STRCMP(dhcp_client_s->option_tag, value) == 0)
|
||||
|
|
@ -2677,7 +2677,7 @@ static int set_DHCPv4ClientSentOption_Value(char *refparam, struct dmctx *ctx, v
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_hexBinary(value, RANGE_ARGS{{"0","255"}}, 1))
|
||||
if (bbfdm_validate_hexBinary(ctx, value, RANGE_ARGS{{"0","255"}}, 1))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -2729,7 +2729,7 @@ static int set_DHCPv4ClientReqOption_Enable(char *refparam, struct dmctx *ctx, v
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_boolean(value))
|
||||
if (bbfdm_validate_boolean(ctx, value))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -2765,7 +2765,7 @@ static int set_DHCPv4ClientReqOption_Alias(char *refparam, struct dmctx *ctx, vo
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 64, NULL, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 64, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -2789,7 +2789,7 @@ static int set_DHCPv4ClientReqOption_Tag(char *refparam, struct dmctx *ctx, void
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_unsignedInt(value, RANGE_ARGS{{"1","254"}}, 1))
|
||||
if (bbfdm_validate_unsignedInt(ctx, value, RANGE_ARGS{{"1","254"}}, 1))
|
||||
return FAULT_9007;
|
||||
|
||||
if (dhcp_client_s->option_tag && DM_STRCMP(dhcp_client_s->option_tag, value) == 0)
|
||||
|
|
@ -2837,7 +2837,7 @@ static int set_DHCPv4Server_Enable(char *refparam, struct dmctx *ctx, void *data
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_boolean(value))
|
||||
if (bbfdm_validate_boolean(ctx, value))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -2886,7 +2886,7 @@ static int set_DHCPv4ServerPoolOption_Enable(char *refparam, struct dmctx *ctx,
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_boolean(value))
|
||||
if (bbfdm_validate_boolean(ctx, value))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -2927,7 +2927,7 @@ static int set_DHCPv4ServerPoolOption_Alias(char *refparam, struct dmctx *ctx, v
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 64, NULL, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 64, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -2951,7 +2951,7 @@ static int set_DHCPv4ServerPoolOption_Tag(char *refparam, struct dmctx *ctx, voi
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_unsignedInt(value, RANGE_ARGS{{"1","254"}}, 1))
|
||||
if (bbfdm_validate_unsignedInt(ctx, value, RANGE_ARGS{{"1","254"}}, 1))
|
||||
return FAULT_9007;
|
||||
|
||||
if (dhcp_client_s->option_tag && DM_STRCMP(dhcp_client_s->option_tag, value) == 0)
|
||||
|
|
@ -3014,7 +3014,7 @@ static int set_DHCPv4ServerPoolOption_Value(char *refparam, struct dmctx *ctx, v
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_hexBinary(value, RANGE_ARGS{{"0","255"}}, 1))
|
||||
if (bbfdm_validate_hexBinary(ctx, value, RANGE_ARGS{{"0","255"}}, 1))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -3066,7 +3066,7 @@ static int set_DHCPv4Relay_Enable(char *refparam, struct dmctx *ctx, void *data,
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_boolean(value))
|
||||
if (bbfdm_validate_boolean(ctx, value))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -3112,7 +3112,7 @@ static int set_DHCPv4RelayForwarding_Enable(char *refparam, struct dmctx *ctx, v
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_boolean(value))
|
||||
if (bbfdm_validate_boolean(ctx, value))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -3145,7 +3145,7 @@ static int set_DHCPv4RelayForwarding_Alias(char *refparam, struct dmctx *ctx, vo
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 64, NULL, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 64, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -3174,7 +3174,7 @@ static int set_DHCPv4RelayForwarding_Interface(char *refparam, struct dmctx *ctx
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 256, NULL, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 256, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
|
||||
if (dm_entry_validate_allowed_objects(ctx, value, allowed_objects))
|
||||
|
|
@ -3236,7 +3236,7 @@ static int set_DHCPv4RelayForwarding_VendorClassID(char *refparam, struct dmctx
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 255, NULL, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 255, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -3277,7 +3277,7 @@ static int set_DHCPv4RelayForwarding_Chaddr(char *refparam, struct dmctx *ctx, v
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 17, NULL, MACAddress))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 17, NULL, MACAddress))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -3319,7 +3319,7 @@ static int set_DHCPv4RelayForwarding_UserClassID(char *refparam, struct dmctx *c
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_hexBinary(value, RANGE_ARGS{{NULL,"255"}}, 1))
|
||||
if (bbfdm_validate_hexBinary(ctx, value, RANGE_ARGS{{NULL,"255"}}, 1))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
|
|||
|
|
@ -488,7 +488,7 @@ static int set_DHCPv6Client_Enable(char *refparam, struct dmctx *ctx, void *data
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_boolean(value))
|
||||
if (bbfdm_validate_boolean(ctx, value))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -513,7 +513,7 @@ static int set_DHCPv6Client_Alias(char *refparam, struct dmctx *ctx, void *data,
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 64, NULL, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 64, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -556,7 +556,7 @@ static int set_DHCPv6Client_Interface(char *refparam, struct dmctx *ctx, void *d
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 256, NULL, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 256, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
|
||||
if (dm_entry_validate_allowed_objects(ctx, value, allowed_objects))
|
||||
|
|
@ -647,7 +647,7 @@ static int set_DHCPv6Client_RequestAddresses(char *refparam, struct dmctx *ctx,
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_boolean(value))
|
||||
if (bbfdm_validate_boolean(ctx, value))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -678,7 +678,7 @@ static int set_DHCPv6Client_RequestPrefixes(char *refparam, struct dmctx *ctx, v
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_boolean(value))
|
||||
if (bbfdm_validate_boolean(ctx, value))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -704,7 +704,7 @@ static int set_DHCPv6Client_Renew(char *refparam, struct dmctx *ctx, void *data,
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_boolean(value))
|
||||
if (bbfdm_validate_boolean(ctx, value))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -734,7 +734,7 @@ static int set_DHCPv6Client_RequestedOptions(char *refparam, struct dmctx *ctx,
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_unsignedInt_list(value, -1, -1, -1, RANGE_ARGS{{NULL,NULL}}, 1))
|
||||
if (bbfdm_validate_unsignedInt_list(ctx, value, -1, -1, -1, RANGE_ARGS{{NULL,NULL}}, 1))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -762,7 +762,7 @@ static int set_DHCPv6Server_Enable(char *refparam, struct dmctx *ctx, void *data
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_boolean(value))
|
||||
if (bbfdm_validate_boolean(ctx, value))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -794,7 +794,7 @@ static int set_DHCPv6ServerPool_Enable(char *refparam, struct dmctx *ctx, void *
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_boolean(value))
|
||||
if (bbfdm_validate_boolean(ctx, value))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -826,7 +826,7 @@ static int set_DHCPv6ServerPool_Alias(char *refparam, struct dmctx *ctx, void *d
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 64, NULL, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 64, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -846,7 +846,7 @@ static int set_DHCPv6ServerPool_Order(char *refparam, struct dmctx *ctx, void *d
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_unsignedInt(value, RANGE_ARGS{{"1",NULL}}, 1))
|
||||
if (bbfdm_validate_unsignedInt(ctx, value, RANGE_ARGS{{"1",NULL}}, 1))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -870,7 +870,7 @@ static int set_DHCPv6ServerPool_Interface(char *refparam, struct dmctx *ctx, voi
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 256, NULL, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 256, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
|
||||
if (dm_entry_validate_allowed_objects(ctx, value, allowed_objects))
|
||||
|
|
@ -907,7 +907,7 @@ static int set_DHCPv6ServerPool_VendorClassID(char *refparam, struct dmctx *ctx,
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_hexBinary(value, RANGE_ARGS{{NULL,"65535"}}, 1))
|
||||
if (bbfdm_validate_hexBinary(ctx, value, RANGE_ARGS{{NULL,"65535"}}, 1))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -946,7 +946,7 @@ static int set_DHCPv6ServerPool_UserClassID(char *refparam, struct dmctx *ctx, v
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_hexBinary(value, RANGE_ARGS{{NULL,"65535"}}, 1))
|
||||
if (bbfdm_validate_hexBinary(ctx, value, RANGE_ARGS{{NULL,"65535"}}, 1))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -978,7 +978,7 @@ static int set_DHCPv6ServerPool_SourceAddress(char *refparam, struct dmctx *ctx,
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 45, NULL, IPv6Address))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 45, NULL, IPv6Address))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -1002,7 +1002,7 @@ static int set_DHCPv6ServerPool_SourceAddressMask(char *refparam, struct dmctx *
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 45, NULL, IPv6Address))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 45, NULL, IPv6Address))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -1050,7 +1050,7 @@ static int set_DHCPv6ServerPoolClient_Alias(char *refparam, struct dmctx *ctx, v
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 64, NULL, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 64, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -1165,7 +1165,7 @@ static int set_DHCPv6ServerPoolOption_Enable(char *refparam, struct dmctx *ctx,
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_boolean(value))
|
||||
if (bbfdm_validate_boolean(ctx, value))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -1207,7 +1207,7 @@ static int set_DHCPv6ServerPoolOption_Alias(char *refparam, struct dmctx *ctx, v
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 64, NULL, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 64, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -1231,7 +1231,7 @@ static int set_DHCPv6ServerPoolOption_Tag(char *refparam, struct dmctx *ctx, voi
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_unsignedInt(value, RANGE_ARGS{{"0","65535"}}, 1))
|
||||
if (bbfdm_validate_unsignedInt(ctx, value, RANGE_ARGS{{"0","65535"}}, 1))
|
||||
return FAULT_9007;
|
||||
|
||||
if (dhcpv6_client_s->option_tag && DM_STRCMP(dhcpv6_client_s->option_tag, value) == 0)
|
||||
|
|
@ -1294,7 +1294,7 @@ static int set_DHCPv6ServerPoolOption_Value(char *refparam, struct dmctx *ctx, v
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_hexBinary(value, RANGE_ARGS{{"0","65535"}}, 1))
|
||||
if (bbfdm_validate_hexBinary(ctx, value, RANGE_ARGS{{"0","65535"}}, 1))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
|
|||
|
|
@ -435,7 +435,7 @@ static int set_client_enable(char *refparam, struct dmctx *ctx, void *data, char
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_boolean(value))
|
||||
if (bbfdm_validate_boolean(ctx, value))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -453,7 +453,7 @@ static int set_dns_enable(char *refparam, struct dmctx *ctx, void *data, char *i
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_boolean(value))
|
||||
if (bbfdm_validate_boolean(ctx, value))
|
||||
return FAULT_9007;
|
||||
|
||||
// If peerdns = '1' then it is a dynamic dns and not allowed to disable it
|
||||
|
|
@ -484,7 +484,7 @@ static int set_server_alias(char *refparam, struct dmctx *ctx, void *data, char
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 64, NULL, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 64, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -503,7 +503,7 @@ static int set_dns_server(char *refparam, struct dmctx *ctx, void *data, char *i
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 45, NULL, IPAddress))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 45, NULL, IPAddress))
|
||||
return FAULT_9007;
|
||||
|
||||
// If peerdns = '1' then it is a dynamic dns and not allowed to set this parameter
|
||||
|
|
@ -543,7 +543,7 @@ static int set_dns_interface(char *refparam, struct dmctx *ctx, void *data, char
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 256, NULL, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 256, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
|
||||
if (dm_entry_validate_allowed_objects(ctx, value, allowed_objects))
|
||||
|
|
@ -590,7 +590,7 @@ static int set_relay_enable(char *refparam, struct dmctx *ctx, void *data, char
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_boolean(value))
|
||||
if (bbfdm_validate_boolean(ctx, value))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -605,7 +605,7 @@ static int set_forwarding_alias(char *refparam, struct dmctx *ctx, void *data, c
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 64, NULL, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 64, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -619,7 +619,7 @@ static int set_nslookupdiagnostics_diagnostics_state(char *refparam, struct dmct
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, -1, DiagnosticsState, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, -1, DiagnosticsState, NULL))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -636,7 +636,7 @@ static int set_nslookupdiagnostics_interface(char *refparam, struct dmctx *ctx,
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 256, NULL, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 256, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
|
||||
if (dm_entry_validate_allowed_objects(ctx, value, allowed_objects))
|
||||
|
|
@ -655,7 +655,7 @@ static int set_nslookupdiagnostics_host_name(char *refparam, struct dmctx *ctx,
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 256, NULL, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 256, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -670,7 +670,7 @@ static int set_nslookupdiagnostics_d_n_s_server(char *refparam, struct dmctx *ct
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 256, NULL, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 256, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -685,7 +685,7 @@ static int set_nslookupdiagnostics_timeout(char *refparam, struct dmctx *ctx, vo
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_unsignedInt(value, RANGE_ARGS{{NULL,NULL}}, 1))
|
||||
if (bbfdm_validate_unsignedInt(ctx, value, RANGE_ARGS{{NULL,NULL}}, 1))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -700,7 +700,7 @@ static int set_nslookupdiagnostics_number_of_repetitions(char *refparam, struct
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_unsignedInt(value, RANGE_ARGS{{NULL,NULL}}, 1))
|
||||
if (bbfdm_validate_unsignedInt(ctx, value, RANGE_ARGS{{NULL,NULL}}, 1))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -754,8 +754,11 @@ static int operate_DNSDiagnostics_NSLookupDiagnostics(char *refparam, struct dmc
|
|||
int idx = 0;
|
||||
|
||||
char *hostname = dmjson_get_value((json_object *)value, 1, "HostName");
|
||||
if (hostname[0] == '\0')
|
||||
if (hostname[0] == '\0') {
|
||||
bbfdm_set_fault_message(ctx, "NSLookupDiagnostics: 'HostName' input should be defined");
|
||||
return USP_FAULT_INVALID_ARGUMENT;
|
||||
}
|
||||
|
||||
char *interface = dmjson_get_value((json_object *)value, 1, "Interface");
|
||||
char *dnsserver = dmjson_get_value((json_object *)value, 1, "DNSServer");
|
||||
char *timeout = dmjson_get_value((json_object *)value, 1, "Timeout");
|
||||
|
|
@ -773,8 +776,10 @@ static int operate_DNSDiagnostics_NSLookupDiagnostics(char *refparam, struct dmc
|
|||
},
|
||||
6, &res);
|
||||
|
||||
if (res == NULL)
|
||||
if (res == NULL) {
|
||||
bbfdm_set_fault_message(ctx, "NSLookupDiagnostics: ubus 'bbf.diag nslookup' method doesn't exist");
|
||||
return USP_FAULT_COMMAND_FAILURE;
|
||||
}
|
||||
|
||||
char *status = dmjson_get_value(res, 1, "Status");
|
||||
char *success_count = dmjson_get_value(res, 1, "SuccessCount");
|
||||
|
|
|
|||
|
|
@ -262,7 +262,7 @@ static int set_DSLLine_Enable(char *refparam, struct dmctx *ctx, void *data, cha
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_boolean(value))
|
||||
if (bbfdm_validate_boolean(ctx, value))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -291,7 +291,7 @@ static int set_DSLLine_Alias(char *refparam, struct dmctx *ctx, void *data, char
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 64, NULL, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 64, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -317,7 +317,7 @@ static int set_DSLLine_LowerLayers(char *refparam, struct dmctx *ctx, void *data
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string_list(value, -1, -1, 1024, -1, -1, NULL, NULL))
|
||||
if (bbfdm_validate_string_list(ctx, value, -1, -1, 1024, -1, -1, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -941,7 +941,7 @@ static int set_DSLChannel_Enable(char *refparam, struct dmctx *ctx, void *data,
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_boolean(value))
|
||||
if (bbfdm_validate_boolean(ctx, value))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -983,7 +983,7 @@ static int set_DSLChannel_Alias(char *refparam, struct dmctx *ctx, void *data, c
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 64, NULL, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 64, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
|
|||
|
|
@ -451,7 +451,7 @@ static int set_DynamicDNSClient_Enable(char *refparam, struct dmctx *ctx, void *
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_boolean(value))
|
||||
if (bbfdm_validate_boolean(ctx, value))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -513,7 +513,7 @@ static int set_DynamicDNSClient_Alias(char *refparam, struct dmctx *ctx, void *d
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 64, NULL, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 64, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -578,7 +578,7 @@ static int set_DynamicDNSClient_Server(char *refparam, struct dmctx *ctx, void *
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 256, NULL, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 256, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
|
||||
if (dm_entry_validate_allowed_objects(ctx, value, allowed_objects))
|
||||
|
|
@ -610,7 +610,7 @@ static int set_DynamicDNSClient_Interface(char *refparam, struct dmctx *ctx, voi
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 256, NULL, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 256, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
|
||||
if (dm_entry_validate_allowed_objects(ctx, value, allowed_objects))
|
||||
|
|
@ -637,7 +637,7 @@ static int set_DynamicDNSClient_Username(char *refparam, struct dmctx *ctx, void
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 256, NULL, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 256, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -658,7 +658,7 @@ static int set_DynamicDNSClient_Password(char *refparam, struct dmctx *ctx, void
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 256, NULL, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 256, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -688,7 +688,7 @@ static int set_DynamicDNSClientHostname_Enable(char *refparam, struct dmctx *ctx
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_boolean(value))
|
||||
if (bbfdm_validate_boolean(ctx, value))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -744,7 +744,7 @@ static int set_DynamicDNSClientHostname_Name(char *refparam, struct dmctx *ctx,
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 256, NULL, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 256, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -817,7 +817,7 @@ static int set_DynamicDNSServer_Enable(char *refparam, struct dmctx *ctx, void *
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_boolean(value))
|
||||
if (bbfdm_validate_boolean(ctx, value))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -863,7 +863,7 @@ static int set_DynamicDNSServer_Name(char *refparam, struct dmctx *ctx, void *da
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 64, NULL, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 64, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -885,7 +885,7 @@ static int set_DynamicDNSServer_Alias(char *refparam, struct dmctx *ctx, void *d
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 64, NULL, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 64, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -912,7 +912,7 @@ static int set_DynamicDNSServer_ServiceName(char *refparam, struct dmctx *ctx, v
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 256, NULL, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 256, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -956,7 +956,7 @@ static int set_DynamicDNSServer_ServerAddress(char *refparam, struct dmctx *ctx,
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 256, NULL, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 256, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -1002,7 +1002,7 @@ static int set_DynamicDNSServer_Protocol(char *refparam, struct dmctx *ctx, void
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, -1, SupportedProtocols, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, -1, SupportedProtocols, NULL))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
|
|||
|
|
@ -455,7 +455,7 @@ static int set_EthernetInterface_Enable(char *refparam, struct dmctx *ctx, void
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_boolean(value))
|
||||
if (bbfdm_validate_boolean(ctx, value))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -487,7 +487,7 @@ static int set_EthernetInterface_Alias(char *refparam, struct dmctx *ctx, void *
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 64, NULL, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 64, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -556,7 +556,7 @@ static int set_EthernetInterface_LowerLayers(char *refparam, struct dmctx *ctx,
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string_list(value, -1, -1, 1024, -1, -1, NULL, NULL))
|
||||
if (bbfdm_validate_string_list(ctx, value, -1, -1, 1024, -1, -1, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
|
||||
if (*value != '\0')
|
||||
|
|
@ -601,7 +601,7 @@ static int set_EthernetInterface_MaxBitRate(char *refparam, struct dmctx *ctx, v
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_int(value, RANGE_ARGS{{"-1",NULL}}, 1))
|
||||
if (bbfdm_validate_int(ctx, value, RANGE_ARGS{{"-1",NULL}}, 1))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -652,7 +652,7 @@ static int set_EthernetInterface_DuplexMode(char *refparam, struct dmctx *ctx, v
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, -1, DuplexMode, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, -1, DuplexMode, NULL))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -686,7 +686,7 @@ static int set_EthernetInterface_EEEEnable(char *refparam, struct dmctx *ctx, vo
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_boolean(value))
|
||||
if (bbfdm_validate_boolean(ctx, value))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -813,7 +813,7 @@ static int set_EthernetLink_Enable(char *refparam, struct dmctx *ctx, void *data
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_boolean(value))
|
||||
if (bbfdm_validate_boolean(ctx, value))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -843,7 +843,7 @@ static int set_EthernetLink_Alias(char *refparam, struct dmctx *ctx, void *data,
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 64, NULL, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 64, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -923,7 +923,7 @@ static int set_EthernetLink_LowerLayers(char *refparam, struct dmctx *ctx, void
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string_list(value, -1, -1, 1024, -1, -1, NULL, NULL))
|
||||
if (bbfdm_validate_string_list(ctx, value, -1, -1, 1024, -1, -1, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
|
||||
if (dm_entry_validate_allowed_objects(ctx, value, allowed_objects))
|
||||
|
|
@ -1029,7 +1029,7 @@ static int set_EthernetLink_FlowControl(char *refparam, struct dmctx *ctx, void
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_boolean(value))
|
||||
if (bbfdm_validate_boolean(ctx, value))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -1182,7 +1182,7 @@ static int set_EthernetVLANTermination_Enable(char *refparam, struct dmctx *ctx,
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_boolean(value))
|
||||
if (bbfdm_validate_boolean(ctx, value))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -1214,7 +1214,7 @@ static int set_EthernetVLANTermination_Alias(char *refparam, struct dmctx *ctx,
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 64, NULL, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 64, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -1266,7 +1266,7 @@ static int set_EthernetVLANTermination_LowerLayers(char *refparam, struct dmctx
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string_list(value, -1, -1, 1024, -1, -1, NULL, NULL))
|
||||
if (bbfdm_validate_string_list(ctx, value, -1, -1, 1024, -1, -1, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
|
||||
if (dm_entry_validate_allowed_objects(ctx, value, allowed_objects))
|
||||
|
|
@ -1374,7 +1374,7 @@ static int set_EthernetVLANTermination_VLANID(char *refparam, struct dmctx *ctx,
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_unsignedInt(value, RANGE_ARGS{{"1","4094"}}, 1))
|
||||
if (bbfdm_validate_unsignedInt(ctx, value, RANGE_ARGS{{"1","4094"}}, 1))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -1451,7 +1451,7 @@ static int set_EthernetVLANTermination_TPID(char *refparam, struct dmctx *ctx, v
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_unsignedInt(value, RANGE_ARGS{{NULL,NULL}}, 1))
|
||||
if (bbfdm_validate_unsignedInt(ctx, value, RANGE_ARGS{{NULL,NULL}}, 1))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -1531,7 +1531,7 @@ static int set_EthernetRMONStats_Enable(char *refparam, struct dmctx *ctx, void
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_boolean(value))
|
||||
if (bbfdm_validate_boolean(ctx, value))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -1572,7 +1572,7 @@ static int set_EthernetRMONStats_Alias(char *refparam, struct dmctx *ctx, void *
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 64, NULL, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 64, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -1602,7 +1602,7 @@ static int set_EthernetRMONStats_Interface(char *refparam, struct dmctx *ctx, vo
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, -1, NULL, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, -1, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -1621,7 +1621,7 @@ static int set_EthernetRMONStats_VLANID(char *refparam, struct dmctx *ctx, void
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_unsignedInt(value, RANGE_ARGS{{"0","4094"}}, 1))
|
||||
if (bbfdm_validate_unsignedInt(ctx, value, RANGE_ARGS{{"0","4094"}}, 1))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -1640,7 +1640,7 @@ static int set_EthernetRMONStats_AllQueues(char *refparam, struct dmctx *ctx, vo
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_boolean(value))
|
||||
if (bbfdm_validate_boolean(ctx, value))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
|
|||
|
|
@ -151,7 +151,7 @@ static int set_FASTLine_Enable(char *refparam, struct dmctx *ctx, void *data, ch
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_boolean(value))
|
||||
if (bbfdm_validate_boolean(ctx, value))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -180,7 +180,7 @@ static int set_FASTLine_Alias(char *refparam, struct dmctx *ctx, void *data, cha
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 64, NULL, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 64, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -206,7 +206,7 @@ static int set_FASTLine_LowerLayers(char *refparam, struct dmctx *ctx, void *dat
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string_list(value, -1, -1, 1024, -1, -1, NULL, NULL))
|
||||
if (bbfdm_validate_string_list(ctx, value, -1, -1, 1024, -1, -1, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
|
|||
|
|
@ -368,8 +368,10 @@ static int add_firewall_rule(char *refparam, struct dmctx *ctx, void *data, char
|
|||
time_t now = time(NULL);
|
||||
|
||||
dmuci_get_value_by_section_string(chain_args, "creator", &creator);
|
||||
if (DM_STRCMP(creator, "PortMapping") == 0)
|
||||
if (DM_STRCMP(creator, "PortMapping") == 0) {
|
||||
bbfdm_set_fault_message(ctx, "This is a dynamic 'Chain' instance which is created by 'Port Mapping', so it's not permitted to add a static 'Rule'.");
|
||||
return FAULT_9003;
|
||||
}
|
||||
|
||||
dmuci_get_value_by_section_string(chain_args, "rule_start_pos", &rule_start_pos);
|
||||
dmuci_get_value_by_section_string(chain_args, "rules_num", &rules_num);
|
||||
|
|
@ -407,8 +409,10 @@ static int delete_firewall_rule(char *refparam, struct dmctx *ctx, void *data, c
|
|||
|
||||
switch (del_action) {
|
||||
case DEL_INST:
|
||||
if (((struct rule_sec *)data)->is_dynamic_rule)
|
||||
if (((struct rule_sec *)data)->is_dynamic_rule) {
|
||||
bbfdm_set_fault_message(ctx, "This is a dynamic 'Rule' instance, therefore it's not permitted to delete it.");
|
||||
return FAULT_9003;
|
||||
}
|
||||
|
||||
s = get_dup_section_in_dmmap_opt("dmmap_firewall", "chain", "creator", "Defaults");
|
||||
dmuci_get_value_by_section_string(s, "rules_num", &rules_num);
|
||||
|
|
@ -751,7 +755,7 @@ static int set_FirewallChainRule_ExpiryDate(char *refparam, struct dmctx *ctx, v
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_dateTime(value))
|
||||
if (bbfdm_validate_dateTime(ctx, value))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -1159,7 +1163,7 @@ static int set_firewall_enable(char *refparam, struct dmctx *ctx, void *data, ch
|
|||
bool b;
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_boolean(value))
|
||||
if (bbfdm_validate_boolean(ctx, value))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -1174,12 +1178,14 @@ static int set_firewall_config(char *refparam, struct dmctx *ctx, void *data, ch
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, -1, Config, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, -1, Config, NULL))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
if (strcasecmp(value, "Advanced") != 0)
|
||||
if (strcasecmp(value, "Advanced") != 0) {
|
||||
bbfdm_set_fault_message(ctx, "The current Firewall implementation supports only 'Advanced' config.");
|
||||
return FAULT_9007;
|
||||
}
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
|
|
@ -1189,12 +1195,14 @@ static int set_firewall_advanced_level(char *refparam, struct dmctx *ctx, void *
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, -1, NULL, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, -1, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
if (strcasecmp(value, "Device.Firewall.Level.1.") != 0)
|
||||
if (strcasecmp(value, "Device.Firewall.Level.1.") != 0) {
|
||||
bbfdm_set_fault_message(ctx, "The current Firewall implementation supports only one Level. So the value should be 'Device.Firewall.Level.1'.");
|
||||
return FAULT_9007;
|
||||
}
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
|
|
@ -1204,7 +1212,7 @@ static int set_level_alias(char *refparam, struct dmctx *ctx, void *data, char *
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 64, NULL, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 64, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -1218,7 +1226,7 @@ static int set_level_name(char *refparam, struct dmctx *ctx, void *data, char *i
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 64, NULL, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 64, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -1232,7 +1240,7 @@ static int set_level_description(char *refparam, struct dmctx *ctx, void *data,
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 256, NULL, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 256, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -1249,7 +1257,7 @@ static int set_level_port_mapping_enabled(char *refparam, struct dmctx *ctx, voi
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_boolean(value))
|
||||
if (bbfdm_validate_boolean(ctx, value))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -1277,7 +1285,7 @@ static int set_level_default_policy(char *refparam, struct dmctx *ctx, void *dat
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, -1, DefaultPolicy, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, -1, DefaultPolicy, NULL))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -1303,7 +1311,7 @@ static int set_level_default_log_policy(char *refparam, struct dmctx *ctx, void
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_boolean(value))
|
||||
if (bbfdm_validate_boolean(ctx, value))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -1326,7 +1334,7 @@ static int set_chain_enable(char *refparam, struct dmctx *ctx, void *data, char
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_boolean(value))
|
||||
if (bbfdm_validate_boolean(ctx, value))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -1339,7 +1347,7 @@ static int set_chain_alias(char *refparam, struct dmctx *ctx, void *data, char *
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 64, NULL, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 64, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -1353,7 +1361,7 @@ static int set_chain_name(char *refparam, struct dmctx *ctx, void *data, char *i
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 64, NULL, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 64, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -1369,7 +1377,7 @@ static int set_rule_enable(char *refparam, struct dmctx *ctx, void *data, char *
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_boolean(value))
|
||||
if (bbfdm_validate_boolean(ctx, value))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -1392,12 +1400,14 @@ static int set_rule_order(char *refparam, struct dmctx *ctx, void *data, char *i
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_unsignedInt(value, RANGE_ARGS{{"1",NULL}}, 1))
|
||||
if (bbfdm_validate_unsignedInt(ctx, value, RANGE_ARGS{{"1",NULL}}, 1))
|
||||
return FAULT_9007;
|
||||
|
||||
dmuci_get_value_by_section_string(s, "rules_num", &rules_num);
|
||||
if (DM_STRTOUL(value) > DM_STRTOUL(rules_num))
|
||||
if (DM_STRTOUL(value) > DM_STRTOUL(rules_num)) {
|
||||
bbfdm_set_fault_message(ctx, "The order value '%s' should be lower than the greater order value '%s'.", value, rules_num);
|
||||
return FAULT_9007;
|
||||
}
|
||||
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -1421,7 +1431,7 @@ static int set_rule_alias(char *refparam, struct dmctx *ctx, void *data, char *i
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 64, NULL, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 64, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -1435,7 +1445,7 @@ static int set_rule_description(char *refparam, struct dmctx *ctx, void *data, c
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 256, NULL, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 256, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -1449,7 +1459,7 @@ static int set_rule_target(char *refparam, struct dmctx *ctx, void *data, char *
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, -1, Target, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, -1, Target, NULL))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -1472,7 +1482,7 @@ static int set_rule_log(char *refparam, struct dmctx *ctx, void *data, char *ins
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_boolean(value))
|
||||
if (bbfdm_validate_boolean(ctx, value))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -1490,7 +1500,7 @@ static int set_rule_interface(struct dmctx *ctx, void *data, char *type, char *v
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 256, NULL, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 256, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
|
||||
if (dm_entry_validate_allowed_objects(ctx, value, allowed_objects))
|
||||
|
|
@ -1531,7 +1541,7 @@ static int set_rule_source_all_interfaces(char *refparam, struct dmctx *ctx, voi
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_boolean(value))
|
||||
if (bbfdm_validate_boolean(ctx, value))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -1569,7 +1579,7 @@ static int set_rule_dest_all_interfaces(char *refparam, struct dmctx *ctx, void
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_boolean(value))
|
||||
if (bbfdm_validate_boolean(ctx, value))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -1599,7 +1609,7 @@ static int set_rule_i_p_version(char *refparam, struct dmctx *ctx, void *data, c
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_int(value, RANGE_ARGS{{"-1","15"}}, 1))
|
||||
if (bbfdm_validate_int(ctx, value, RANGE_ARGS{{"-1","15"}}, 1))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -1620,7 +1630,7 @@ static int set_rule_dest_ip(char *refparam, struct dmctx *ctx, void *data, char
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 45, NULL, IPAddress))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 45, NULL, IPAddress))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -1643,7 +1653,7 @@ static int set_rule_dest_mask(char *refparam, struct dmctx *ctx, void *data, cha
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 49, NULL, IPPrefix))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 49, NULL, IPPrefix))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -1654,7 +1664,7 @@ static int set_rule_dest_mask(char *refparam, struct dmctx *ctx, void *data, cha
|
|||
|
||||
pch = DM_STRCHR(value, '/');
|
||||
if (pch == NULL)
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
|
||||
snprintf(new, sizeof(new), "%s%s", destip, pch);
|
||||
dmuci_set_value_by_section(((struct rule_sec *)data)->config_section, "dest_ip", new);
|
||||
|
|
@ -1669,7 +1679,7 @@ static int set_rule_source_ip(char *refparam, struct dmctx *ctx, void *data, cha
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 45, NULL, IPAddress))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 45, NULL, IPAddress))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -1692,7 +1702,7 @@ static int set_rule_source_mask(char *refparam, struct dmctx *ctx, void *data, c
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 49, NULL, IPPrefix))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 49, NULL, IPPrefix))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -1703,7 +1713,7 @@ static int set_rule_source_mask(char *refparam, struct dmctx *ctx, void *data, c
|
|||
|
||||
pch = DM_STRCHR(value, '/');
|
||||
if (pch == NULL)
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
|
||||
snprintf(new, sizeof(new), "%s%s", srcip, pch);
|
||||
dmuci_set_value_by_section(((struct rule_sec *)data)->config_section, "src_ip", new);
|
||||
|
|
@ -1716,7 +1726,7 @@ static int set_rule_protocol(char *refparam, struct dmctx *ctx, void *data, char
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_int(value, RANGE_ARGS{{"-1","255"}}, 1))
|
||||
if (bbfdm_validate_int(ctx, value, RANGE_ARGS{{"-1","255"}}, 1))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -1732,7 +1742,7 @@ static int set_rule_dest_port(char *refparam, struct dmctx *ctx, void *data, cha
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_int(value, RANGE_ARGS{{"-1","65535"}}, 1))
|
||||
if (bbfdm_validate_int(ctx, value, RANGE_ARGS{{"-1","65535"}}, 1))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -1758,7 +1768,7 @@ static int set_rule_dest_port_range_max(char *refparam, struct dmctx *ctx, void
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_int(value, RANGE_ARGS{{"-1","65535"}}, 1))
|
||||
if (bbfdm_validate_int(ctx, value, RANGE_ARGS{{"-1","65535"}}, 1))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -1787,7 +1797,7 @@ static int set_rule_source_port(char *refparam, struct dmctx *ctx, void *data, c
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_int(value, RANGE_ARGS{{"-1","65535"}}, 1))
|
||||
if (bbfdm_validate_int(ctx, value, RANGE_ARGS{{"-1","65535"}}, 1))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -1813,7 +1823,7 @@ static int set_rule_source_port_range_max(char *refparam, struct dmctx *ctx, voi
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_int(value, RANGE_ARGS{{"-1","65535"}}, 1))
|
||||
if (bbfdm_validate_int(ctx, value, RANGE_ARGS{{"-1","65535"}}, 1))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
|
|||
|
|
@ -203,7 +203,7 @@ static int set_GRETunnel_Alias(char *refparam, struct dmctx *ctx, void *data, ch
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 64, NULL, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 64, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -223,7 +223,7 @@ static int set_GRETunnel_KeepAliveThreshold(char *refparam, struct dmctx *ctx, v
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_unsignedInt(value, RANGE_ARGS{{NULL,NULL}}, 1))
|
||||
if (bbfdm_validate_unsignedInt(ctx, value, RANGE_ARGS{{NULL,NULL}}, 1))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -295,7 +295,7 @@ static int set_GRETunnelInterface_Alias(char *refparam, struct dmctx *ctx, void
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 64, NULL, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 64, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
|
|||
|
|
@ -409,7 +409,7 @@ static int set_HostsAccessControl_Alias(char *refparam, struct dmctx *ctx, void
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 64, NULL, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 64, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -429,7 +429,7 @@ static int set_HostsAccessControl_PhysAddress(char *refparam, struct dmctx *ctx,
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 64, NULL, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 64, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -449,7 +449,7 @@ static int set_HostsAccessControl_HostName(char *refparam, struct dmctx *ctx, vo
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 256, NULL, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 256, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -471,7 +471,7 @@ static int set_HostsAccessControl_Enable(char *refparam, struct dmctx *ctx, void
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_boolean(value))
|
||||
if (bbfdm_validate_boolean(ctx, value))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -492,7 +492,7 @@ static int set_HostsAccessControl_AccessPolicy(char *refparam, struct dmctx *ctx
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, -1, AccessPolicy, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, -1, AccessPolicy, NULL))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -521,7 +521,7 @@ static int set_HostsAccessControlSchedule_Alias(char *refparam, struct dmctx *ct
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 64, NULL, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 64, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -543,7 +543,7 @@ static int set_HostsAccessControlSchedule_Enable(char *refparam, struct dmctx *c
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_boolean(value))
|
||||
if (bbfdm_validate_boolean(ctx, value))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -591,7 +591,7 @@ static int set_HostsAccessControlSchedule_Day(char *refparam, struct dmctx *ctx,
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string_list(value, -1, -1, -1, -1, -1, Day, NULL))
|
||||
if (bbfdm_validate_string_list(ctx, value, -1, -1, -1, -1, -1, Day, NULL))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -613,7 +613,7 @@ static int set_HostsAccessControlSchedule_StartTime(char *refparam, struct dmctx
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 5, NULL, StartTime))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 5, NULL, StartTime))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -633,7 +633,7 @@ static int set_HostsAccessControlSchedule_Duration(char *refparam, struct dmctx
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_unsignedInt(value, RANGE_ARGS{{"1",NULL}}, 1))
|
||||
if (bbfdm_validate_unsignedInt(ctx, value, RANGE_ARGS{{"1",NULL}}, 1))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
|
|||
|
|
@ -499,7 +499,7 @@ static int set_IEEE1905ALInterface_SetIntfPowerStateEnabled(char *refparam, stru
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_boolean(value))
|
||||
if (bbfdm_validate_boolean(ctx, value))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -522,7 +522,7 @@ static int set_IEEE1905ALInterface_PowerState(char *refparam, struct dmctx *ctx,
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, -1, PowerState, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, -1, PowerState, NULL))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -686,7 +686,7 @@ static int set_IEEE1905ALForwardingTable_SetForwardingEnabled(char *refparam, st
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_boolean(value))
|
||||
if (bbfdm_validate_boolean(ctx, value))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -728,7 +728,7 @@ static int set_IEEE1905ALForwardingTableForwardingRule_InterfaceList(char *refpa
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string_list(value, -1, -1, -1, -1, 256, NULL, NULL))
|
||||
if (bbfdm_validate_string_list(ctx, value, -1, -1, -1, -1, 256, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -749,7 +749,7 @@ static int set_IEEE1905ALForwardingTableForwardingRule_MACDestinationAddress(cha
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 17, NULL, MACAddress))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 17, NULL, MACAddress))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -772,7 +772,7 @@ static int set_IEEE1905ALForwardingTableForwardingRule_MACDestinationAddressFlag
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_boolean(value))
|
||||
if (bbfdm_validate_boolean(ctx, value))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -794,7 +794,7 @@ static int set_IEEE1905ALForwardingTableForwardingRule_MACSourceAddress(char *re
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 17, NULL, MACAddress))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 17, NULL, MACAddress))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -817,7 +817,7 @@ static int set_IEEE1905ALForwardingTableForwardingRule_MACSourceAddressFlag(char
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_boolean(value))
|
||||
if (bbfdm_validate_boolean(ctx, value))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -839,7 +839,7 @@ static int set_IEEE1905ALForwardingTableForwardingRule_EtherType(char *refparam,
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_unsignedInt(value, RANGE_ARGS{{NULL,NULL}}, 1))
|
||||
if (bbfdm_validate_unsignedInt(ctx, value, RANGE_ARGS{{NULL,NULL}}, 1))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -862,7 +862,7 @@ static int set_IEEE1905ALForwardingTableForwardingRule_EtherTypeFlag(char *refpa
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_boolean(value))
|
||||
if (bbfdm_validate_boolean(ctx, value))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -884,7 +884,7 @@ static int set_IEEE1905ALForwardingTableForwardingRule_Vid(char *refparam, struc
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_unsignedInt(value, RANGE_ARGS{{"0","4095"}}, 1))
|
||||
if (bbfdm_validate_unsignedInt(ctx, value, RANGE_ARGS{{"0","4095"}}, 1))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -907,7 +907,7 @@ static int set_IEEE1905ALForwardingTableForwardingRule_VidFlag(char *refparam, s
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_boolean(value))
|
||||
if (bbfdm_validate_boolean(ctx, value))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -929,7 +929,7 @@ static int set_IEEE1905ALForwardingTableForwardingRule_PCP(char *refparam, struc
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_unsignedInt(value, RANGE_ARGS{{"0","7"}}, 1))
|
||||
if (bbfdm_validate_unsignedInt(ctx, value, RANGE_ARGS{{"0","7"}}, 1))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -952,7 +952,7 @@ static int set_IEEE1905ALForwardingTableForwardingRule_PCPFlag(char *refparam, s
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_boolean(value))
|
||||
if (bbfdm_validate_boolean(ctx, value))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -973,7 +973,7 @@ static int set_IEEE1905ALNetworkTopology_Enable(char *refparam, struct dmctx *ct
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_boolean(value))
|
||||
if (bbfdm_validate_boolean(ctx, value))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -1002,7 +1002,7 @@ static int set_IEEE1905ALNetworkTopology_MaxChangeLogEntries(char *refparam, str
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_unsignedInt(value, RANGE_ARGS{{"1",NULL}}, 1))
|
||||
if (bbfdm_validate_unsignedInt(ctx, value, RANGE_ARGS{{"1",NULL}}, 1))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -1554,7 +1554,7 @@ static int set_IEEE1905ALSecurity_SetupMethod(char *refparam, struct dmctx *ctx,
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string_list(value, -1, -1, 1024, -1, -1, NULL, NULL))
|
||||
if (bbfdm_validate_string_list(ctx, value, -1, -1, 1024, -1, -1, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -1568,7 +1568,7 @@ static int set_IEEE1905ALSecurity_Password(char *refparam, struct dmctx *ctx, vo
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, -1, NULL, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, -1, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
|
|||
|
|
@ -630,7 +630,7 @@ static int set_InterfaceStack_Alias(char *refparam, struct dmctx *ctx, void *dat
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 64, NULL, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 64, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
|
|||
|
|
@ -1099,7 +1099,7 @@ static int set_IP_IPv6Enable(char *refparam, struct dmctx *ctx, void *data, char
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_boolean(value))
|
||||
if (bbfdm_validate_boolean(ctx, value))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -1128,7 +1128,7 @@ static int set_IP_ULAPrefix(char *refparam, struct dmctx *ctx, void *data, char
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 49, NULL, IPv6Prefix))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 49, NULL, IPv6Prefix))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -1176,7 +1176,7 @@ static int set_IPInterface_Enable(char *refparam, struct dmctx *ctx, void *data,
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_boolean(value))
|
||||
if (bbfdm_validate_boolean(ctx, value))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -1205,7 +1205,7 @@ static int set_IPInterface_IPv6Enable(char *refparam, struct dmctx *ctx, void *d
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_boolean(value))
|
||||
if (bbfdm_validate_boolean(ctx, value))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -1230,7 +1230,7 @@ static int set_IPInterface_ULAEnable(char *refparam, struct dmctx *ctx, void *da
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_boolean(value))
|
||||
if (bbfdm_validate_boolean(ctx, value))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -1265,7 +1265,7 @@ static int set_IPInterface_Alias(char *refparam, struct dmctx *ctx, void *data,
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 64, NULL, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 64, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -1347,7 +1347,7 @@ static int set_IPInterface_LowerLayers(char *refparam, struct dmctx *ctx, void *
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string_list(value, -1, -1, 1024, -1, -1, NULL, NULL))
|
||||
if (bbfdm_validate_string_list(ctx, value, -1, -1, 1024, -1, -1, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
|
||||
if (dm_entry_validate_allowed_objects(ctx, value, allowed_objects))
|
||||
|
|
@ -1424,7 +1424,7 @@ static int set_IPInterface_Router(char *refparam, struct dmctx *ctx, void *data,
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 256, NULL, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 256, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
|
||||
if (dm_entry_validate_allowed_objects(ctx, value, allowed_objects))
|
||||
|
|
@ -1463,7 +1463,7 @@ static int set_IPInterface_Reset(char *refparam, struct dmctx *ctx, void *data,
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_boolean(value))
|
||||
if (bbfdm_validate_boolean(ctx, value))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -1490,7 +1490,7 @@ static int set_IPInterface_MaxMTUSize(char *refparam, struct dmctx *ctx, void *d
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_unsignedInt(value, RANGE_ARGS{{"64","65535"}}, 1))
|
||||
if (bbfdm_validate_unsignedInt(ctx, value, RANGE_ARGS{{"64","65535"}}, 1))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -1516,7 +1516,7 @@ static int set_IPInterface_Loopback(char *refparam, struct dmctx *ctx, void *dat
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_boolean(value))
|
||||
if (bbfdm_validate_boolean(ctx, value))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -1559,7 +1559,7 @@ static int set_IPInterfaceIPv4Address_Enable(char *refparam, struct dmctx *ctx,
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_boolean(value))
|
||||
if (bbfdm_validate_boolean(ctx, value))
|
||||
return FAULT_9007;
|
||||
|
||||
dmuci_get_value_by_section_string(((struct intf_ip_args *)data)->interface_sec, "proto", &proto);
|
||||
|
|
@ -1613,7 +1613,7 @@ static int set_IPInterfaceIPv4Address_Alias(char *refparam, struct dmctx *ctx, v
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 64, NULL, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 64, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -1635,7 +1635,7 @@ static int set_IPInterfaceIPv4Address_IPAddress(char *refparam, struct dmctx *ct
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 15, NULL, IPv4Address))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 15, NULL, IPv4Address))
|
||||
return FAULT_9007;
|
||||
|
||||
dmuci_get_value_by_section_string(((struct intf_ip_args *)data)->interface_sec, "proto", &proto);
|
||||
|
|
@ -1672,7 +1672,7 @@ static int set_IPInterfaceIPv4Address_SubnetMask(char *refparam, struct dmctx *c
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 15, NULL, IPv4Address))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 15, NULL, IPv4Address))
|
||||
return FAULT_9007;
|
||||
|
||||
dmuci_get_value_by_section_string(((struct intf_ip_args *)data)->interface_sec, "proto", &proto);
|
||||
|
|
@ -1740,7 +1740,7 @@ static int set_IPInterfaceIPv6Address_Enable(char *refparam, struct dmctx *ctx,
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_boolean(value))
|
||||
if (bbfdm_validate_boolean(ctx, value))
|
||||
return FAULT_9007;
|
||||
|
||||
dmuci_get_value_by_section_string(((struct intf_ip_args *)data)->dmmap_sec, "assign", &assign);
|
||||
|
|
@ -1794,7 +1794,7 @@ static int set_IPInterfaceIPv6Address_Alias(char *refparam, struct dmctx *ctx, v
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 64, NULL, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 64, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -1819,7 +1819,7 @@ static int set_IPInterfaceIPv6Address_IPAddress(char *refparam, struct dmctx *ct
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 45, NULL, IPv6Address))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 45, NULL, IPv6Address))
|
||||
return FAULT_9007;
|
||||
|
||||
dmuci_get_value_by_section_string(((struct intf_ip_args *)data)->dmmap_sec, "assign", &assign);
|
||||
|
|
@ -1891,7 +1891,7 @@ static int set_IPInterfaceIPv6Address_Prefix(char *refparam, struct dmctx *ctx,
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, -1, NULL, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, -1, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -1921,7 +1921,7 @@ static int set_IPInterfaceIPv6Address_PreferredLifetime(char *refparam, struct d
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_dateTime(value))
|
||||
if (bbfdm_validate_dateTime(ctx, value))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -1951,7 +1951,7 @@ static int set_IPInterfaceIPv6Address_ValidLifetime(char *refparam, struct dmctx
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_dateTime(value))
|
||||
if (bbfdm_validate_dateTime(ctx, value))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -1977,7 +1977,7 @@ static int set_IPInterfaceIPv6Prefix_Enable(char *refparam, struct dmctx *ctx, v
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_boolean(value))
|
||||
if (bbfdm_validate_boolean(ctx, value))
|
||||
return FAULT_9007;
|
||||
|
||||
dmuci_get_value_by_section_string(((struct intf_ip_args *)data)->interface_sec, "proto", &proto);
|
||||
|
|
@ -2023,7 +2023,7 @@ static int set_IPInterfaceIPv6Prefix_Alias(char *refparam, struct dmctx *ctx, vo
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 64, NULL, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 64, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -2046,7 +2046,7 @@ static int set_IPInterfaceIPv6Prefix_Prefix(char *refparam, struct dmctx *ctx, v
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 49, NULL, IPv6Prefix))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 49, NULL, IPv6Prefix))
|
||||
return FAULT_9007;
|
||||
|
||||
dmuci_get_value_by_section_string(((struct intf_ip_args *)data)->interface_sec, "proto", &proto);
|
||||
|
|
@ -2092,7 +2092,7 @@ static int set_IPInterfaceIPv6Prefix_ParentPrefix(char *refparam, struct dmctx *
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, -1, NULL, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, -1, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -2119,7 +2119,7 @@ static int set_IPInterfaceIPv6Prefix_ChildPrefixBits(char *refparam, struct dmct
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 49, NULL, IPv6Prefix))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 49, NULL, IPv6Prefix))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -2144,7 +2144,7 @@ static int set_IPInterfaceIPv6Prefix_PreferredLifetime(char *refparam, struct dm
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_dateTime(value))
|
||||
if (bbfdm_validate_dateTime(ctx, value))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -2169,7 +2169,7 @@ static int set_IPInterfaceIPv6Prefix_ValidLifetime(char *refparam, struct dmctx
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_dateTime(value))
|
||||
if (bbfdm_validate_dateTime(ctx, value))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ static int set_LANConfigSecurity_ConfigPassword(char *refparam, struct dmctx *ct
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 64, NULL, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 64, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
|
|||
|
|
@ -112,7 +112,7 @@ static int set_MQTTBroker_Alias(char *refparam, struct dmctx *ctx, void *data, c
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 64, NULL, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 64, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -133,7 +133,7 @@ static int set_MQTTBroker_Enable(char *refparam, struct dmctx *ctx, void *data,
|
|||
bool b;
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_boolean(value))
|
||||
if (bbfdm_validate_boolean(ctx, value))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -156,12 +156,14 @@ static int set_MQTTBroker_Name(char *refparam, struct dmctx *ctx, void *data, ch
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 64, NULL, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 64, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
|
||||
// Check if the value is empty
|
||||
if (*value == '\0')
|
||||
if (*value == '\0') {
|
||||
bbfdm_set_fault_message(ctx, "Entry name should not be blank.");
|
||||
return FAULT_9007;
|
||||
}
|
||||
|
||||
// Check if new name is same as current name
|
||||
curr_name = section_name(((struct dmmap_dup *)data)->config_section);
|
||||
|
|
@ -169,8 +171,10 @@ static int set_MQTTBroker_Name(char *refparam, struct dmctx *ctx, void *data, ch
|
|||
break;
|
||||
|
||||
// check if duplicate entry already exists
|
||||
if (duplicate_entry_exist(value, "listener"))
|
||||
if (duplicate_entry_exist(value, "listener")) {
|
||||
bbfdm_set_fault_message(ctx, "Entry name '%s' is already exist.", value);
|
||||
return FAULT_9001;
|
||||
}
|
||||
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -180,8 +184,10 @@ static int set_MQTTBroker_Name(char *refparam, struct dmctx *ctx, void *data, ch
|
|||
break;
|
||||
|
||||
// Update mosquitto config
|
||||
if (0 != dmuci_rename_section_by_section(((struct dmmap_dup *)data)->config_section, value))
|
||||
if (0 != dmuci_rename_section_by_section(((struct dmmap_dup *)data)->config_section, value)) {
|
||||
bbfdm_set_fault_message(ctx, "Rename the entry name with '%s' value was failed.", value);
|
||||
return FAULT_9001;
|
||||
}
|
||||
|
||||
// Update dmmap_mqtt file
|
||||
dmuci_set_value_by_section(((struct dmmap_dup *)data)->dmmap_section, "section_name", value);
|
||||
|
|
@ -201,7 +207,7 @@ static int set_MQTTBroker_Port(char *refparam, struct dmctx *ctx, void *data, ch
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_unsignedInt(value, RANGE_ARGS{{"1",NULL}}, 1))
|
||||
if (bbfdm_validate_unsignedInt(ctx, value, RANGE_ARGS{{"1",NULL}}, 1))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -230,7 +236,7 @@ static int set_MQTTBroker_Interface(char *refparam, struct dmctx *ctx, void *dat
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 256, NULL, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 256, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
|
||||
if (dm_entry_validate_allowed_objects(ctx, value, allowed_objects))
|
||||
|
|
@ -256,12 +262,15 @@ static int set_MQTTBroker_Username(char *refparam, struct dmctx *ctx, void *data
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 64, NULL, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 64, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
|
||||
// Check if the value is empty
|
||||
if (*value == '\0')
|
||||
if (*value == '\0') {
|
||||
bbfdm_set_fault_message(ctx, "Username value should not be blank.");
|
||||
return FAULT_9007;
|
||||
}
|
||||
|
||||
break;
|
||||
case VALUESET:
|
||||
dmuci_set_value_by_section(((struct dmmap_dup *)data)->config_section, "username", value);
|
||||
|
|
@ -280,7 +289,7 @@ static int set_MQTTBroker_Password(char *refparam, struct dmctx *ctx, void *data
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 64, NULL, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 64, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
|
|||
|
|
@ -194,7 +194,7 @@ static int set_nat_interface_setting_enable(char *refparam, struct dmctx *ctx, v
|
|||
bool b;
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_boolean(value))
|
||||
if (bbfdm_validate_boolean(ctx, value))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -227,7 +227,7 @@ static int set_nat_interface_setting_alias(char *refparam, struct dmctx *ctx, vo
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 64, NULL, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 64, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -271,7 +271,7 @@ static int set_nat_interface_setting_interface(char *refparam, struct dmctx *ctx
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 256, NULL, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 256, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
|
||||
if (dm_entry_validate_allowed_objects(ctx, value, allowed_objects))
|
||||
|
|
@ -303,7 +303,7 @@ static int set_nat_port_mapping_enable(char *refparam, struct dmctx *ctx, void *
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_boolean(value))
|
||||
if (bbfdm_validate_boolean(ctx, value))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -335,7 +335,7 @@ static int set_nat_port_mapping_alias(char *refparam, struct dmctx *ctx, void *d
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 64, NULL, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 64, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -392,7 +392,7 @@ static int set_nat_port_mapping_interface(char *refparam, struct dmctx *ctx, voi
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 256, NULL, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 256, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
|
||||
if (dm_entry_validate_allowed_objects(ctx, value, allowed_objects))
|
||||
|
|
@ -453,7 +453,7 @@ static int set_nat_port_mapping_all_interface(char *refparam, struct dmctx *ctx,
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_boolean(value))
|
||||
if (bbfdm_validate_boolean(ctx, value))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -489,7 +489,7 @@ static int set_nat_port_mapping_lease_duration(char *refparam, struct dmctx *ctx
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_unsignedInt(value, RANGE_ARGS{{NULL,NULL}}, 1))
|
||||
if (bbfdm_validate_unsignedInt(ctx, value, RANGE_ARGS{{NULL,NULL}}, 1))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -514,7 +514,7 @@ static int set_nat_port_mapping_remote_host(char *refparam, struct dmctx *ctx, v
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, -1, NULL, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, -1, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -551,12 +551,14 @@ static int set_nat_port_mapping_external_port(char *refparam, struct dmctx *ctx,
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_unsignedInt(value, RANGE_ARGS{{"0","65535"}}, 1))
|
||||
if (bbfdm_validate_unsignedInt(ctx, value, RANGE_ARGS{{"0","65535"}}, 1))
|
||||
return FAULT_9007;
|
||||
|
||||
start_port = DM_STRTOL(value);
|
||||
if (start_port && end_port && start_port > end_port)
|
||||
if (start_port && end_port && start_port > end_port) {
|
||||
bbfdm_set_fault_message(ctx, "The start port value '%s' should be lower than the end port value '%s'.", value, dport_end);
|
||||
return FAULT_9007;
|
||||
}
|
||||
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -594,14 +596,16 @@ static int set_nat_port_mapping_external_port_end_range(char *refparam, struct d
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_unsignedInt(value, RANGE_ARGS{{"0","65535"}}, 1))
|
||||
if (bbfdm_validate_unsignedInt(ctx, value, RANGE_ARGS{{"0","65535"}}, 1))
|
||||
return FAULT_9007;
|
||||
|
||||
dport = DM_STRTOL(value);
|
||||
|
||||
// Add check to check if the endrange > src_dport
|
||||
if (dport != 0 && dport < sport)
|
||||
if (dport != 0 && dport < sport) {
|
||||
bbfdm_set_fault_message(ctx, "The end port value '%s' should be greater than the start port value '%s'.", value, src_dport);
|
||||
return FAULT_9007;
|
||||
}
|
||||
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -634,7 +638,7 @@ static int set_nat_port_mapping_internal_port(char *refparam, struct dmctx *ctx,
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_unsignedInt(value, RANGE_ARGS{{"0","65535"}}, 1))
|
||||
if (bbfdm_validate_unsignedInt(ctx, value, RANGE_ARGS{{"0","65535"}}, 1))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -657,7 +661,7 @@ static int set_nat_port_mapping_protocol(char *refparam, struct dmctx *ctx, void
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, -1, NATProtocol, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, -1, NATProtocol, NULL))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -678,7 +682,7 @@ static int set_nat_port_mapping_internal_client(char *refparam, struct dmctx *ct
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 256, NULL, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 256, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -699,7 +703,7 @@ static int set_nat_port_mapping_description(char *refparam, struct dmctx *ctx, v
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 256, NULL, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 256, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
|
|||
|
|
@ -210,7 +210,7 @@ static int set_ppp_enable(char *refparam, struct dmctx *ctx, void *data, char *i
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_boolean(value))
|
||||
if (bbfdm_validate_boolean(ctx, value))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -243,7 +243,7 @@ static int set_ppp_alias(char *refparam, struct dmctx *ctx, void *data, char *in
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 64, NULL, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 64, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -281,7 +281,7 @@ static int set_PPPInterface_Reset(char *refparam, struct dmctx *ctx, void *data,
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_boolean(value))
|
||||
if (bbfdm_validate_boolean(ctx, value))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -398,7 +398,7 @@ static int set_ppp_username(char *refparam, struct dmctx *ctx, void *data, char
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 64, NULL, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 64, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -417,7 +417,7 @@ static int set_ppp_password(char *refparam, struct dmctx *ctx, void *data, char
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 64, NULL, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 64, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -502,7 +502,7 @@ static int set_PPPInterface_MaxMRUSize(char *refparam, struct dmctx *ctx, void *
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_unsignedInt(value, RANGE_ARGS{{"64","65535"}}, 1))
|
||||
if (bbfdm_validate_unsignedInt(ctx, value, RANGE_ARGS{{"64","65535"}}, 1))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -694,7 +694,7 @@ static int set_PPPInterface_IPCPEnable(char *refparam, struct dmctx *ctx, void *
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_boolean(value))
|
||||
if (bbfdm_validate_boolean(ctx, value))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -722,7 +722,7 @@ static int set_PPPInterface_IPv6CPEnable(char *refparam, struct dmctx *ctx, void
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_boolean(value))
|
||||
if (bbfdm_validate_boolean(ctx, value))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -1041,7 +1041,7 @@ static int set_ppp_lower_layer(char *refparam, struct dmctx *ctx, void *data, ch
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string_list(value, -1, -1, 1024, -1, -1, NULL, NULL))
|
||||
if (bbfdm_validate_string_list(ctx, value, -1, -1, 1024, -1, -1, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
|
||||
if (dm_entry_validate_allowed_objects(ctx, value, allowed_objects))
|
||||
|
|
@ -1112,7 +1112,7 @@ static int set_PPPInterfacePPPoE_ACName(char *refparam, struct dmctx *ctx, void
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 256, NULL, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 256, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
|
||||
dmuci_get_value_by_section_string(ppp->iface_s ? ppp->iface_s : ppp->dmmap_s, "proto", &proto_intf);
|
||||
|
|
@ -1149,7 +1149,7 @@ static int set_PPPInterfacePPPoE_ServiceName(char *refparam, struct dmctx *ctx,
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 256, NULL, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 256, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
|
||||
dmuci_get_value_by_section_string(ppp->iface_s ? ppp->iface_s : ppp->dmmap_s, "proto", &proto);
|
||||
|
|
|
|||
|
|
@ -135,7 +135,7 @@ static int set_ptm_enable(char *refparam, struct dmctx *ctx, void *data, char *i
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_boolean(value))
|
||||
if (bbfdm_validate_boolean(ctx, value))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -165,7 +165,7 @@ static int set_ptm_alias(char *refparam, struct dmctx *ctx, void *data, char *in
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 64, NULL, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 64, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
|
|||
|
|
@ -412,7 +412,7 @@ static int set_QInterface(char *refparam, struct dmctx *ctx, void *data, char *i
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 256, NULL, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 256, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
|
||||
if (dm_entry_validate_allowed_objects(ctx, value, allowed_objects))
|
||||
|
|
@ -527,7 +527,7 @@ static int set_QoSClassification_Enable(char *refparam, struct dmctx *ctx, void
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_boolean(value))
|
||||
if (bbfdm_validate_boolean(ctx, value))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -550,7 +550,7 @@ static int set_QoSClassification_Order(char *refparam, struct dmctx *ctx, void *
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_unsignedInt(value, RANGE_ARGS{{NULL,NULL}}, 1))
|
||||
if (bbfdm_validate_unsignedInt(ctx, value, RANGE_ARGS{{NULL,NULL}}, 1))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -585,7 +585,7 @@ static int set_QoSClassification_DestMask(char *refparam, struct dmctx *ctx, voi
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 49 , NULL, IPPrefix))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 49 , NULL, IPPrefix))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -635,7 +635,7 @@ static int set_QoSClassification_SourceMask(char *refparam, struct dmctx *ctx, v
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 49 , NULL, IPPrefix))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 49 , NULL, IPPrefix))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -676,7 +676,7 @@ static int set_QoSClassification_Alias(char *refparam, struct dmctx *ctx, void *
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 64, NULL, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 64, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -717,7 +717,7 @@ static int set_QoSClassification_DestIP(char *refparam, struct dmctx *ctx, void
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 45 , NULL, IPAddress))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 45 , NULL, IPAddress))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -766,7 +766,7 @@ static int set_QoSClassification_SourceIP(char *refparam, struct dmctx *ctx, voi
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 45 , NULL, IPAddress))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 45 , NULL, IPAddress))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -804,7 +804,7 @@ static int set_QoSClassification_Protocol(char *refparam, struct dmctx *ctx, voi
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_int(value, RANGE_ARGS{{"-1","255"}}, 1))
|
||||
if (bbfdm_validate_int(ctx, value, RANGE_ARGS{{"-1","255"}}, 1))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -825,7 +825,7 @@ static int set_QoSClassification_DestPort(char *refparam, struct dmctx *ctx, voi
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_int(value, RANGE_ARGS{{"-1","65535"}}, 1))
|
||||
if (bbfdm_validate_int(ctx, value, RANGE_ARGS{{"-1","65535"}}, 1))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -845,7 +845,7 @@ static int set_QoSClassification_DestPortRangeMax(char *refparam, struct dmctx *
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_int(value, RANGE_ARGS{{"-1","65535"}}, 1))
|
||||
if (bbfdm_validate_int(ctx, value, RANGE_ARGS{{"-1","65535"}}, 1))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -865,7 +865,7 @@ static int set_QoSClassification_SourcePort(char *refparam, struct dmctx *ctx, v
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_int(value, RANGE_ARGS{{"-1","65535"}}, 1))
|
||||
if (bbfdm_validate_int(ctx, value, RANGE_ARGS{{"-1","65535"}}, 1))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -885,7 +885,7 @@ static int set_QoSClassification_SourcePortRangeMax(char *refparam, struct dmctx
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_int(value, RANGE_ARGS{{"-1","65535"}}, 1))
|
||||
if (bbfdm_validate_int(ctx, value, RANGE_ARGS{{"-1","65535"}}, 1))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -905,7 +905,7 @@ static int set_QoSClassification_SourceMACAddress(char *refparam, struct dmctx *
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 17, NULL, MACAddress))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 17, NULL, MACAddress))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -925,7 +925,7 @@ static int set_QoSClassification_DestMACAddress(char *refparam, struct dmctx *ct
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 17, NULL, MACAddress))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 17, NULL, MACAddress))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -945,7 +945,7 @@ static int set_QoSClassification_Ethertype(char *refparam, struct dmctx *ctx, vo
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_int(value, RANGE_ARGS{{"-1",NULL}}, 1))
|
||||
if (bbfdm_validate_int(ctx, value, RANGE_ARGS{{"-1",NULL}}, 1))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -965,7 +965,7 @@ static int set_QoSClassification_SourceVendorClassID(char *refparam, struct dmct
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 255, NULL, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 255, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -985,7 +985,7 @@ static int set_QoSClassification_DestVendorClassID(char *refparam, struct dmctx
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 255, NULL, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 255, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -1014,7 +1014,7 @@ static int set_QoSClassification_SourceClientID(char *refparam, struct dmctx *ct
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_hexBinary(value, RANGE_ARGS{{NULL,"65535"}}, 1))
|
||||
if (bbfdm_validate_hexBinary(ctx, value, RANGE_ARGS{{NULL,"65535"}}, 1))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -1044,7 +1044,7 @@ static int set_QoSClassification_DestClientID(char *refparam, struct dmctx *ctx,
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_hexBinary(value, RANGE_ARGS{{NULL,"65535"}}, 1))
|
||||
if (bbfdm_validate_hexBinary(ctx, value, RANGE_ARGS{{NULL,"65535"}}, 1))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -1074,7 +1074,7 @@ static int set_QoSClassification_SourceUserClassID(char *refparam, struct dmctx
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_hexBinary(value, RANGE_ARGS{{NULL,"65535"}}, 1))
|
||||
if (bbfdm_validate_hexBinary(ctx, value, RANGE_ARGS{{NULL,"65535"}}, 1))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -1104,7 +1104,7 @@ static int set_QoSClassification_DestUserClassID(char *refparam, struct dmctx *c
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_hexBinary(value, RANGE_ARGS{{NULL,"65535"}}, 1))
|
||||
if (bbfdm_validate_hexBinary(ctx, value, RANGE_ARGS{{NULL,"65535"}}, 1))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -1125,7 +1125,7 @@ static int set_QoSClassification_IPLengthMin(char *refparam, struct dmctx *ctx,
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_int(value, RANGE_ARGS{{"0",NULL}}, 1))
|
||||
if (bbfdm_validate_int(ctx, value, RANGE_ARGS{{"0",NULL}}, 1))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -1145,7 +1145,7 @@ static int set_QoSClassification_IPLengthMax(char *refparam, struct dmctx *ctx,
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_int(value, RANGE_ARGS{{"0",NULL}}, 1))
|
||||
if (bbfdm_validate_int(ctx, value, RANGE_ARGS{{"0",NULL}}, 1))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -1165,7 +1165,7 @@ static int set_QoSClassification_DSCPCheck(char *refparam, struct dmctx *ctx, vo
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_int(value, RANGE_ARGS{{"-1","63"}}, 1))
|
||||
if (bbfdm_validate_int(ctx, value, RANGE_ARGS{{"-1","63"}}, 1))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -1186,7 +1186,7 @@ static int set_QoSClassification_DSCPMark(char *refparam, struct dmctx *ctx, voi
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_int(value, RANGE_ARGS{{"-2",NULL}}, 1))
|
||||
if (bbfdm_validate_int(ctx, value, RANGE_ARGS{{"-2",NULL}}, 1))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -1205,7 +1205,7 @@ static int set_QoSClassification_EthernetPriorityCheck(char *refparam, struct dm
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_int(value, RANGE_ARGS{{"-1",NULL}}, 1))
|
||||
if (bbfdm_validate_int(ctx, value, RANGE_ARGS{{"-1",NULL}}, 1))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -1225,7 +1225,7 @@ static int set_QoSClassification_VLANIDCheck(char *refparam, struct dmctx *ctx,
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_int(value, RANGE_ARGS{{"-1",NULL}}, 1))
|
||||
if (bbfdm_validate_int(ctx, value, RANGE_ARGS{{"-1",NULL}}, 1))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -1245,7 +1245,7 @@ static int set_QoSClassification_ForwardingPolicy(char *refparam, struct dmctx *
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_int(value, RANGE_ARGS{{"-1",NULL}}, 1))
|
||||
if (bbfdm_validate_int(ctx, value, RANGE_ARGS{{"-1",NULL}}, 1))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -1265,7 +1265,7 @@ static int set_QoSClassification_TrafficClass(char *refparam, struct dmctx *ctx,
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_int(value, RANGE_ARGS{{"-1",NULL}}, 1))
|
||||
if (bbfdm_validate_int(ctx, value, RANGE_ARGS{{"-1",NULL}}, 1))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -1298,7 +1298,7 @@ static int set_QoSClassification_Policer(char *refparam, struct dmctx *ctx, void
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 64, NULL, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 64, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -1327,7 +1327,7 @@ static int set_QoSPolicer_Enable(char *refparam, struct dmctx *ctx, void *data,
|
|||
bool b;
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_boolean(value))
|
||||
if (bbfdm_validate_boolean(ctx, value))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -1357,7 +1357,7 @@ static int set_QoSPolicer_Alias(char *refparam, struct dmctx *ctx, void *data, c
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 64, NULL, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 64, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -1377,7 +1377,7 @@ static int set_QoSPolicer_CommittedRate(char *refparam, struct dmctx *ctx, void
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_unsignedInt(value, RANGE_ARGS{{NULL,NULL}}, 1))
|
||||
if (bbfdm_validate_unsignedInt(ctx, value, RANGE_ARGS{{NULL,NULL}}, 1))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -1397,7 +1397,7 @@ static int set_QoSPolicer_CommittedBurstSize(char *refparam, struct dmctx *ctx,
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_unsignedInt(value, RANGE_ARGS{{NULL,NULL}}, 1))
|
||||
if (bbfdm_validate_unsignedInt(ctx, value, RANGE_ARGS{{NULL,NULL}}, 1))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -1417,7 +1417,7 @@ static int set_QoSPolicer_ExcessBurstSize(char *refparam, struct dmctx *ctx, voi
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_unsignedInt(value, RANGE_ARGS{{NULL,NULL}}, 1))
|
||||
if (bbfdm_validate_unsignedInt(ctx, value, RANGE_ARGS{{NULL,NULL}}, 1))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -1437,7 +1437,7 @@ static int set_QoSPolicer_PeakRate(char *refparam, struct dmctx *ctx, void *data
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_unsignedInt(value, RANGE_ARGS{{NULL,NULL}}, 1))
|
||||
if (bbfdm_validate_unsignedInt(ctx, value, RANGE_ARGS{{NULL,NULL}}, 1))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -1457,7 +1457,7 @@ static int set_QoSPolicer_PeakBurstSize(char *refparam, struct dmctx *ctx, void
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_unsignedInt(value, RANGE_ARGS{{NULL,NULL}}, 1))
|
||||
if (bbfdm_validate_unsignedInt(ctx, value, RANGE_ARGS{{NULL,NULL}}, 1))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -1516,7 +1516,7 @@ static int set_QoSQueue_Enable(char *refparam, struct dmctx *ctx, void *data, ch
|
|||
bool b;
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_boolean(value))
|
||||
if (bbfdm_validate_boolean(ctx, value))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -1546,7 +1546,7 @@ static int set_QoSQueue_Alias(char *refparam, struct dmctx *ctx, void *data, cha
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 64, NULL, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 64, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -1594,7 +1594,7 @@ static int set_QoSQueue_Weight(char *refparam, struct dmctx *ctx, void *data, ch
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_unsignedInt(value, RANGE_ARGS{{NULL,NULL}}, 1))
|
||||
if (bbfdm_validate_unsignedInt(ctx, value, RANGE_ARGS{{NULL,NULL}}, 1))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -1615,7 +1615,7 @@ static int set_QoSQueue_Precedence(char *refparam, struct dmctx *ctx, void *data
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_unsignedInt(value, RANGE_ARGS{{"1",NULL}}, 1))
|
||||
if (bbfdm_validate_unsignedInt(ctx, value, RANGE_ARGS{{"1",NULL}}, 1))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -1635,7 +1635,7 @@ static int set_QoSQueue_SchedulerAlgorithm(char *refparam, struct dmctx *ctx, vo
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, -1, SchedulerAlgorithm, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, -1, SchedulerAlgorithm, NULL))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -1657,7 +1657,7 @@ static int set_QoSQueue_ShapingRate(char *refparam, struct dmctx *ctx, void *dat
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_int(value, RANGE_ARGS{{"-1",NULL}}, 1))
|
||||
if (bbfdm_validate_int(ctx, value, RANGE_ARGS{{"-1",NULL}}, 1))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -1677,7 +1677,7 @@ static int set_QoSQueue_ShapingBurstSize(char *refparam, struct dmctx *ctx, void
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_unsignedInt(value, RANGE_ARGS{{NULL,NULL}}, 1))
|
||||
if (bbfdm_validate_unsignedInt(ctx, value, RANGE_ARGS{{NULL,NULL}}, 1))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -1699,7 +1699,7 @@ static int set_QoSQueueStats_Enable(char *refparam, struct dmctx *ctx, void *dat
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_boolean(value))
|
||||
if (bbfdm_validate_boolean(ctx, value))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -1730,7 +1730,7 @@ static int set_QoSQueueStats_Alias(char *refparam, struct dmctx *ctx, void *data
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 64, NULL, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 64, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -1756,7 +1756,7 @@ static int set_QoSQueueStats_Queue(char *refparam, struct dmctx *ctx, void *data
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 256, NULL, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 256, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
|
||||
if (dm_entry_validate_allowed_objects(ctx, value, allowed_objects))
|
||||
|
|
@ -1796,7 +1796,7 @@ static int set_QoSQueueStats_Interface(char *refparam, struct dmctx *ctx, void *
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 256, NULL, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 256, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
|
||||
if (dm_entry_validate_allowed_objects(ctx, value, allowed_objects))
|
||||
|
|
@ -1863,7 +1863,7 @@ static int set_QoSShaper_Enable(char *refparam, struct dmctx *ctx, void *data, c
|
|||
bool b;
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_boolean(value))
|
||||
if (bbfdm_validate_boolean(ctx, value))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -1893,7 +1893,7 @@ static int set_QoSShaper_Alias(char *refparam, struct dmctx *ctx, void *data, ch
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 64, NULL, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 64, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -1923,7 +1923,7 @@ static int set_QoSShaper_ShapingRate(char *refparam, struct dmctx *ctx, void *da
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_int(value, RANGE_ARGS{{"-1",NULL}}, 1))
|
||||
if (bbfdm_validate_int(ctx, value, RANGE_ARGS{{"-1",NULL}}, 1))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -1943,7 +1943,7 @@ static int set_QoSShaper_ShapingBurstSize(char *refparam, struct dmctx *ctx, voi
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_unsignedInt(value, RANGE_ARGS{{NULL,NULL}}, 1))
|
||||
if (bbfdm_validate_unsignedInt(ctx, value, RANGE_ARGS{{NULL,NULL}}, 1))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
|
|||
|
|
@ -203,7 +203,7 @@ static int set_RouterAdvertisement_Enable(char *refparam, struct dmctx *ctx, voi
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_boolean(value))
|
||||
if (bbfdm_validate_boolean(ctx, value))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -235,7 +235,7 @@ static int set_RouterAdvertisementInterfaceSetting_Enable(char *refparam, struct
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_boolean(value))
|
||||
if (bbfdm_validate_boolean(ctx, value))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -266,7 +266,7 @@ static int set_RouterAdvertisementInterfaceSetting_Alias(char *refparam, struct
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 64, NULL, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 64, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -293,7 +293,7 @@ static int set_RouterAdvertisementInterfaceSetting_Interface(char *refparam, str
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, -1, NULL, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, -1, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
|
||||
if (dm_entry_validate_allowed_objects(ctx, value, allowed_objects))
|
||||
|
|
@ -358,7 +358,7 @@ static int set_RouterAdvertisementInterfaceSetting_MaxRtrAdvInterval(char *refpa
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_unsignedInt(value, RANGE_ARGS{{"4","1800"}}, 1))
|
||||
if (bbfdm_validate_unsignedInt(ctx, value, RANGE_ARGS{{"4","1800"}}, 1))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -379,7 +379,7 @@ static int set_RouterAdvertisementInterfaceSetting_MinRtrAdvInterval(char *refpa
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_unsignedInt(value, RANGE_ARGS{{"3","1350"}}, 1))
|
||||
if (bbfdm_validate_unsignedInt(ctx, value, RANGE_ARGS{{"3","1350"}}, 1))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -400,7 +400,7 @@ static int set_RouterAdvertisementInterfaceSetting_AdvDefaultLifetime(char *refp
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_unsignedInt(value, RANGE_ARGS{{NULL,"65535"}}, 1))
|
||||
if (bbfdm_validate_unsignedInt(ctx, value, RANGE_ARGS{{NULL,"65535"}}, 1))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -422,7 +422,7 @@ static int set_RouterAdvertisementInterfaceSetting_AdvManagedFlag(char *refparam
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_boolean(value))
|
||||
if (bbfdm_validate_boolean(ctx, value))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -444,7 +444,7 @@ static int set_RouterAdvertisementInterfaceSetting_AdvOtherConfigFlag(char *refp
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_boolean(value))
|
||||
if (bbfdm_validate_boolean(ctx, value))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -466,7 +466,7 @@ static int set_RouterAdvertisementInterfaceSetting_AdvMobileAgentFlag(char *refp
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_boolean(value))
|
||||
if (bbfdm_validate_boolean(ctx, value))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -490,7 +490,7 @@ static int set_RouterAdvertisementInterfaceSetting_AdvPreferredRouterFlag(char *
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, -1, AdvPreferredRouterFlag, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, -1, AdvPreferredRouterFlag, NULL))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -511,7 +511,7 @@ static int set_RouterAdvertisementInterfaceSetting_AdvLinkMTU(char *refparam, st
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_unsignedInt(value, RANGE_ARGS{{NULL,NULL}}, 1))
|
||||
if (bbfdm_validate_unsignedInt(ctx, value, RANGE_ARGS{{NULL,NULL}}, 1))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -532,7 +532,7 @@ static int set_RouterAdvertisementInterfaceSetting_AdvReachableTime(char *refpar
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_unsignedInt(value, RANGE_ARGS{{NULL,"3600000"}}, 1))
|
||||
if (bbfdm_validate_unsignedInt(ctx, value, RANGE_ARGS{{NULL,"3600000"}}, 1))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -553,7 +553,7 @@ static int set_RouterAdvertisementInterfaceSetting_AdvRetransTimer(char *refpara
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_unsignedInt(value, RANGE_ARGS{{NULL,NULL}}, 1))
|
||||
if (bbfdm_validate_unsignedInt(ctx, value, RANGE_ARGS{{NULL,NULL}}, 1))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -574,7 +574,7 @@ static int set_RouterAdvertisementInterfaceSetting_AdvCurHopLimit(char *refparam
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_unsignedInt(value, RANGE_ARGS{{NULL,"255"}}, 1))
|
||||
if (bbfdm_validate_unsignedInt(ctx, value, RANGE_ARGS{{NULL,"255"}}, 1))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -604,7 +604,7 @@ static int set_RouterAdvertisementInterfaceSettingOption_Enable(char *refparam,
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_boolean(value))
|
||||
if (bbfdm_validate_boolean(ctx, value))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -626,7 +626,7 @@ static int set_RouterAdvertisementInterfaceSettingOption_Alias(char *refparam, s
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 64, NULL, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 64, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -646,7 +646,7 @@ static int set_RouterAdvertisementInterfaceSettingOption_Tag(char *refparam, str
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_unsignedInt(value, RANGE_ARGS{{"0","65535"}}, 1))
|
||||
if (bbfdm_validate_unsignedInt(ctx, value, RANGE_ARGS{{"0","65535"}}, 1))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -675,7 +675,7 @@ static int set_RouterAdvertisementInterfaceSettingOption_Value(char *refparam, s
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_hexBinary(value, RANGE_ARGS{{"0","65535"}}, 1))
|
||||
if (bbfdm_validate_hexBinary(ctx, value, RANGE_ARGS{{"0","65535"}}, 1))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
|
|||
|
|
@ -545,7 +545,7 @@ static int set_RoutingRouter_Enable(char *refparam, struct dmctx *ctx, void *dat
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_boolean(value))
|
||||
if (bbfdm_validate_boolean(ctx, value))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -595,7 +595,7 @@ static int set_router_ipv4forwarding_enable(char *refparam, struct dmctx *ctx, v
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_boolean(value))
|
||||
if (bbfdm_validate_boolean(ctx, value))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -624,7 +624,7 @@ static int set_router_ipv4forwarding_destip(char *refparam, struct dmctx *ctx, v
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 15, NULL, IPv4Address))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 15, NULL, IPv4Address))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -645,7 +645,7 @@ static int set_router_ipv4forwarding_destmask(char *refparam, struct dmctx *ctx,
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 15, NULL, IPv4Address))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 15, NULL, IPv4Address))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -673,7 +673,7 @@ static int set_router_ipv4forwarding_forwarding_policy(char *refparam, struct dm
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_int(value, RANGE_ARGS{{"-1",NULL}}, 1))
|
||||
if (bbfdm_validate_int(ctx, value, RANGE_ARGS{{"-1",NULL}}, 1))
|
||||
return FAULT_9007;
|
||||
|
||||
uci_path_foreach_sections(bbfdm, "dmmap_routing", "router", s) {
|
||||
|
|
@ -684,6 +684,7 @@ static int set_router_ipv4forwarding_forwarding_policy(char *refparam, struct dm
|
|||
return 0;
|
||||
}
|
||||
|
||||
bbfdm_set_fault_message(ctx, "Route table '%s' value doesn't exist on the device. It's only allowed to set an available route table.");
|
||||
return FAULT_9007;
|
||||
case VALUESET:
|
||||
dmuci_set_value_by_section(((struct routingfwdargs *)data)->routefwdsection, "table", value);
|
||||
|
|
@ -723,7 +724,7 @@ static int set_router_ipv4forwarding_gatewayip(char *refparam, struct dmctx *ctx
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 15, NULL, IPv4Address))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 15, NULL, IPv4Address))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -749,7 +750,7 @@ static int set_RoutingRouterForwarding_Interface(char *refparam, struct dmctx *c
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 256, NULL, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 256, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
|
||||
if (dm_entry_validate_allowed_objects(ctx, value, allowed_objects))
|
||||
|
|
@ -775,7 +776,7 @@ static int set_router_ipv4forwarding_metric(char *refparam, struct dmctx *ctx, v
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_int(value, RANGE_ARGS{{"-1",NULL}}, 1))
|
||||
if (bbfdm_validate_int(ctx, value, RANGE_ARGS{{"-1",NULL}}, 1))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -804,7 +805,7 @@ static int set_RoutingRouterIPv6Forwarding_Enable(char *refparam, struct dmctx *
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_boolean(value))
|
||||
if (bbfdm_validate_boolean(ctx, value))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -833,7 +834,7 @@ static int set_RoutingRouterIPv6Forwarding_DestIPPrefix(char *refparam, struct d
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 49, NULL, IPv6Prefix))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 49, NULL, IPv6Prefix))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -855,7 +856,7 @@ static int set_RoutingRouterIPv6Forwarding_ForwardingPolicy(char *refparam, stru
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_int(value, RANGE_ARGS{{"-1",NULL}}, 1))
|
||||
if (bbfdm_validate_int(ctx, value, RANGE_ARGS{{"-1",NULL}}, 1))
|
||||
return FAULT_9007;
|
||||
|
||||
uci_path_foreach_sections(bbfdm, "dmmap_routing", "router", s) {
|
||||
|
|
@ -866,6 +867,7 @@ static int set_RoutingRouterIPv6Forwarding_ForwardingPolicy(char *refparam, stru
|
|||
return 0;
|
||||
}
|
||||
|
||||
bbfdm_set_fault_message(ctx, "Route table '%s' value doesn't exist on the device. It's only allowed to set an available route table.");
|
||||
return FAULT_9007;
|
||||
case VALUESET:
|
||||
dmuci_set_value_by_section(((struct routingfwdargs *)data)->routefwdsection, "table", value);
|
||||
|
|
@ -888,7 +890,7 @@ static int set_RoutingRouterIPv6Forwarding_NextHop(char *refparam, struct dmctx
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 45, NULL, IPv6Address))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 45, NULL, IPv6Address))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -915,7 +917,7 @@ static int set_RoutingRouterIPv6Forwarding_ForwardingMetric(char *refparam, stru
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_int(value, RANGE_ARGS{{"-1",NULL}}, 1))
|
||||
if (bbfdm_validate_int(ctx, value, RANGE_ARGS{{"-1",NULL}}, 1))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -941,7 +943,7 @@ static int set_RoutingRouteInformation_Enable(char *refparam, struct dmctx *ctx,
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_boolean(value))
|
||||
if (bbfdm_validate_boolean(ctx, value))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -1073,7 +1075,7 @@ static int set_RoutingRouter_Alias(char *refparam, struct dmctx *ctx, void *data
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 64, NULL, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 64, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -1106,7 +1108,7 @@ static int set_router_ipv4forwarding_alias(char *refparam, struct dmctx *ctx, vo
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 64, NULL, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 64, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -1144,7 +1146,7 @@ static int set_RoutingRouterIPv6Forwarding_Alias(char *refparam, struct dmctx *c
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 64, NULL, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 64, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -1194,8 +1196,10 @@ static int delete_router(char *refparam, struct dmctx *ctx, void *data, char *in
|
|||
switch (del_action) {
|
||||
case DEL_INST:
|
||||
dmuci_get_value_by_section_string((struct uci_section *)data, "rt_table", &rt_table);
|
||||
if(DM_LSTRCMP(rt_table, "254") == 0)
|
||||
break;
|
||||
if(DM_LSTRCMP(rt_table, "254") == 0) {
|
||||
bbfdm_set_fault_message(ctx, "It's not allowed to delete the main '254' routing table.");
|
||||
return FAULT_9003;
|
||||
}
|
||||
|
||||
uci_foreach_sections("network", "interface", s) {
|
||||
char *curr_rt_table = NULL;
|
||||
|
|
@ -1208,6 +1212,7 @@ static int delete_router(char *refparam, struct dmctx *ctx, void *data, char *in
|
|||
dmuci_delete_by_section((struct uci_section *)data, NULL, NULL);
|
||||
break;
|
||||
case DEL_ALL:
|
||||
bbfdm_set_fault_message(ctx, "It's not allowed to delete all routing tables since there are some routing tables defined by the system '/etc/iproute2/rt_tables'.");
|
||||
return FAULT_9005;
|
||||
}
|
||||
return 0;
|
||||
|
|
@ -1241,8 +1246,10 @@ static int delete_ipv4forwarding(char *refparam, struct dmctx *ctx, void *data,
|
|||
switch (del_action) {
|
||||
case DEL_INST:
|
||||
// Return 9008 error if the removed route is dynamic
|
||||
if (((struct routingfwdargs *)data)->type == ROUTE_DYNAMIC)
|
||||
if (((struct routingfwdargs *)data)->type == ROUTE_DYNAMIC) {
|
||||
bbfdm_set_fault_message(ctx, "This is a dynamic 'route' instance, therefore it's not permitted to delete it.");
|
||||
return FAULT_9008;
|
||||
}
|
||||
|
||||
// Remove dmmap section
|
||||
get_dmmap_section_of_config_section("dmmap_routing", "route", section_name(((struct routingfwdargs *)data)->routefwdsection), &dmmap_section);
|
||||
|
|
@ -1297,8 +1304,10 @@ static int delete_ipv6Forwarding(char *refparam, struct dmctx *ctx, void *data,
|
|||
switch (del_action) {
|
||||
case DEL_INST:
|
||||
// Return 9008 error if the removed route6 is dynamic
|
||||
if (((struct routingfwdargs *)data)->type == ROUTE_DYNAMIC)
|
||||
if (((struct routingfwdargs *)data)->type == ROUTE_DYNAMIC) {
|
||||
bbfdm_set_fault_message(ctx, "This is a dynamic 'route' instance, therefore it's not permitted to delete it.");
|
||||
return FAULT_9008;
|
||||
}
|
||||
|
||||
// Remove dmmap section
|
||||
get_dmmap_section_of_config_section("dmmap_routing", "route6", section_name(((struct routingfwdargs *)data)->routefwdsection), &dmmap_section);
|
||||
|
|
|
|||
|
|
@ -573,7 +573,7 @@ static int set_ssh_server_enable(char *refparam, struct dmctx *ctx, void *data,
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_boolean(value))
|
||||
if (bbfdm_validate_boolean(ctx, value))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -612,7 +612,7 @@ static int set_ssh_server_alias(char *refparam, struct dmctx *ctx, void *data, c
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 64, NULL, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 64, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -639,7 +639,7 @@ static int set_ssh_server_interface(char *refparam, struct dmctx *ctx, void *dat
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 256, NULL, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 256, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
|
||||
if (dm_entry_validate_allowed_objects(ctx, value, allowed_objects))
|
||||
|
|
@ -664,7 +664,7 @@ static int set_ssh_server_port(char *refparam, struct dmctx *ctx, void *data, ch
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_unsignedInt(value, RANGE_ARGS{{"1","65535"}},1))
|
||||
if (bbfdm_validate_unsignedInt(ctx, value, RANGE_ARGS{{"1","65535"}},1))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -684,7 +684,7 @@ static int set_ssh_server_idle(char *refparam, struct dmctx *ctx, void *data, ch
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_unsignedInt(value, RANGE_ARGS{{NULL,NULL}},1))
|
||||
if (bbfdm_validate_unsignedInt(ctx, value, RANGE_ARGS{{NULL,NULL}},1))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -704,7 +704,7 @@ static int set_ssh_server_keepalive(char *refparam, struct dmctx *ctx, void *dat
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_unsignedInt(value, RANGE_ARGS{{NULL,NULL}},1))
|
||||
if (bbfdm_validate_unsignedInt(ctx, value, RANGE_ARGS{{NULL,NULL}},1))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -726,7 +726,7 @@ static int set_ssh_server_rootlogin(char *refparam, struct dmctx *ctx, void *dat
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_boolean(value))
|
||||
if (bbfdm_validate_boolean(ctx, value))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -749,7 +749,7 @@ static int set_ssh_server_passwordlogin(char *refparam, struct dmctx *ctx, void
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_boolean(value))
|
||||
if (bbfdm_validate_boolean(ctx, value))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -772,7 +772,7 @@ static int set_ssh_server_rootpasswordlogin(char *refparam, struct dmctx *ctx, v
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_boolean(value))
|
||||
if (bbfdm_validate_boolean(ctx, value))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -793,7 +793,7 @@ static int set_ssh_server_maxauthtries(char *refparam, struct dmctx *ctx, void *
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_unsignedInt(value, RANGE_ARGS{{NULL,NULL}},1))
|
||||
if (bbfdm_validate_unsignedInt(ctx, value, RANGE_ARGS{{NULL,NULL}},1))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -870,7 +870,7 @@ static int set_ssh_key_alias(char *refparam, struct dmctx *ctx, void *data, char
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 64, NULL, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 64, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -892,7 +892,7 @@ static int set_ssh_key_pubkey(char *refparam, struct dmctx *ctx, void *data, cha
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, -1, NULL, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, -1, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
|
||||
/* check if same as current key value */
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ static int set_time_enable(char *refparam, struct dmctx *ctx, void *data, char *
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_boolean(value))
|
||||
if (bbfdm_validate_boolean(ctx, value))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -77,7 +77,7 @@ static int set_time_LocalTimeZone(char *refparam, struct dmctx *ctx, void *data,
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 256, NULL, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 256, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -150,7 +150,7 @@ static int set_time_ntpserver(char *refparam, struct dmctx *ctx, int action, cha
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 64, NULL, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 64, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
|
|||
|
|
@ -405,7 +405,7 @@ static int set_UPnPDevice_Enable(char *refparam, struct dmctx *ctx, void *data,
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_boolean(value))
|
||||
if (bbfdm_validate_boolean(ctx, value))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
|
|||
|
|
@ -433,7 +433,7 @@ static int set_USBInterface_Enable(char *refparam, struct dmctx *ctx, void *data
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_boolean(value))
|
||||
if (bbfdm_validate_boolean(ctx, value))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -469,7 +469,7 @@ static int set_USBInterface_Alias(char *refparam, struct dmctx *ctx, void *data,
|
|||
struct usb_interface *usbiface= (struct usb_interface *)data;
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 64, NULL, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 64, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -498,7 +498,7 @@ static int set_USBInterface_LowerLayers(char *refparam, struct dmctx *ctx, void
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string_list(value, -1, -1, 1024, -1, -1, NULL, NULL))
|
||||
if (bbfdm_validate_string_list(ctx, value, -1, -1, 1024, -1, -1, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -576,7 +576,7 @@ static int set_USBPort_Alias(char *refparam, struct dmctx *ctx, void *data, char
|
|||
struct usb_port* port = (struct usb_port *)data;
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 64, NULL, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 64, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -672,7 +672,7 @@ static int set_USBUSBHostsHost_Alias(char *refparam, struct dmctx *ctx, void *da
|
|||
struct usb_port* port=(struct usb_port *)data;
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 64, NULL, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 64, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -699,7 +699,7 @@ static int set_USBUSBHostsHost_Enable(char *refparam, struct dmctx *ctx, void *d
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_boolean(value))
|
||||
if (bbfdm_validate_boolean(ctx, value))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -759,7 +759,7 @@ static int set_USBUSBHostsHost_PowerManagementEnable(char *refparam, struct dmct
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_boolean(value))
|
||||
if (bbfdm_validate_boolean(ctx, value))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
|
|||
|
|
@ -342,7 +342,7 @@ static int set_ui_enable(char *refparam, struct dmctx *ctx, void *data, char *in
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_boolean(value))
|
||||
if (bbfdm_validate_boolean(ctx, value))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -379,7 +379,7 @@ static int set_http_access_enable(char *refparam, struct dmctx *ctx, void *data,
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_boolean(value))
|
||||
if (bbfdm_validate_boolean(ctx, value))
|
||||
return FAULT_9007;
|
||||
|
||||
// check if same as current value
|
||||
|
|
@ -433,7 +433,7 @@ static int set_http_access_alias(char *refparam, struct dmctx *ctx, void *data,
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 64, NULL, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 64, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -460,7 +460,7 @@ static int set_http_access_type(char *refparam, struct dmctx *ctx, void *data, c
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, -1, allowed_values, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, -1, allowed_values, NULL))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -495,7 +495,7 @@ static int set_http_access_interface(char *refparam, struct dmctx *ctx, void *da
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 256, NULL, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 256, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
|
||||
if (dm_entry_validate_allowed_objects(ctx, value, allowed_objects))
|
||||
|
|
@ -530,7 +530,7 @@ static int set_http_access_port(char *refparam, struct dmctx *ctx, void *data, c
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_unsignedInt(value, RANGE_ARGS{{"1","65535"}},1))
|
||||
if (bbfdm_validate_unsignedInt(ctx, value, RANGE_ARGS{{"1","65535"}},1))
|
||||
return FAULT_9007;
|
||||
|
||||
// check if same as current value
|
||||
|
|
@ -632,7 +632,7 @@ static int set_http_access_hosts(char *refparam, struct dmctx *ctx, void *data,
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, -1, NULL, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, -1, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -699,7 +699,7 @@ static int set_http_access_path(char *refparam, struct dmctx *ctx, void *data, c
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, -1, NULL, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, -1, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
|
|||
|
|
@ -682,7 +682,7 @@ static int set_wifi_enable(char *refparam, struct dmctx *ctx, void *data, char *
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_boolean(value))
|
||||
if (bbfdm_validate_boolean(ctx, value))
|
||||
return FAULT_9007;
|
||||
|
||||
dmuci_get_value_by_section_string((((struct wifi_ssid_args *)data)->sections)->config_section, "multi_ap", &multi_ap);
|
||||
|
|
@ -729,7 +729,7 @@ static int set_wlan_ssid(char *refparam, struct dmctx *ctx, void *data, char *in
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 32, NULL, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 32, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
|
||||
dmuci_get_value_by_section_string((((struct wifi_ssid_args *)data)->sections)->config_section, "multi_ap", &multi_ap);
|
||||
|
|
@ -776,7 +776,7 @@ static int set_radio_enable(char *refparam, struct dmctx *ctx, void *data, char
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_boolean(value))
|
||||
if (bbfdm_validate_boolean(ctx, value))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -809,7 +809,7 @@ static int set_WiFiRadio_LowerLayers(char *refparam, struct dmctx *ctx, void *da
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string_list(value, -1, -1, 1024, -1, -1, NULL, NULL))
|
||||
if (bbfdm_validate_string_list(ctx, value, -1, -1, 1024, -1, -1, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -841,7 +841,7 @@ static int set_WiFiRadio_AutoChannelRefreshPeriod(char *refparam, struct dmctx *
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_unsignedInt(value, RANGE_ARGS{{NULL,NULL}}, 1))
|
||||
if (bbfdm_validate_unsignedInt(ctx, value, RANGE_ARGS{{NULL,NULL}}, 1))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -869,7 +869,7 @@ static int set_WiFiRadio_FragmentationThreshold(char *refparam, struct dmctx *ct
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_unsignedInt(value, RANGE_ARGS{{NULL,NULL}}, 1))
|
||||
if (bbfdm_validate_unsignedInt(ctx, value, RANGE_ARGS{{NULL,NULL}}, 1))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -890,7 +890,7 @@ static int set_WiFiRadio_RTSThreshold(char *refparam, struct dmctx *ctx, void *d
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_unsignedInt(value, RANGE_ARGS{{NULL,NULL}}, 1))
|
||||
if (bbfdm_validate_unsignedInt(ctx, value, RANGE_ARGS{{NULL,NULL}}, 1))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -911,7 +911,7 @@ static int set_WiFiRadio_BeaconPeriod(char *refparam, struct dmctx *ctx, void *d
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_unsignedInt(value, RANGE_ARGS{{NULL,NULL}}, 1))
|
||||
if (bbfdm_validate_unsignedInt(ctx, value, RANGE_ARGS{{NULL,NULL}}, 1))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -934,7 +934,7 @@ static int set_WiFiRadio_DTIMPeriod(char *refparam, struct dmctx *ctx, void *dat
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_unsignedInt(value, RANGE_ARGS{{NULL,NULL}}, 1))
|
||||
if (bbfdm_validate_unsignedInt(ctx, value, RANGE_ARGS{{NULL,NULL}}, 1))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -1012,7 +1012,7 @@ static int set_WiFiRadio_OperatingChannelBandwidth(char *refparam, struct dmctx
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, -1, SupportedOperatingChannelBandwidth, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, -1, SupportedOperatingChannelBandwidth, NULL))
|
||||
return FAULT_9007;
|
||||
|
||||
// Get the list of all supported operating channel bandwidths
|
||||
|
|
@ -1053,7 +1053,7 @@ static int set_WiFiRadio_PreambleType(char *refparam, struct dmctx *ctx, void *d
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, -1, PreambleType, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, -1, PreambleType, NULL))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -1081,7 +1081,7 @@ static int set_WiFiRadio_IEEE80211hEnabled(char *refparam, struct dmctx *ctx, vo
|
|||
bool b;
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_boolean(value))
|
||||
if (bbfdm_validate_boolean(ctx, value))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -1213,7 +1213,7 @@ static int set_WiFiRadio_RegulatoryDomain(char *refparam, struct dmctx *ctx, voi
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, 3, 3, NULL, RegulatoryDomain))
|
||||
if (bbfdm_validate_string(ctx, value, 3, 3, NULL, RegulatoryDomain))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -1272,7 +1272,7 @@ static int set_radio_channel(char *refparam, struct dmctx *ctx, void *data, char
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_unsignedInt(value, RANGE_ARGS{{"1","255"}}, 1))
|
||||
if (bbfdm_validate_unsignedInt(ctx, value, RANGE_ARGS{{"1","255"}}, 1))
|
||||
return FAULT_9007;
|
||||
|
||||
// Get the list of all supported channels
|
||||
|
|
@ -1306,7 +1306,7 @@ static int set_radio_auto_channel_enable(char *refparam, struct dmctx *ctx, void
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_boolean(value))
|
||||
if (bbfdm_validate_boolean(ctx, value))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -1336,7 +1336,7 @@ static int set_wlan_ssid_advertisement_enable(char *refparam, struct dmctx *ctx,
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_boolean(value))
|
||||
if (bbfdm_validate_boolean(ctx, value))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -1361,7 +1361,7 @@ static int set_wmm_enabled(char *refparam, struct dmctx *ctx, void *data, char *
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_boolean(value))
|
||||
if (bbfdm_validate_boolean(ctx, value))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -1402,7 +1402,7 @@ static int set_WiFiAccessPoint_MaxAllowedAssociations(char *refparam, struct dmc
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_unsignedInt(value, RANGE_ARGS{{NULL,NULL}}, 1))
|
||||
if (bbfdm_validate_unsignedInt(ctx, value, RANGE_ARGS{{NULL,NULL}}, 1))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -1425,7 +1425,7 @@ static int set_WiFiAccessPoint_IsolationEnable(char *refparam, struct dmctx *ctx
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_boolean(value))
|
||||
if (bbfdm_validate_boolean(ctx, value))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -1453,7 +1453,7 @@ static int set_WiFiAccessPoint_AllowedMACAddress(char *refparam, struct dmctx *c
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string_list(value, -1, -1, -1, -1, 17, NULL, MACAddress))
|
||||
if (bbfdm_validate_string_list(ctx, value, -1, -1, -1, -1, 17, NULL, MACAddress))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -1478,7 +1478,7 @@ static int set_access_point_control_enable(char *refparam, struct dmctx *ctx, vo
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_boolean(value))
|
||||
if (bbfdm_validate_boolean(ctx, value))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -1502,7 +1502,7 @@ static int set_WiFiAccessPoint_UAPSDEnable(char *refparam, struct dmctx *ctx, vo
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_boolean(value))
|
||||
if (bbfdm_validate_boolean(ctx, value))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -1666,7 +1666,7 @@ static int set_access_point_security_modes(char *refparam, struct dmctx *ctx, vo
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, -1, NULL, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, -1, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
|
||||
// Get the list of all supported security modes
|
||||
|
|
@ -1698,7 +1698,7 @@ static int set_access_point_security_wepkey(char *refparam, struct dmctx *ctx, v
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_hexBinary(value, RANGE_ARGS{{"5","5"},{"13","13"}}, 2))
|
||||
if (bbfdm_validate_hexBinary(ctx, value, RANGE_ARGS{{"5","5"},{"13","13"}}, 2))
|
||||
return FAULT_9007;
|
||||
|
||||
dmuci_get_value_by_section_string((((struct wifi_acp_args *)data)->sections)->config_section, "multi_ap", &multi_ap);
|
||||
|
|
@ -1736,7 +1736,7 @@ static int set_access_point_security_shared_key(char *refparam, struct dmctx *ct
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_hexBinary(value, RANGE_ARGS{{NULL,"32"}}, 1))
|
||||
if (bbfdm_validate_hexBinary(ctx, value, RANGE_ARGS{{NULL,"32"}}, 1))
|
||||
return FAULT_9007;
|
||||
|
||||
dmuci_get_value_by_section_string((((struct wifi_acp_args *)data)->sections)->config_section, "multi_ap", &multi_ap);
|
||||
|
|
@ -1767,7 +1767,7 @@ static int set_access_point_security_passphrase(char *refparam, struct dmctx *ct
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, 8, 63, NULL, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, 8, 63, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -1792,7 +1792,7 @@ static int set_access_point_security_rekey_interval(char *refparam, struct dmctx
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_unsignedInt(value, RANGE_ARGS{{NULL,NULL}}, 1))
|
||||
if (bbfdm_validate_unsignedInt(ctx, value, RANGE_ARGS{{NULL,NULL}}, 1))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -1815,7 +1815,7 @@ static int set_WiFiAccessPointSecurity_SAEPassphrase(char *refparam, struct dmct
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, -1, NULL, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, -1, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
|
||||
dmuci_get_value_by_section_string((((struct wifi_acp_args *)data)->sections)->config_section, "multi_ap", &multi_ap);
|
||||
|
|
@ -1852,7 +1852,7 @@ static int set_access_point_security_radius_ip_address(char *refparam, struct dm
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 45, NULL, IPAddress))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 45, NULL, IPAddress))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -1877,7 +1877,7 @@ static int set_access_point_security_radius_server_port(char *refparam, struct d
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_unsignedInt(value, RANGE_ARGS{{NULL,NULL}}, 1))
|
||||
if (bbfdm_validate_unsignedInt(ctx, value, RANGE_ARGS{{NULL,NULL}}, 1))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -1895,7 +1895,7 @@ static int set_access_point_security_radius_secret(char *refparam, struct dmctx
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, -1, NULL, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, -1, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -1988,7 +1988,7 @@ static int set_WiFiAccessPointSecurity_MFPConfig(char *refparam, struct dmctx *c
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, -1, MFPConfig, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, -1, MFPConfig, NULL))
|
||||
return FAULT_9007;
|
||||
|
||||
/*Here we also need to validate the encyption algo whether the MFP can be set*/
|
||||
|
|
@ -2023,7 +2023,7 @@ static int set_WiFiAccessPointWPS_Enable(char *refparam, struct dmctx *ctx, void
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_boolean(value))
|
||||
if (bbfdm_validate_boolean(ctx, value))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -2050,7 +2050,7 @@ static int set_WiFiAccessPointWPS_ConfigMethodsEnabled(char *refparam, struct dm
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string_list(value, -1, -1, -1, -1, -1, NULL, NULL))
|
||||
if (bbfdm_validate_string_list(ctx, value, -1, -1, -1, -1, -1, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
|
||||
if (DM_STRCMP(value, "PushButton") != 0)
|
||||
|
|
@ -2116,7 +2116,7 @@ static int set_WiFiAccessPointAccounting_ServerIPAddr(char *refparam, struct dmc
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 45, NULL, IPAddress))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 45, NULL, IPAddress))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -2137,7 +2137,7 @@ static int set_WiFiAccessPointAccounting_ServerPort(char *refparam, struct dmctx
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_unsignedInt(value, RANGE_ARGS{{NULL,NULL}}, 1))
|
||||
if (bbfdm_validate_unsignedInt(ctx, value, RANGE_ARGS{{NULL,NULL}}, 1))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -2151,7 +2151,7 @@ static int set_WiFiAccessPointAccounting_Secret(char *refparam, struct dmctx *ct
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, -1, NULL, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, -1, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -2174,7 +2174,7 @@ static int set_WiFiEndPoint_Enable(char *refparam, struct dmctx *ctx, void *data
|
|||
bool b;
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_boolean(value))
|
||||
if (bbfdm_validate_boolean(ctx, value))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -2206,7 +2206,7 @@ static int set_WiFiEndPoint_Alias(char *refparam, struct dmctx *ctx, void *data,
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 64, NULL, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 64, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -2285,7 +2285,7 @@ static int set_WiFiEndPointProfile_Enable(char *refparam, struct dmctx *ctx, voi
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_boolean(value))
|
||||
if (bbfdm_validate_boolean(ctx, value))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -2319,7 +2319,7 @@ static int set_dmmap_wireless_section(char *refparam, struct dmctx *ctx, void *d
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 64, NULL, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 64, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -2366,7 +2366,7 @@ static int set_WiFiEndPointProfile_SSID(char *refparam, struct dmctx *ctx, void
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 32, NULL, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 32, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -2393,7 +2393,7 @@ static int set_WiFiEndPointProfileSecurity_ModeEnabled(char *refparam, struct dm
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, -1, NULL, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, -1, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
|
||||
// Get the list of all supported security modes
|
||||
|
|
@ -2421,7 +2421,7 @@ static int set_WiFiEndPointProfileSecurity_WEPKey(char *refparam, struct dmctx *
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_hexBinary(value, RANGE_ARGS{{"5","5"},{"13","13"}}, 2))
|
||||
if (bbfdm_validate_hexBinary(ctx, value, RANGE_ARGS{{"5","5"},{"13","13"}}, 2))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -2444,7 +2444,7 @@ static int set_WiFiEndPointProfileSecurity_PreSharedKey(char *refparam, struct d
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_hexBinary(value, RANGE_ARGS{{NULL,"32"}}, 1))
|
||||
if (bbfdm_validate_hexBinary(ctx, value, RANGE_ARGS{{NULL,"32"}}, 1))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -2462,7 +2462,7 @@ static int set_WiFiEndPointProfileSecurity_KeyPassphrase(char *refparam, struct
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, 8, 63, NULL, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, 8, 63, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -2481,7 +2481,7 @@ static int set_WiFiEndPointProfileSecurity_SAEPassphrase(char *refparam, struct
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, -1, NULL, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, -1, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -2510,7 +2510,7 @@ static int set_WiFiEndPointProfileSecurity_MFPConfig(char *refparam, struct dmct
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, -1, MFPConfig, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, -1, MFPConfig, NULL))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -2538,7 +2538,7 @@ static int set_WiFiEndPointWPS_Enable(char *refparam, struct dmctx *ctx, void *d
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_boolean(value))
|
||||
if (bbfdm_validate_boolean(ctx, value))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -2565,7 +2565,7 @@ static int set_WiFiEndPointWPS_ConfigMethodsEnabled(char *refparam, struct dmctx
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string_list(value, -1, -1, -1, -1, -1, NULL, NULL))
|
||||
if (bbfdm_validate_string_list(ctx, value, -1, -1, -1, -1, -1, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
|
||||
if (DM_STRCMP(value, "PushButton") != 0)
|
||||
|
|
@ -2604,7 +2604,7 @@ static int set_radio_alias(char *refparam, struct dmctx *ctx, void *data, char *
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 64, NULL, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 64, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -2627,7 +2627,7 @@ static int set_ssid_alias(char *refparam, struct dmctx *ctx, void *data, char *i
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 64, NULL, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 64, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -2650,7 +2650,7 @@ static int set_access_point_alias(char *refparam, struct dmctx *ctx, void *data,
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 64, NULL, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 64, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -2673,7 +2673,7 @@ static int set_ssid_lower_layer(char *refparam, struct dmctx *ctx, void *data, c
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string_list(value, -1, -1, 1024, -1, -1, NULL, NULL))
|
||||
if (bbfdm_validate_string_list(ctx, value, -1, -1, 1024, -1, -1, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
|
||||
if (dm_entry_validate_allowed_objects(ctx, value, allowed_objects))
|
||||
|
|
@ -2702,7 +2702,7 @@ static int set_ap_ssid_ref(char *refparam, struct dmctx *ctx, void *data, char *
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 256, NULL, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 256, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
|
||||
if (dm_entry_validate_allowed_objects(ctx, value, allowed_objects))
|
||||
|
|
@ -2751,7 +2751,7 @@ static int set_neighboring_wifi_diagnostics_diagnostics_state(char *refparam, st
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, -1, DiagnosticsState, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, -1, DiagnosticsState, NULL))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -3169,7 +3169,7 @@ static int set_radio_frequency(char *refparam, struct dmctx *ctx, void *data, ch
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, -1, SupportedFrequencyBands, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, -1, SupportedFrequencyBands, NULL))
|
||||
return FAULT_9007;
|
||||
|
||||
// Get the list of all supported frequency bands
|
||||
|
|
@ -3313,7 +3313,7 @@ static int set_radio_operating_standard(char *refparam, struct dmctx *ctx, void
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string_list(value, -1, -1, -1, -1, -1, SupportedStandards, NULL))
|
||||
if (bbfdm_validate_string_list(ctx, value, -1, -1, -1, -1, -1, SupportedStandards, NULL))
|
||||
return FAULT_9007;
|
||||
|
||||
// Get the list of all supported standards
|
||||
|
|
|
|||
|
|
@ -856,7 +856,7 @@ static int set_WiFiDataElementsNetworkDevice_ReportUnsuccessfulAssociations(char
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_boolean(value))
|
||||
if (bbfdm_validate_boolean(ctx, value))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -883,7 +883,7 @@ static int set_WiFiDataElementsNetworkDevice_APMetricsReportingInterval(char *re
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_unsignedInt(value, RANGE_ARGS{{NULL,"255"}}, 1))
|
||||
if (bbfdm_validate_unsignedInt(ctx, value, RANGE_ARGS{{NULL,"255"}}, 1))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -988,7 +988,7 @@ static int set_WiFiDataElementsNetworkDevice_LocalSteeringDisallowedSTAList(char
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string_list(value, -1, -1, -1, -1, 17, NULL, MACAddress))
|
||||
if (bbfdm_validate_string_list(ctx, value, -1, -1, -1, -1, 17, NULL, MACAddress))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -1016,7 +1016,7 @@ static int set_WiFiDataElementsNetworkDevice_BTMSteeringDisallowedSTAList(char *
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string_list(value, -1, -1, -1, -1, 17, NULL, MACAddress))
|
||||
if (bbfdm_validate_string_list(ctx, value, -1, -1, -1, -1, 17, NULL, MACAddress))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -1049,7 +1049,7 @@ static int set_WiFiDataElementsNetworkDevice_ReportIndependentScans(char *refpar
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_boolean(value))
|
||||
if (bbfdm_validate_boolean(ctx, value))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -1071,7 +1071,7 @@ static int set_WiFiDataElementsNetworkDevice_AssociatedSTAinAPMetricsWiFi6(char
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_boolean(value))
|
||||
if (bbfdm_validate_boolean(ctx, value))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -1091,7 +1091,7 @@ static int set_WiFiDataElementsNetworkDevice_MaxUnsuccessfulAssociationReporting
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_unsignedInt(value, RANGE_ARGS{{NULL,NULL}}, 1))
|
||||
if (bbfdm_validate_unsignedInt(ctx, value, RANGE_ARGS{{NULL,NULL}}, 1))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -1122,7 +1122,7 @@ static int set_WiFiDataElementsNetworkDevice_CoordinatedCACAllowed(char *refpara
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_boolean(value))
|
||||
if (bbfdm_validate_boolean(ctx, value))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -1269,7 +1269,7 @@ static int set_WiFiDataElementsNetworkDeviceRadio_SteeringPolicy(char *refparam,
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_unsignedInt(value, RANGE_ARGS{{NULL,"2"}}, 1))
|
||||
if (bbfdm_validate_unsignedInt(ctx, value, RANGE_ARGS{{NULL,"2"}}, 1))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -1290,7 +1290,7 @@ static int set_WiFiDataElementsNetworkDeviceRadio_ChannelUtilizationThreshold(ch
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_unsignedInt(value, RANGE_ARGS{{NULL,"255"}}, 1))
|
||||
if (bbfdm_validate_unsignedInt(ctx, value, RANGE_ARGS{{NULL,"255"}}, 1))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -1310,7 +1310,7 @@ static int set_WiFiDataElementsNetworkDeviceRadio_RCPISteeringThreshold(char *re
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_unsignedInt(value, RANGE_ARGS{{NULL,"220"}}, 1))
|
||||
if (bbfdm_validate_unsignedInt(ctx, value, RANGE_ARGS{{NULL,"220"}}, 1))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -1330,7 +1330,7 @@ static int set_WiFiDataElementsNetworkDeviceRadio_STAReportingRCPIThreshold(char
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_unsignedInt(value, RANGE_ARGS{{NULL,"220"}}, 1))
|
||||
if (bbfdm_validate_unsignedInt(ctx, value, RANGE_ARGS{{NULL,"220"}}, 1))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -1350,7 +1350,7 @@ static int set_WiFiDataElementsNetworkDeviceRadio_STAReportingRCPIHysteresisMarg
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_unsignedInt(value, RANGE_ARGS{{NULL,NULL}}, 1))
|
||||
if (bbfdm_validate_unsignedInt(ctx, value, RANGE_ARGS{{NULL,NULL}}, 1))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -1370,7 +1370,7 @@ static int set_WiFiDataElementsNetworkDeviceRadio_ChannelUtilizationReportingThr
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_unsignedInt(value, RANGE_ARGS{{NULL,NULL}}, 1))
|
||||
if (bbfdm_validate_unsignedInt(ctx, value, RANGE_ARGS{{NULL,NULL}}, 1))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -1392,7 +1392,7 @@ static int set_WiFiDataElementsNetworkDeviceRadio_AssociatedSTATrafficStatsInclu
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_boolean(value))
|
||||
if (bbfdm_validate_boolean(ctx, value))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -1415,7 +1415,7 @@ static int set_WiFiDataElementsNetworkDeviceRadio_AssociatedSTALinkMetricsInclus
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_boolean(value))
|
||||
if (bbfdm_validate_boolean(ctx, value))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -2025,7 +2025,7 @@ static int set_WiFiDataElementsNetworkDeviceRadioBSS_FronthaulAKMsAllowed(char *
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string_list(value, -1, -1, -1, -1, -1, AKMsAllowed, NULL))
|
||||
if (bbfdm_validate_string_list(ctx, value, -1, -1, -1, -1, -1, AKMsAllowed, NULL))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -2045,7 +2045,7 @@ static int set_WiFiDataElementsNetworkDeviceRadioBSS_BackhaulAKMsAllowed(char *r
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string_list(value, -1, -1, -1, -1, -1, AKMsAllowed, NULL))
|
||||
if (bbfdm_validate_string_list(ctx, value, -1, -1, -1, -1, -1, AKMsAllowed, NULL))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -2282,7 +2282,7 @@ static int set_WiFiDataElementsNetworkDeviceRadioBSSSTA_CellularDataPreference(c
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, -1, CellularDataPreference, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, -1, CellularDataPreference, NULL))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -2302,7 +2302,7 @@ static int set_WiFiDataElementsNetworkDeviceRadioBSSSTA_ReAssociationDelay(char
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_unsignedInt(value, RANGE_ARGS{{NULL,"65535"}}, 1))
|
||||
if (bbfdm_validate_unsignedInt(ctx, value, RANGE_ARGS{{NULL,"65535"}}, 1))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -2733,7 +2733,7 @@ static int set_WiFiDataElementsNetworkDeviceDefault8021Q_Enable(char *refparam,
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_boolean(value))
|
||||
if (bbfdm_validate_boolean(ctx, value))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -2754,7 +2754,7 @@ static int set_WiFiDataElementsNetworkDeviceDefault8021Q_PrimaryVID(char *refpar
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_unsignedInt(value, RANGE_ARGS{{NULL,"4095"}}, 1))
|
||||
if (bbfdm_validate_unsignedInt(ctx, value, RANGE_ARGS{{NULL,"4095"}}, 1))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -2774,7 +2774,7 @@ static int set_WiFiDataElementsNetworkDeviceDefault8021Q_DefaultPCP(char *refpar
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_unsignedInt(value, RANGE_ARGS{{NULL,"7"}}, 1))
|
||||
if (bbfdm_validate_unsignedInt(ctx, value, RANGE_ARGS{{NULL,"7"}}, 1))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -3185,7 +3185,7 @@ static int operate_WiFiDataElementsNetwork_SetTrafficSeparation(char *refparam,
|
|||
bool b = false;
|
||||
|
||||
char *enable = dmjson_get_value((json_object *)value, 1, "Enable");
|
||||
if (!enable || *enable == '\0' || dm_validate_boolean(enable)) {
|
||||
if (!enable || *enable == '\0' || bbfdm_validate_boolean(ctx, enable)) {
|
||||
status = "Error_Invalid_Input";
|
||||
goto end;
|
||||
}
|
||||
|
|
@ -3267,12 +3267,12 @@ static int operate_WiFiDataElementsNetwork_SetPreferredBackhauls(char *refparam,
|
|||
if (*(operate_args[i].arg1) == '\0' && *(operate_args[i].arg2) == '\0')
|
||||
break;
|
||||
|
||||
if (*(operate_args[i].arg1) && dm_validate_string(operate_args[i].arg1, -1, 17, NULL, MACAddress)) {
|
||||
if (*(operate_args[i].arg1) && bbfdm_validate_string(ctx, operate_args[i].arg1, -1, 17, NULL, MACAddress)) {
|
||||
status = "Error_Invalid_Input";
|
||||
break;
|
||||
}
|
||||
|
||||
if (*(operate_args[i].arg2) && dm_validate_string(operate_args[i].arg2, -1, 17, NULL, MACAddress)) {
|
||||
if (*(operate_args[i].arg2) && bbfdm_validate_string(ctx, operate_args[i].arg2, -1, 17, NULL, MACAddress)) {
|
||||
status = "Error_Invalid_Input";
|
||||
break;
|
||||
}
|
||||
|
|
@ -3329,7 +3329,7 @@ static int operate_WiFiDataElementsNetwork_SetSSID(char *refparam, struct dmctx
|
|||
char band_list[64] = {0};
|
||||
|
||||
char *add_remove = dmjson_get_value((json_object *)value, 1, "AddRemove");
|
||||
if (!add_remove || *add_remove == '\0' || dm_validate_boolean(add_remove)) {
|
||||
if (!add_remove || *add_remove == '\0' || bbfdm_validate_boolean(ctx, add_remove)) {
|
||||
status = "Error_Invalid_Input";
|
||||
goto end;
|
||||
}
|
||||
|
|
@ -3453,7 +3453,7 @@ static int operate_WiFiDataElementsNetworkDevice_SetSTASteeringState(char *refpa
|
|||
bool b = false;
|
||||
|
||||
char *disallowed = dmjson_get_value((json_object *)value, 1, "Disallowed");
|
||||
if (!disallowed || *disallowed == '\0' || dm_validate_boolean(disallowed)) {
|
||||
if (!disallowed || *disallowed == '\0' || bbfdm_validate_boolean(ctx, disallowed)) {
|
||||
status = "Error_Invalid_Input";
|
||||
goto end;
|
||||
}
|
||||
|
|
@ -3520,15 +3520,15 @@ static int operate_WiFiDataElementsNetworkDeviceRadio_ChannelScanRequest(char *r
|
|||
dmuci_get_value_by_section_string(((struct wifi_data_element_args *)data)->uci_s, "agent_id", &agent_id);
|
||||
dmuci_get_value_by_section_string(((struct wifi_data_element_args *)data)->uci_s, "macaddr", &macaddr);
|
||||
|
||||
if ((dm_validate_string(agent_id, -1, 17, NULL, MACAddress)) ||
|
||||
(dm_validate_string(macaddr, -1, 17, NULL, MACAddress))) {
|
||||
if ((bbfdm_validate_string(ctx, agent_id, -1, 17, NULL, MACAddress)) ||
|
||||
(bbfdm_validate_string(ctx, macaddr, -1, 17, NULL, MACAddress))) {
|
||||
status = "Error_Invalid_Input";
|
||||
goto end;
|
||||
}
|
||||
|
||||
char *channel_list = dmjson_get_value((json_object *)value, 1, "ChannelList");
|
||||
|
||||
if (dm_validate_unsignedInt_list(channel_list, -1, -1, -1, RANGE_ARGS{{NULL,"255"}}, 1)) {
|
||||
if (bbfdm_validate_unsignedInt_list(ctx, channel_list, -1, -1, -1, RANGE_ARGS{{NULL,"255"}}, 1)) {
|
||||
status = "Error_Invalid_Input";
|
||||
goto end;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ static int set_IPDiagnosticsIPLayerCapacity_DiagnosticsState(char *refparam, str
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, -1, DiagnosticsState, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, -1, DiagnosticsState, NULL))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -108,7 +108,7 @@ static int set_IPDiagnosticsIPLayerCapacity_Interface(char *refparam, struct dmc
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 256, NULL, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 256, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
|
||||
if (dm_entry_validate_allowed_objects(ctx, value, allowed_objects))
|
||||
|
|
@ -133,7 +133,7 @@ static int set_IPDiagnosticsIPLayerCapacity_Role(char *refparam, struct dmctx *c
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, -1, IPLayerCapacityRole, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, -1, IPLayerCapacityRole, NULL))
|
||||
return FAULT_9007;
|
||||
|
||||
return 0;
|
||||
|
|
@ -155,7 +155,7 @@ static int set_IPDiagnosticsIPLayerCapacity_Host(char *refparam, struct dmctx *c
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 256, NULL, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 256, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -176,7 +176,7 @@ static int set_IPDiagnosticsIPLayerCapacity_Port(char *refparam, struct dmctx *c
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_unsignedInt(value, RANGE_ARGS{{"1","65535"}}, 1))
|
||||
if (bbfdm_validate_unsignedInt(ctx, value, RANGE_ARGS{{"1","65535"}}, 1))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -199,7 +199,7 @@ static int set_IPDiagnosticsIPLayerCapacity_JumboFramesPermitted(char *refparam,
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_boolean(value))
|
||||
if (bbfdm_validate_boolean(ctx, value))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -221,7 +221,7 @@ static int set_IPDiagnosticsIPLayerCapacity_DSCP(char *refparam, struct dmctx *c
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_unsignedInt(value, RANGE_ARGS{{"0","63"}}, 1))
|
||||
if (bbfdm_validate_unsignedInt(ctx, value, RANGE_ARGS{{"0","63"}}, 1))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -242,7 +242,7 @@ static int set_IPDiagnosticsIPLayerCapacity_ProtocolVersion(char *refparam, stru
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, -1, ProtocolVersion, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, -1, ProtocolVersion, NULL))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -263,7 +263,7 @@ static int set_IPDiagnosticsIPLayerCapacity_UDPPayloadContent(char *refparam, st
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, -1, UDPPayloadContent, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, -1, UDPPayloadContent, NULL))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -284,7 +284,7 @@ static int set_IPDiagnosticsIPLayerCapacity_TestType(char *refparam, struct dmct
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, -1, IPLayerCapacityTestType, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, -1, IPLayerCapacityTestType, NULL))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -307,7 +307,7 @@ static int set_IPDiagnosticsIPLayerCapacity_IPDVEnable(char *refparam, struct dm
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_boolean(value))
|
||||
if (bbfdm_validate_boolean(ctx, value))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -330,7 +330,7 @@ static int set_IPDiagnosticsIPLayerCapacity_StartSendingRateIndex(char *refparam
|
|||
switch (action) {
|
||||
case VALUECHECK:
|
||||
/* As per TR max should be 11108 but udpst supports 1108 */
|
||||
if (dm_validate_unsignedInt(value, RANGE_ARGS{{"0","1108"}}, 1))
|
||||
if (bbfdm_validate_unsignedInt(ctx, value, RANGE_ARGS{{"0","1108"}}, 1))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -351,7 +351,7 @@ static int set_IPDiagnosticsIPLayerCapacity_NumberFirstModeTestSubIntervals(char
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_unsignedInt(value, RANGE_ARGS{{"0","100"}}, 1))
|
||||
if (bbfdm_validate_unsignedInt(ctx, value, RANGE_ARGS{{"0","100"}}, 1))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -376,7 +376,7 @@ static int set_IPDiagnosticsIPLayerCapacity_NumberTestSubIntervals(char *refpara
|
|||
* since supported min value of TestSubInterval by udpst is 1 sec, so can be supported
|
||||
* upto 60 value
|
||||
*/
|
||||
if (dm_validate_unsignedInt(value, RANGE_ARGS{{"1","60"}}, 1))
|
||||
if (bbfdm_validate_unsignedInt(ctx, value, RANGE_ARGS{{"1","60"}}, 1))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -398,7 +398,7 @@ static int set_IPDiagnosticsIPLayerCapacity_TestSubInterval(char *refparam, stru
|
|||
switch (action) {
|
||||
case VALUECHECK:
|
||||
/* As per DM min should be 100 but udpst supports min 1000 */
|
||||
if (dm_validate_unsignedInt(value, RANGE_ARGS{{"1000","6000"}}, 1))
|
||||
if (bbfdm_validate_unsignedInt(ctx, value, RANGE_ARGS{{"1000","6000"}}, 1))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -419,7 +419,7 @@ static int set_IPDiagnosticsIPLayerCapacity_StatusFeedbackInterval(char *refpara
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_unsignedInt(value, RANGE_ARGS{{"5","250"}}, 1))
|
||||
if (bbfdm_validate_unsignedInt(ctx, value, RANGE_ARGS{{"5","250"}}, 1))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -440,7 +440,7 @@ static int set_IPDiagnosticsIPLayerCapacity_SeqErrThresh(char *refparam, struct
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_unsignedInt(value, RANGE_ARGS{{"0","100"}}, 1))
|
||||
if (bbfdm_validate_unsignedInt(ctx, value, RANGE_ARGS{{"0","100"}}, 1))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -463,7 +463,7 @@ static int set_IPDiagnosticsIPLayerCapacity_ReordDupIgnoreEnable(char *refparam,
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_boolean(value))
|
||||
if (bbfdm_validate_boolean(ctx, value))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -485,7 +485,7 @@ static int set_IPDiagnosticsIPLayerCapacity_LowerThresh(char *refparam, struct d
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_unsignedInt(value, RANGE_ARGS{{"5","250"}}, 1))
|
||||
if (bbfdm_validate_unsignedInt(ctx, value, RANGE_ARGS{{"5","250"}}, 1))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -506,7 +506,7 @@ static int set_IPDiagnosticsIPLayerCapacity_UpperThresh(char *refparam, struct d
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_unsignedInt(value, RANGE_ARGS{{"5","250"}}, 1))
|
||||
if (bbfdm_validate_unsignedInt(ctx, value, RANGE_ARGS{{"5","250"}}, 1))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -527,7 +527,7 @@ static int set_IPDiagnosticsIPLayerCapacity_HighSpeedDelta(char *refparam, struc
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_unsignedInt(value, RANGE_ARGS{{"2", NULL}}, 1))
|
||||
if (bbfdm_validate_unsignedInt(ctx, value, RANGE_ARGS{{"2", NULL}}, 1))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -548,7 +548,7 @@ static int set_IPDiagnosticsIPLayerCapacity_RateAdjAlgorithm(char *refparam, str
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, -1, RateAdjAlgorithm, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, -1, RateAdjAlgorithm, NULL))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -563,7 +563,7 @@ static int set_IPDiagnosticsIPLayerCapacity_SlowAdjThresh(char *refparam, struct
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_unsignedInt(value, RANGE_ARGS{{"2",NULL}}, 1))
|
||||
if (bbfdm_validate_unsignedInt(ctx, value, RANGE_ARGS{{"2",NULL}}, 1))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -976,17 +976,19 @@ int operate_IPDiagnostics_IPLayerCapacity(char *refparam, struct dmctx *ctx, voi
|
|||
unsigned int idx = 0;
|
||||
|
||||
char *host = dmjson_get_value((json_object *)value, 1, "Host");
|
||||
if (host[0] == '\0')
|
||||
if (host[0] == '\0') {
|
||||
bbfdm_set_fault_message(ctx, "IPLayerCapacity: 'Host' input should be defined");
|
||||
return USP_FAULT_INVALID_ARGUMENT;
|
||||
}
|
||||
|
||||
char *ip_interface = dmjson_get_value((json_object *)value, 1, "Interface");
|
||||
char *interface = get_diagnostics_interface_option(ctx, ip_interface);
|
||||
char *role = dmjson_get_value((json_object *)value, 1, "Role");
|
||||
if (role[0] != '\0' && dm_validate_string(role, -1, -1, IPLayerCapacityRole, NULL))
|
||||
if (role[0] != '\0' && bbfdm_validate_string(ctx, role, -1, -1, IPLayerCapacityRole, NULL))
|
||||
return USP_FAULT_INVALID_ARGUMENT;
|
||||
|
||||
char *port = dmjson_get_value((json_object *)value, 1, "Port");
|
||||
if (port[0] != '\0' && dm_validate_unsignedInt(port, RANGE_ARGS{{"1","65535"}}, 1))
|
||||
if (port[0] != '\0' && bbfdm_validate_unsignedInt(ctx, port, RANGE_ARGS{{"1","65535"}}, 1))
|
||||
return USP_FAULT_INVALID_ARGUMENT;
|
||||
|
||||
char *jumbo = dmjson_get_value((json_object *)value, 1, "JumboFramesPermitted");
|
||||
|
|
@ -994,19 +996,19 @@ int operate_IPDiagnostics_IPLayerCapacity(char *refparam, struct dmctx *ctx, voi
|
|||
string_to_bool(jumbo, &jumbo_en);
|
||||
|
||||
char *dscp = dmjson_get_value((json_object *)value, 1, "DSCP");
|
||||
if (dscp[0] != '\0' && dm_validate_unsignedInt(dscp, RANGE_ARGS{{"0","63"}}, 1))
|
||||
if (dscp[0] != '\0' && bbfdm_validate_unsignedInt(ctx, dscp, RANGE_ARGS{{"0","63"}}, 1))
|
||||
return USP_FAULT_INVALID_ARGUMENT;
|
||||
|
||||
char *ip_proto = dmjson_get_value((json_object *)value, 1, "ProtocolVersion");
|
||||
if (ip_proto[0] != '\0' && dm_validate_string(ip_proto, -1, -1, ProtocolVersion, NULL))
|
||||
if (ip_proto[0] != '\0' && bbfdm_validate_string(ctx, ip_proto, -1, -1, ProtocolVersion, NULL))
|
||||
return USP_FAULT_INVALID_ARGUMENT;
|
||||
|
||||
char *content = dmjson_get_value((json_object *)value, 1, "UDPPayloadContent");
|
||||
if (content[0] != '\0' && dm_validate_string(content, -1, -1, UDPPayloadContent, NULL))
|
||||
if (content[0] != '\0' && bbfdm_validate_string(ctx, content, -1, -1, UDPPayloadContent, NULL))
|
||||
return USP_FAULT_INVALID_ARGUMENT;
|
||||
|
||||
char *test_type = dmjson_get_value((json_object *)value, 1, "TestType");
|
||||
if (test_type[0] != '\0' && dm_validate_string(test_type, -1, -1, IPLayerCapacityTestType, NULL))
|
||||
if (test_type[0] != '\0' && bbfdm_validate_string(ctx, test_type, -1, -1, IPLayerCapacityTestType, NULL))
|
||||
return USP_FAULT_INVALID_ARGUMENT;
|
||||
|
||||
char *ipdv = dmjson_get_value((json_object *)value, 1, "IPDVEnable");
|
||||
|
|
@ -1014,27 +1016,27 @@ int operate_IPDiagnostics_IPLayerCapacity(char *refparam, struct dmctx *ctx, voi
|
|||
string_to_bool(ipdv, &ipdv_en);
|
||||
|
||||
char *start_rate = dmjson_get_value((json_object *)value, 1, "StartSendingRateIndex");
|
||||
if (start_rate[0] != '\0' && dm_validate_unsignedInt(start_rate, RANGE_ARGS{{"0","1108"}}, 1))
|
||||
if (start_rate[0] != '\0' && bbfdm_validate_unsignedInt(ctx, start_rate, RANGE_ARGS{{"0","1108"}}, 1))
|
||||
return USP_FAULT_INVALID_ARGUMENT;
|
||||
|
||||
char *num_interval = dmjson_get_value((json_object *)value, 1, "NumberTestSubIntervals");
|
||||
if (num_interval[0] != '\0' && dm_validate_unsignedInt(num_interval, RANGE_ARGS{{"1","60"}}, 1))
|
||||
if (num_interval[0] != '\0' && bbfdm_validate_unsignedInt(ctx, num_interval, RANGE_ARGS{{"1","60"}}, 1))
|
||||
return USP_FAULT_INVALID_ARGUMENT;
|
||||
|
||||
char *mode_test = dmjson_get_value((json_object *)value, 1, "NumberFirstModeTestSubIntervals");
|
||||
if (mode_test[0] != '\0' && dm_validate_unsignedInt(mode_test, RANGE_ARGS{{"0","100"}}, 1))
|
||||
if (mode_test[0] != '\0' && bbfdm_validate_unsignedInt(ctx, mode_test, RANGE_ARGS{{"0","100"}}, 1))
|
||||
return USP_FAULT_INVALID_ARGUMENT;
|
||||
|
||||
char *sub_interval = dmjson_get_value((json_object *)value, 1, "TestSubInterval");
|
||||
if (sub_interval[0] != '\0' && dm_validate_unsignedInt(sub_interval, RANGE_ARGS{{"1000","6000"}}, 1))
|
||||
if (sub_interval[0] != '\0' && bbfdm_validate_unsignedInt(ctx, sub_interval, RANGE_ARGS{{"1000","6000"}}, 1))
|
||||
return USP_FAULT_INVALID_ARGUMENT;
|
||||
|
||||
char *feed_interval = dmjson_get_value((json_object *)value, 1, "StatusFeedbackInterval");
|
||||
if (feed_interval[0] != '\0' && dm_validate_unsignedInt(feed_interval, RANGE_ARGS{{"5","250"}}, 1))
|
||||
if (feed_interval[0] != '\0' && bbfdm_validate_unsignedInt(ctx, feed_interval, RANGE_ARGS{{"5","250"}}, 1))
|
||||
return USP_FAULT_INVALID_ARGUMENT;
|
||||
|
||||
char *seq_err = dmjson_get_value((json_object *)value, 1, "SeqErrThresh");
|
||||
if (seq_err[0] != '\0' && dm_validate_unsignedInt(seq_err, RANGE_ARGS{{"0","100"}}, 1))
|
||||
if (seq_err[0] != '\0' && bbfdm_validate_unsignedInt(ctx, seq_err, RANGE_ARGS{{"0","100"}}, 1))
|
||||
return USP_FAULT_INVALID_ARGUMENT;
|
||||
|
||||
char *dup_ignore = dmjson_get_value((json_object *)value, 1, "ReordDupIgnoreEnable");
|
||||
|
|
@ -1042,23 +1044,23 @@ int operate_IPDiagnostics_IPLayerCapacity(char *refparam, struct dmctx *ctx, voi
|
|||
string_to_bool(dup_ignore, &dup_ignore_en);
|
||||
|
||||
char *low_thresh = dmjson_get_value((json_object *)value, 1, "LowerThresh");
|
||||
if (low_thresh[0] != '\0' && dm_validate_unsignedInt(low_thresh, RANGE_ARGS{{"5","250"}}, 1))
|
||||
if (low_thresh[0] != '\0' && bbfdm_validate_unsignedInt(ctx, low_thresh, RANGE_ARGS{{"5","250"}}, 1))
|
||||
return USP_FAULT_INVALID_ARGUMENT;
|
||||
|
||||
char *up_thresh = dmjson_get_value((json_object *)value, 1, "UpperThresh");
|
||||
if (up_thresh[0] != '\0' && dm_validate_unsignedInt(up_thresh, RANGE_ARGS{{"5","250"}}, 1))
|
||||
if (up_thresh[0] != '\0' && bbfdm_validate_unsignedInt(ctx, up_thresh, RANGE_ARGS{{"5","250"}}, 1))
|
||||
return USP_FAULT_INVALID_ARGUMENT;
|
||||
|
||||
char *speed_delta = dmjson_get_value((json_object *)value, 1, "HighSpeedDelta");
|
||||
if (speed_delta[0] != '\0' && dm_validate_unsignedInt(speed_delta, RANGE_ARGS{{"2", NULL}}, 1))
|
||||
if (speed_delta[0] != '\0' && bbfdm_validate_unsignedInt(ctx, speed_delta, RANGE_ARGS{{"2", NULL}}, 1))
|
||||
return USP_FAULT_INVALID_ARGUMENT;
|
||||
|
||||
char *slow_adj = dmjson_get_value((json_object *)value, 1, "SlowAdjThresh");
|
||||
if (slow_adj[0] != '\0' && dm_validate_unsignedInt(slow_adj, RANGE_ARGS{{"2", NULL}}, 1))
|
||||
if (slow_adj[0] != '\0' && bbfdm_validate_unsignedInt(ctx, slow_adj, RANGE_ARGS{{"2", NULL}}, 1))
|
||||
return USP_FAULT_INVALID_ARGUMENT;
|
||||
|
||||
char *rate_adj = dmjson_get_value((json_object *)value, 1, "RateAdjAlgorithm");
|
||||
if (rate_adj[0] != '\0' && dm_validate_string(rate_adj, -1, -1, RateAdjAlgorithm, NULL))
|
||||
if (rate_adj[0] != '\0' && bbfdm_validate_string(ctx, rate_adj, -1, -1, RateAdjAlgorithm, NULL))
|
||||
return USP_FAULT_INVALID_ARGUMENT;
|
||||
|
||||
snprintf(input, sizeof(input), "'{\"host\": \"%s\",\"interface\":\"%s\",\"role\":\"%s\",\"port\":\"%s\",\"jumbo_frames\":\"%s\",\"proto_ver\":\"%s\",\"udp_content\":\"%s\",\"test_type\":\"%s\",\"ipdv_enable\":\"%s\",\"DSCP\":\"%s\",\"rate_index\":\"%s\",\"mode_subintervals\":\"%s\",\"test_subinterval\":\"%s\",\"feedback_interval\":\"%s\",\"seq_err_thresh\":\"%s\",\"dup_ignore\":\"%s\",\"lower_thresh\":\"%s\",\"upper_thresh\":\"%s\",\"high_speed_delta\":\"%s\",\"algorithm\":\"%s\",\"slow_adj_thresh\":\"%s\",\"num_interval\":\"%s\",\"proto\":\"%s\"}'",
|
||||
|
|
@ -1075,12 +1077,14 @@ int operate_IPDiagnostics_IPLayerCapacity(char *refparam, struct dmctx *ctx, voi
|
|||
fgets(output, sizeof(output), pp);
|
||||
pclose(pp);
|
||||
} else {
|
||||
bbfdm_set_fault_message(ctx, "IPLayerCapacity: 'sh %s {input}' command failed to run", IPLAYER_CAP_DIAGNOSTIC_PATH);
|
||||
return USP_FAULT_COMMAND_FAILURE;
|
||||
}
|
||||
|
||||
json_object *res = (DM_STRLEN(output)) ? json_tokener_parse(output) : NULL;
|
||||
|
||||
if (res == NULL) {
|
||||
bbfdm_set_fault_message(ctx, "IPLayerCapacity: there is no output from '%s' script", IPLAYER_CAP_DIAGNOSTIC_PATH);
|
||||
return USP_FAULT_COMMAND_FAILURE;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ static int set_BridgingBridgePort_Egress_PriorityRegeneration(char *refparam, st
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_unsignedInt_list(value, 8, 8, -1, RANGE_ARGS{{"0","7"}}, 1))
|
||||
if (bbfdm_validate_unsignedInt_list(ctx, value, 8, 8, -1, RANGE_ARGS{{"0","7"}}, 1))
|
||||
return FAULT_9007;
|
||||
|
||||
dmuci_get_value_by_section_string(((struct bridge_port_args *)data)->bridge_port_sec, "type", &type);
|
||||
|
|
|
|||
|
|
@ -106,7 +106,7 @@ static int set_EthernetMACVLAN_Enable(char *refparam, struct dmctx *ctx, void *d
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_boolean(value))
|
||||
if (bbfdm_validate_boolean(ctx, value))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -137,7 +137,7 @@ static int set_EthernetMACVLAN_Alias(char *refparam, struct dmctx *ctx, void *da
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 64, NULL, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 64, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -187,7 +187,7 @@ static int set_EthernetMACVLAN_LowerLayers(char *refparam, struct dmctx *ctx, vo
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string_list(value, -1, -1, 1024, -1, -1, NULL, NULL))
|
||||
if (bbfdm_validate_string_list(ctx, value, -1, -1, 1024, -1, -1, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
|
||||
if (dm_entry_validate_allowed_objects(ctx, value, allowed_objects))
|
||||
|
|
@ -231,7 +231,7 @@ static int set_EthernetMACVLAN_MACAddress(char *refparam, struct dmctx *ctx, voi
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 17, NULL, MACAddress))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 17, NULL, MACAddress))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
|
|||
|
|
@ -661,7 +661,7 @@ int set_mcasts_filter_enable(char *refparam, struct dmctx *ctx, void *data, char
|
|||
bool b;
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_boolean(value))
|
||||
if (bbfdm_validate_boolean(ctx, value))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -716,7 +716,7 @@ int set_mcasts_filter_address(char *refparam, struct dmctx *ctx, void *data, cha
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 15, NULL, IPv4Address))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 15, NULL, IPv4Address))
|
||||
return FAULT_9007;
|
||||
|
||||
break;
|
||||
|
|
@ -752,7 +752,7 @@ int set_mcast_snooping_enable(char *refparam, struct dmctx *ctx, void *data, cha
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_boolean(value))
|
||||
if (bbfdm_validate_boolean(ctx, value))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -838,7 +838,7 @@ int set_mcasts_last_mq_interval(char *refparam, struct dmctx *ctx, void *data, c
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_unsignedInt(value, RANGE_ARGS{{NULL,"65535"}}, 1))
|
||||
if (bbfdm_validate_unsignedInt(ctx, value, RANGE_ARGS{{NULL,"65535"}}, 1))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -861,7 +861,7 @@ int set_mcasts_fast_leave(char *refparam, struct dmctx *ctx, void *data, char *i
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_boolean(value))
|
||||
if (bbfdm_validate_boolean(ctx, value))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -884,7 +884,7 @@ int set_mcast_snooping_robustness(char *refparam, struct dmctx *ctx, void *data,
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_unsignedInt(value, RANGE_ARGS{{NULL,"65535"}}, 1))
|
||||
if (bbfdm_validate_unsignedInt(ctx, value, RANGE_ARGS{{NULL,"65535"}}, 1))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -907,7 +907,7 @@ int set_mcast_snooping_aggregation(char *refparam, struct dmctx *ctx, void *data
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_boolean(value))
|
||||
if (bbfdm_validate_boolean(ctx, value))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -951,7 +951,7 @@ int set_mcast_snooping_interface(char *refparam, struct dmctx *ctx, void *data,
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string_list(value, -1, -1, 1024, -1, -1, NULL, NULL))
|
||||
if (bbfdm_validate_string_list(ctx, value, -1, -1, 1024, -1, -1, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -1197,7 +1197,7 @@ int set_mcastp_filter_enable(char *refparam, struct dmctx *ctx, void *data, char
|
|||
bool b;
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_boolean(value))
|
||||
if (bbfdm_validate_boolean(ctx, value))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -1244,7 +1244,7 @@ static int set_igmpp_filter_address(char *refparam, struct dmctx *ctx, void *dat
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 15, NULL, IPv4Address))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 15, NULL, IPv4Address))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -1418,7 +1418,7 @@ int set_mcast_proxy_enable(char *refparam, struct dmctx *ctx, void *data, char *
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_boolean(value))
|
||||
if (bbfdm_validate_boolean(ctx, value))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -1458,7 +1458,7 @@ int set_mcastp_query_interval(char *refparam, struct dmctx *ctx, void *data, cha
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_unsignedInt(value, RANGE_ARGS{{NULL,"65535"}}, 1))
|
||||
if (bbfdm_validate_unsignedInt(ctx, value, RANGE_ARGS{{NULL,"65535"}}, 1))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -1474,7 +1474,7 @@ int set_mcastp_q_response_interval(char *refparam, struct dmctx *ctx, void *data
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_unsignedInt(value, RANGE_ARGS{{NULL,"65535"}}, 1))
|
||||
if (bbfdm_validate_unsignedInt(ctx, value, RANGE_ARGS{{NULL,"65535"}}, 1))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -1490,7 +1490,7 @@ int set_mcastp_last_mq_interval(char *refparam, struct dmctx *ctx, void *data, c
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_unsignedInt(value, RANGE_ARGS{{NULL,"65535"}}, 1))
|
||||
if (bbfdm_validate_unsignedInt(ctx, value, RANGE_ARGS{{NULL,"65535"}}, 1))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -1506,7 +1506,7 @@ int set_mcast_proxy_robustness(char *refparam, struct dmctx *ctx, void *data, ch
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_unsignedInt(value, RANGE_ARGS{{NULL,"65535"}}, 1))
|
||||
if (bbfdm_validate_unsignedInt(ctx, value, RANGE_ARGS{{NULL,"65535"}}, 1))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -1535,7 +1535,7 @@ int set_mcast_proxy_fast_leave(char *refparam, struct dmctx *ctx, void *data, ch
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_boolean(value))
|
||||
if (bbfdm_validate_boolean(ctx, value))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -1553,7 +1553,7 @@ int set_mcast_proxy_aggregation(char *refparam, struct dmctx *ctx, void *data, c
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_boolean(value))
|
||||
if (bbfdm_validate_boolean(ctx, value))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -1703,7 +1703,7 @@ static int set_igmpp_interface_iface(char *refparam, struct dmctx *ctx, void *da
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 256, NULL, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 256, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
|
||||
if (dm_entry_validate_allowed_objects(ctx, value, allowed_objects))
|
||||
|
|
@ -1813,7 +1813,7 @@ static int set_igmpp_interface_upstream(char *refparam, struct dmctx *ctx, void
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_boolean(value))
|
||||
if (bbfdm_validate_boolean(ctx, value))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
|
|||
|
|
@ -279,7 +279,7 @@ static int set_mldp_filter_address(char *refparam, struct dmctx *ctx, void *data
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 45, NULL, IPv6Address))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 45, NULL, IPv6Address))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
@ -444,7 +444,7 @@ static int set_mldp_interface_iface(char *refparam, struct dmctx *ctx, void *dat
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 256, NULL, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 256, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
|
||||
if (dm_entry_validate_allowed_objects(ctx, value, allowed_objects))
|
||||
|
|
@ -573,7 +573,7 @@ static int set_mldp_interface_upstream(char *refparam, struct dmctx *ctx, void *
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_boolean(value))
|
||||
if (bbfdm_validate_boolean(ctx, value))
|
||||
return FAULT_9007;
|
||||
break;
|
||||
case VALUESET:
|
||||
|
|
|
|||
|
|
@ -90,7 +90,7 @@ static int set_x_test_com_dropbear_alias(char *refparam, struct dmctx *ctx, void
|
|||
{
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_string(value, -1, 64, NULL, NULL))
|
||||
if (bbfdm_validate_string(ctx, value, -1, 64, NULL, NULL))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -113,7 +113,7 @@ static int set_x_test_com_dropbear_password_auth(char *refparam, struct dmctx *c
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_boolean(value))
|
||||
if (bbfdm_validate_boolean(ctx, value))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -137,7 +137,7 @@ static int set_x_test_com_dropbear_root_password_auth(char *refparam, struct dmc
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_boolean(value))
|
||||
if (bbfdm_validate_boolean(ctx, value))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -183,7 +183,7 @@ static int set_x_test_com_dropbear_root_login(char *refparam, struct dmctx *ctx,
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_boolean(value))
|
||||
if (bbfdm_validate_boolean(ctx, value))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -206,7 +206,7 @@ static int set_x_test_com_dropbear_verbose(char *refparam, struct dmctx *ctx, vo
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_boolean(value))
|
||||
if (bbfdm_validate_boolean(ctx, value))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
@ -229,7 +229,7 @@ static int set_x_test_com_dropbear_gateway_ports(char *refparam, struct dmctx *c
|
|||
|
||||
switch (action) {
|
||||
case VALUECHECK:
|
||||
if (dm_validate_boolean(value))
|
||||
if (bbfdm_validate_boolean(ctx, value))
|
||||
return FAULT_9007;
|
||||
return 0;
|
||||
case VALUESET:
|
||||
|
|
|
|||
|
|
@ -606,6 +606,7 @@ static void test_bbf_api_json(void **state)
|
|||
|
||||
static void test_bbf_api_validate(void **state)
|
||||
{
|
||||
struct dmctx ctx = {0};
|
||||
int validate = 0;
|
||||
|
||||
/*
|
||||
|
|
@ -613,31 +614,31 @@ static void test_bbf_api_validate(void **state)
|
|||
*/
|
||||
|
||||
// dm_validate_string: test with wrong min value
|
||||
validate = dm_validate_string("test", 5, 8, NULL, NULL);
|
||||
validate = bbfdm_validate_string(&ctx, "test", 5, 8, NULL, NULL);
|
||||
assert_int_equal(validate, -1);
|
||||
|
||||
// dm_validate_string: test with wrong max value
|
||||
validate = dm_validate_string("test", -1, 2, NULL, NULL);
|
||||
validate = bbfdm_validate_string(&ctx, "test", -1, 2, NULL, NULL);
|
||||
assert_int_equal(validate, -1);
|
||||
|
||||
// dm_validate_string: test with wrong enumaration value
|
||||
validate = dm_validate_string("test", -1, -1, DiagnosticsState, NULL);
|
||||
validate = bbfdm_validate_string(&ctx, "test", -1, -1, DiagnosticsState, NULL);
|
||||
assert_int_equal(validate, -1);
|
||||
|
||||
// dm_validate_string: test with wrong pattern value
|
||||
validate = dm_validate_string("test", -1, -1, NULL, IPv4Address);
|
||||
validate = bbfdm_validate_string(&ctx, "test", -1, -1, NULL, IPv4Address);
|
||||
assert_int_equal(validate, -1);
|
||||
|
||||
// dm_validate_string: test with correct min and max value
|
||||
validate = dm_validate_string("bbftest", 5, 8, NULL, NULL);
|
||||
validate = bbfdm_validate_string(&ctx, "bbftest", 5, 8, NULL, NULL);
|
||||
assert_int_equal(validate, 0);
|
||||
|
||||
// dm_validate_string: test with correct enumaration value
|
||||
validate = dm_validate_string("Requested", -1, -1, DiagnosticsState, NULL);
|
||||
validate = bbfdm_validate_string(&ctx, "Requested", -1, -1, DiagnosticsState, NULL);
|
||||
assert_int_equal(validate, 0);
|
||||
|
||||
// dm_validate_string: test with correct pattern value
|
||||
validate = dm_validate_string("10.10.9.80", -1, -1, NULL, IPv4Address);
|
||||
validate = bbfdm_validate_string(&ctx, "10.10.9.80", -1, -1, NULL, IPv4Address);
|
||||
assert_int_equal(validate, 0);
|
||||
|
||||
|
||||
|
|
@ -646,11 +647,11 @@ static void test_bbf_api_validate(void **state)
|
|||
*/
|
||||
|
||||
// dm_validate_boolean: test with wrong value
|
||||
validate = dm_validate_boolean("test");
|
||||
validate = bbfdm_validate_boolean(&ctx, "test");
|
||||
assert_int_equal(validate, -1);
|
||||
|
||||
// dm_validate_boolean: test with correct value
|
||||
validate = dm_validate_boolean("true");
|
||||
validate = bbfdm_validate_boolean(&ctx, "true");
|
||||
assert_int_equal(validate, 0);
|
||||
|
||||
|
||||
|
|
@ -659,40 +660,40 @@ static void test_bbf_api_validate(void **state)
|
|||
*/
|
||||
|
||||
// dm_validate_unsignedInt: test with wrong value
|
||||
validate = dm_validate_unsignedInt("12t", RANGE_ARGS{{NULL,NULL}}, 1);
|
||||
validate = bbfdm_validate_unsignedInt(&ctx, "12t", RANGE_ARGS{{NULL,NULL}}, 1);
|
||||
assert_int_equal(validate, -1);
|
||||
|
||||
// dm_validate_unsignedInt: test with wrong min value
|
||||
validate = dm_validate_unsignedInt("1", RANGE_ARGS{{"12",NULL}}, 1);
|
||||
validate = bbfdm_validate_unsignedInt(&ctx, "1", RANGE_ARGS{{"12",NULL}}, 1);
|
||||
assert_int_equal(validate, -1);
|
||||
|
||||
// dm_validate_unsignedInt: test with wrong max value
|
||||
validate = dm_validate_unsignedInt("112", RANGE_ARGS{{NULL,"50"}}, 1);
|
||||
validate = bbfdm_validate_unsignedInt(&ctx, "112", RANGE_ARGS{{NULL,"50"}}, 1);
|
||||
assert_int_equal(validate, -1);
|
||||
|
||||
|
||||
// dm_validate_unsignedInt: test without min/max value
|
||||
validate = dm_validate_unsignedInt("112", RANGE_ARGS{{NULL,NULL}}, 1);
|
||||
validate = bbfdm_validate_unsignedInt(&ctx, "112", RANGE_ARGS{{NULL,NULL}}, 1);
|
||||
assert_int_equal(validate, 0);
|
||||
|
||||
// dm_validate_unsignedInt: test with correct min/max value
|
||||
validate = dm_validate_unsignedInt("112", RANGE_ARGS{{"10","1000"}}, 1);
|
||||
validate = bbfdm_validate_unsignedInt(&ctx, "112", RANGE_ARGS{{"10","1000"}}, 1);
|
||||
assert_int_equal(validate, 0);
|
||||
|
||||
// dm_validate_unsignedInt: test with multi range and wrong value
|
||||
validate = dm_validate_unsignedInt("5420", RANGE_ARGS{{"10","1000"},{"11200","45000"}}, 2);
|
||||
validate = bbfdm_validate_unsignedInt(&ctx, "5420", RANGE_ARGS{{"10","1000"},{"11200","45000"}}, 2);
|
||||
assert_int_equal(validate, -1);
|
||||
|
||||
// dm_validate_unsignedInt: test with multi range and correct value
|
||||
validate = dm_validate_unsignedInt("50", RANGE_ARGS{{"10","1000"},{"11200","45000"}}, 2);
|
||||
validate = bbfdm_validate_unsignedInt(&ctx, "50", RANGE_ARGS{{"10","1000"},{"11200","45000"}}, 2);
|
||||
assert_int_equal(validate, 0);
|
||||
|
||||
// dm_validate_unsignedInt: test with wrong value
|
||||
validate = dm_validate_unsignedInt("112", RANGE_ARGS{{"4","4"}}, 1);
|
||||
validate = bbfdm_validate_unsignedInt(&ctx, "112", RANGE_ARGS{{"4","4"}}, 1);
|
||||
assert_int_equal(validate, -1);
|
||||
|
||||
// dm_validate_unsignedInt: test with correct value
|
||||
validate = dm_validate_unsignedInt("1124", RANGE_ARGS{{"4","4"}}, 1);
|
||||
validate = bbfdm_validate_unsignedInt(&ctx, "1124", RANGE_ARGS{{"4","4"}}, 1);
|
||||
assert_int_equal(validate, 0);
|
||||
|
||||
|
||||
|
|
@ -701,31 +702,31 @@ static void test_bbf_api_validate(void **state)
|
|||
*/
|
||||
|
||||
// dm_validate_int: test with wrong value
|
||||
validate = dm_validate_int("-12t", RANGE_ARGS{{NULL,NULL}}, 1);
|
||||
validate = bbfdm_validate_int(&ctx, "-12t", RANGE_ARGS{{NULL,NULL}}, 1);
|
||||
assert_int_equal(validate, -1);
|
||||
|
||||
// dm_validate_int: test with wrong min value
|
||||
validate = dm_validate_int("-1", RANGE_ARGS{{"12",NULL}}, 1);
|
||||
validate = bbfdm_validate_int(&ctx, "-1", RANGE_ARGS{{"12",NULL}}, 1);
|
||||
assert_int_equal(validate, -1);
|
||||
|
||||
// dm_validate_int: test with wrong max value
|
||||
validate = dm_validate_int("-1", RANGE_ARGS{{NULL,"-5"}}, 1);
|
||||
validate = bbfdm_validate_int(&ctx, "-1", RANGE_ARGS{{NULL,"-5"}}, 1);
|
||||
assert_int_equal(validate, -1);
|
||||
|
||||
// dm_validate_int: test without min/max value
|
||||
validate = dm_validate_int("-112", RANGE_ARGS{{NULL,NULL}}, 1);
|
||||
validate = bbfdm_validate_int(&ctx, "-112", RANGE_ARGS{{NULL,NULL}}, 1);
|
||||
assert_int_equal(validate, 0);
|
||||
|
||||
// dm_validate_int: test with correct min/max value
|
||||
validate = dm_validate_int("-2", RANGE_ARGS{{"-10","1000"}}, 1);
|
||||
validate = bbfdm_validate_int(&ctx, "-2", RANGE_ARGS{{"-10","1000"}}, 1);
|
||||
assert_int_equal(validate, 0);
|
||||
|
||||
// dm_validate_int: test with multi range and wrong value
|
||||
validate = dm_validate_int("-2", RANGE_ARGS{{"-10","-3"},{"-1","45"}}, 2);
|
||||
validate = bbfdm_validate_int(&ctx, "-2", RANGE_ARGS{{"-10","-3"},{"-1","45"}}, 2);
|
||||
assert_int_equal(validate, -1);
|
||||
|
||||
// dm_validate_int: test with multi range and correct value
|
||||
validate = dm_validate_int("-7", RANGE_ARGS{{"-10","-3"},{"-1","45"}}, 2);
|
||||
validate = bbfdm_validate_int(&ctx, "-7", RANGE_ARGS{{"-10","-3"},{"-1","45"}}, 2);
|
||||
assert_int_equal(validate, 0);
|
||||
|
||||
/*
|
||||
|
|
@ -733,31 +734,31 @@ static void test_bbf_api_validate(void **state)
|
|||
*/
|
||||
|
||||
// dm_validate_unsignedLong: test with wrong value
|
||||
validate = dm_validate_unsignedLong("2t", RANGE_ARGS{{NULL,NULL}}, 1);
|
||||
validate = bbfdm_validate_unsignedLong(&ctx, "2t", RANGE_ARGS{{NULL,NULL}}, 1);
|
||||
assert_int_equal(validate, -1);
|
||||
|
||||
// dm_validate_unsignedLong: test with wrong min value
|
||||
validate = dm_validate_unsignedLong("1", RANGE_ARGS{{"12",NULL}}, 1);
|
||||
validate = bbfdm_validate_unsignedLong(&ctx, "1", RANGE_ARGS{{"12",NULL}}, 1);
|
||||
assert_int_equal(validate, -1);
|
||||
|
||||
// dm_validate_unsignedLong: test with wrong max value
|
||||
validate = dm_validate_unsignedLong("10", RANGE_ARGS{{NULL,"5"}}, 1);
|
||||
validate = bbfdm_validate_unsignedLong(&ctx, "10", RANGE_ARGS{{NULL,"5"}}, 1);
|
||||
assert_int_equal(validate, -1);
|
||||
|
||||
// dm_validate_unsignedLong: test without min/max value
|
||||
validate = dm_validate_unsignedLong("112", RANGE_ARGS{{NULL,NULL}}, 1);
|
||||
validate = bbfdm_validate_unsignedLong(&ctx, "112", RANGE_ARGS{{NULL,NULL}}, 1);
|
||||
assert_int_equal(validate, 0);
|
||||
|
||||
// dm_validate_unsignedLong: test with correct min/max value
|
||||
validate = dm_validate_unsignedLong("20", RANGE_ARGS{{"10","1000"}}, 1);
|
||||
validate = bbfdm_validate_unsignedLong(&ctx, "20", RANGE_ARGS{{"10","1000"}}, 1);
|
||||
assert_int_equal(validate, 0);
|
||||
|
||||
// dm_validate_unsignedLong: test with multi range and wrong value
|
||||
validate = dm_validate_unsignedLong("5420", RANGE_ARGS{{"10","1000"},{"11200","45000"}}, 2);
|
||||
validate = bbfdm_validate_unsignedLong(&ctx, "5420", RANGE_ARGS{{"10","1000"},{"11200","45000"}}, 2);
|
||||
assert_int_equal(validate, -1);
|
||||
|
||||
// dm_validate_unsignedLong: test with multi range and correct value
|
||||
validate = dm_validate_unsignedLong("15000", RANGE_ARGS{{"10","1000"},{"11200","45000"}}, 2);
|
||||
validate = bbfdm_validate_unsignedLong(&ctx, "15000", RANGE_ARGS{{"10","1000"},{"11200","45000"}}, 2);
|
||||
assert_int_equal(validate, 0);
|
||||
|
||||
|
||||
|
|
@ -766,31 +767,31 @@ static void test_bbf_api_validate(void **state)
|
|||
*/
|
||||
|
||||
// dm_validate_long: test with wrong value
|
||||
validate = dm_validate_long("-12t", RANGE_ARGS{{NULL,NULL}}, 1);
|
||||
validate = bbfdm_validate_long(&ctx, "-12t", RANGE_ARGS{{NULL,NULL}}, 1);
|
||||
assert_int_equal(validate, -1);
|
||||
|
||||
// dm_validate_long: test with wrong min value
|
||||
validate = dm_validate_long("-1", RANGE_ARGS{{"12",NULL}}, 1);
|
||||
validate = bbfdm_validate_long(&ctx, "-1", RANGE_ARGS{{"12",NULL}}, 1);
|
||||
assert_int_equal(validate, -1);
|
||||
|
||||
// dm_validate_long: test with wrong max value
|
||||
validate = dm_validate_long("-1", RANGE_ARGS{{NULL,"-5"}}, 1);
|
||||
validate = bbfdm_validate_long(&ctx, "-1", RANGE_ARGS{{NULL,"-5"}}, 1);
|
||||
assert_int_equal(validate, -1);
|
||||
|
||||
// dm_validate_long: test without min/max value
|
||||
validate = dm_validate_long("-112", RANGE_ARGS{{NULL,NULL}}, 1);
|
||||
validate = bbfdm_validate_long(&ctx, "-112", RANGE_ARGS{{NULL,NULL}}, 1);
|
||||
assert_int_equal(validate, 0);
|
||||
|
||||
// dm_validate_long: test with correct min/max value
|
||||
validate = dm_validate_long("-2", RANGE_ARGS{{"-10","1000"}}, 1);
|
||||
validate = bbfdm_validate_long(&ctx, "-2", RANGE_ARGS{{"-10","1000"}}, 1);
|
||||
assert_int_equal(validate, 0);
|
||||
|
||||
// dm_validate_long: test with multi range and wrong value
|
||||
validate = dm_validate_long("-2", RANGE_ARGS{{"-10","-3"},{"-1","45"}}, 2);
|
||||
validate = bbfdm_validate_long(&ctx, "-2", RANGE_ARGS{{"-10","-3"},{"-1","45"}}, 2);
|
||||
assert_int_equal(validate, -1);
|
||||
|
||||
// dm_validate_long: test with multi range and correct value
|
||||
validate = dm_validate_long("-7", RANGE_ARGS{{"-10","-3"},{"-1","45"}}, 2);
|
||||
validate = bbfdm_validate_long(&ctx, "-7", RANGE_ARGS{{"-10","-3"},{"-1","45"}}, 2);
|
||||
assert_int_equal(validate, 0);
|
||||
|
||||
|
||||
|
|
@ -799,31 +800,31 @@ static void test_bbf_api_validate(void **state)
|
|||
*/
|
||||
|
||||
// dm_validate_dateTime: test with wrong value
|
||||
validate = dm_validate_dateTime("2021-12-31T20:53:99");
|
||||
validate = bbfdm_validate_dateTime(&ctx, "2021-12-31T20:53:99");
|
||||
assert_int_equal(validate, -1);
|
||||
|
||||
// dm_validate_dateTime: test with wrong value
|
||||
validate = dm_validate_dateTime("2021-12-31T20:53:99.12Z");
|
||||
validate = bbfdm_validate_dateTime(&ctx, "2021-12-31T20:53:99.12Z");
|
||||
assert_int_equal(validate, -1);
|
||||
|
||||
// dm_validate_dateTime: test with wrong value
|
||||
validate = dm_validate_dateTime("2021-12-31T20:53:99+01:00Z");
|
||||
validate = bbfdm_validate_dateTime(&ctx, "2021-12-31T20:53:99+01:00Z");
|
||||
assert_int_equal(validate, -1);
|
||||
|
||||
// dm_validate_dateTime: test with wrong value
|
||||
validate = dm_validate_dateTime("2021-12-31T20:53:99.12");
|
||||
validate = bbfdm_validate_dateTime(&ctx, "2021-12-31T20:53:99.12");
|
||||
assert_int_equal(validate, -1);
|
||||
|
||||
// dm_validate_dateTime: test with correct value
|
||||
validate = dm_validate_dateTime("2021-12-31T20:53:01Z");
|
||||
validate = bbfdm_validate_dateTime(&ctx, "2021-12-31T20:53:01Z");
|
||||
assert_int_equal(validate, 0);
|
||||
|
||||
// dm_validate_dateTime: test with correct value
|
||||
validate = dm_validate_dateTime("2021-12-31T20:53:01.125Z");
|
||||
validate = bbfdm_validate_dateTime(&ctx, "2021-12-31T20:53:01.125Z");
|
||||
assert_int_equal(validate, 0);
|
||||
|
||||
// dm_validate_dateTime: test with correct value
|
||||
validate = dm_validate_dateTime("2021-12-31T20:53:01.125345Z");
|
||||
validate = bbfdm_validate_dateTime(&ctx, "2021-12-31T20:53:01.125345Z");
|
||||
assert_int_equal(validate, 0);
|
||||
|
||||
|
||||
|
|
@ -832,43 +833,43 @@ static void test_bbf_api_validate(void **state)
|
|||
*/
|
||||
|
||||
// dm_validate_hexBinary: test with wrong value
|
||||
validate = dm_validate_hexBinary("-12t", RANGE_ARGS{{NULL,NULL}}, 1);
|
||||
validate = bbfdm_validate_hexBinary(&ctx, "-12t", RANGE_ARGS{{NULL,NULL}}, 1);
|
||||
assert_int_equal(validate, -1);
|
||||
|
||||
// dm_validate_hexBinary: test with wrong min value
|
||||
validate = dm_validate_hexBinary("123bcd", RANGE_ARGS{{"12",NULL}}, 1);
|
||||
validate = bbfdm_validate_hexBinary(&ctx, "123bcd", RANGE_ARGS{{"12",NULL}}, 1);
|
||||
assert_int_equal(validate, -1);
|
||||
|
||||
// dm_validate_hexBinary: test with wrong max value
|
||||
validate = dm_validate_hexBinary("123bcd", RANGE_ARGS{{NULL,"4"}}, 1);
|
||||
validate = bbfdm_validate_hexBinary(&ctx, "123bcd", RANGE_ARGS{{NULL,"4"}}, 1);
|
||||
assert_int_equal(validate, -1);
|
||||
|
||||
// dm_validate_hexBinary: test with wrong value
|
||||
validate = dm_validate_hexBinary("123b4cd", RANGE_ARGS{{"3","3"}}, 1);
|
||||
validate = bbfdm_validate_hexBinary(&ctx, "123b4cd", RANGE_ARGS{{"3","3"}}, 1);
|
||||
assert_int_equal(validate, -1);
|
||||
|
||||
// dm_validate_hexBinary: test without min/max value
|
||||
validate = dm_validate_hexBinary("123bcd", RANGE_ARGS{{NULL,NULL}}, 1);
|
||||
validate = bbfdm_validate_hexBinary(&ctx, "123bcd", RANGE_ARGS{{NULL,NULL}}, 1);
|
||||
assert_int_equal(validate, 0);
|
||||
|
||||
// dm_validate_hexBinary: test with correct min/max value
|
||||
validate = dm_validate_hexBinary("123bcd", RANGE_ARGS{{"1","8"}}, 1);
|
||||
validate = bbfdm_validate_hexBinary(&ctx, "123bcd", RANGE_ARGS{{"1","8"}}, 1);
|
||||
assert_int_equal(validate, 0);
|
||||
|
||||
// dm_validate_hexBinary: test with correct value
|
||||
validate = dm_validate_hexBinary("123bcd", RANGE_ARGS{{"3","3"}}, 1);
|
||||
validate = bbfdm_validate_hexBinary(&ctx, "123bcd", RANGE_ARGS{{"3","3"}}, 1);
|
||||
assert_int_equal(validate, 0);
|
||||
|
||||
// dm_validate_hexBinary: test with multi range and wrong value
|
||||
validate = dm_validate_hexBinary("123bc", RANGE_ARGS{{"3","3"},{"5","5"}}, 2);
|
||||
validate = bbfdm_validate_hexBinary(&ctx, "123bc", RANGE_ARGS{{"3","3"},{"5","5"}}, 2);
|
||||
assert_int_equal(validate, -1);
|
||||
|
||||
// dm_validate_hexBinary: test with multi range and correct value
|
||||
validate = dm_validate_hexBinary("123bcd", RANGE_ARGS{{"3","3"},{"5","5"}}, 2);
|
||||
validate = bbfdm_validate_hexBinary(&ctx, "123bcd", RANGE_ARGS{{"3","3"},{"5","5"}}, 2);
|
||||
assert_int_equal(validate, 0);
|
||||
|
||||
// dm_validate_hexBinary: test with multi range and correct value
|
||||
validate = dm_validate_hexBinary("12345abcde", RANGE_ARGS{{"3","3"},{"5","5"}}, 2);
|
||||
validate = bbfdm_validate_hexBinary(&ctx, "12345abcde", RANGE_ARGS{{"3","3"},{"5","5"}}, 2);
|
||||
assert_int_equal(validate, 0);
|
||||
|
||||
|
||||
|
|
@ -877,23 +878,23 @@ static void test_bbf_api_validate(void **state)
|
|||
*/
|
||||
|
||||
// dm_validate_string_list: test with wrong min_item value
|
||||
validate = dm_validate_string_list("test", 2, -1, -1, -1, -1, NULL, NULL);
|
||||
validate = bbfdm_validate_string_list(&ctx, "test", 2, -1, -1, -1, -1, NULL, NULL);
|
||||
assert_int_equal(validate, -1);
|
||||
|
||||
// dm_validate_string_list: test with wrong max_item value
|
||||
validate = dm_validate_string_list("test1,test2,test3", -1, 2, -1, -1, -1, NULL, NULL);
|
||||
validate = bbfdm_validate_string_list(&ctx, "test1,test2,test3", -1, 2, -1, -1, -1, NULL, NULL);
|
||||
assert_int_equal(validate, -1);
|
||||
|
||||
// dm_validate_string_list: test with wrong max_size value
|
||||
validate = dm_validate_string_list("test1,test2,test3", -1, -1, 10, -1, -1, NULL, NULL);
|
||||
validate = bbfdm_validate_string_list(&ctx, "test1,test2,test3", -1, -1, 10, -1, -1, NULL, NULL);
|
||||
assert_int_equal(validate, -1);
|
||||
|
||||
// dm_validate_string_list: test with correct min and max item/size value
|
||||
validate = dm_validate_string_list("bbftest", -1, -1, -1, -1, -1, NULL, NULL);
|
||||
validate = bbfdm_validate_string_list(&ctx, "bbftest", -1, -1, -1, -1, -1, NULL, NULL);
|
||||
assert_int_equal(validate, 0);
|
||||
|
||||
// dm_validate_string_list: test with correct min and max item/size value
|
||||
validate = dm_validate_string_list("test1,test2,test3", 2, 4, 20, -1, -1, NULL, NULL);
|
||||
validate = bbfdm_validate_string_list(&ctx, "test1,test2,test3", 2, 4, 20, -1, -1, NULL, NULL);
|
||||
assert_int_equal(validate, 0);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -224,14 +224,14 @@ def generate_validate_value(dmparam, value):
|
|||
patternparam = "NULL"
|
||||
|
||||
if datatypeparam == "unsignedInt":
|
||||
validate_value += " if (dm_validate_unsignedInt_list(value, %s, %s, %s, %s))\n" % (
|
||||
validate_value += " if (bbfdm_validate_unsignedInt_list(ctx, value, %s, %s, %s, %s))\n" % (
|
||||
itemminparam, itemmaxparam, maxsizeparam, rangeargs)
|
||||
else:
|
||||
if rangeminparam == "NULL":
|
||||
rangeminparam = "-1"
|
||||
if rangemaxparam == "NULL":
|
||||
rangemaxparam = "-1"
|
||||
validate_value += " if (dm_validate_string_list(value, %s, %s, %s, %s, %s, %s, %s))\n" % (
|
||||
validate_value += " if (bbfdm_validate_string_list(ctx, value, %s, %s, %s, %s, %s, %s, %s))\n" % (
|
||||
itemminparam, itemmaxparam, maxsizeparam, rangeminparam, rangemaxparam, enumarationsparam, patternparam)
|
||||
else:
|
||||
datatypeparam = bbf.get_option_value(value, "datatype")
|
||||
|
|
@ -296,29 +296,29 @@ def generate_validate_value(dmparam, value):
|
|||
patternparam = "NULL"
|
||||
|
||||
if datatypeparam == "boolean":
|
||||
validate_value += " if (dm_validate_boolean(value))\n"
|
||||
validate_value += " if (bbfdm_validate_boolean(ctx, value))\n"
|
||||
elif datatypeparam == "unsignedInt":
|
||||
validate_value += " if (dm_validate_unsignedInt(value, %s))\n" % rangeargs
|
||||
validate_value += " if (bbfdm_validate_unsignedInt(ctx, value, %s))\n" % rangeargs
|
||||
elif datatypeparam == "int":
|
||||
validate_value += " if (dm_validate_int(value, %s))\n" % rangeargs
|
||||
validate_value += " if (bbfdm_validate_int(ctx, value, %s))\n" % rangeargs
|
||||
elif datatypeparam == "unsignedLong":
|
||||
validate_value += " if (dm_validate_unsignedLong(value, %s))\n" % rangeargs
|
||||
validate_value += " if (bbfdm_validate_unsignedLong(ctx, value, %s))\n" % rangeargs
|
||||
elif datatypeparam == "long":
|
||||
validate_value += " if (dm_validate_long(value, %s))\n" % rangeargs
|
||||
validate_value += " if (bbfdm_validate_long(ctx, value, %s))\n" % rangeargs
|
||||
elif datatypeparam == "dateTime":
|
||||
validate_value += " if (dm_validate_dateTime(value))\n"
|
||||
validate_value += " if (bbfdm_validate_dateTime(ctx, value))\n"
|
||||
elif datatypeparam == "hexBinary":
|
||||
if rangeminparam == "NULL":
|
||||
rangeminparam = "-1"
|
||||
if rangemaxparam == "NULL":
|
||||
rangemaxparam = "-1"
|
||||
validate_value += " if (dm_validate_hexBinary(value, %s))\n" % rangeargs
|
||||
validate_value += " if (bbfdm_validate_hexBinary(ctx, value, %s))\n" % rangeargs
|
||||
else:
|
||||
if rangeminparam == "NULL":
|
||||
rangeminparam = "-1"
|
||||
if rangemaxparam == "NULL":
|
||||
rangemaxparam = "-1"
|
||||
validate_value += " if (dm_validate_string(value, %s, %s, %s, %s))\n" % (
|
||||
validate_value += " if (bbfdm_validate_string(ctx, value, %s, %s, %s, %s))\n" % (
|
||||
rangeminparam, rangemaxparam, enumarationsparam, patternparam)
|
||||
validate_value += " return FAULT_9007;"
|
||||
validate_value = validate_value.replace("\"NULL\"", "NULL")
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue