Config option to skip datatype validation

This commit is contained in:
Vivek Kumar Dutta 2025-02-14 11:50:49 +05:30
parent 8cf8920365
commit 07a0518925
5 changed files with 1062 additions and 3 deletions

File diff suppressed because one or more lines are too long

View file

@ -361,6 +361,13 @@
"required": "no", "required": "no",
"default": "1", "default": "1",
"description": "If set to **1**, icwmp will keep the uci setting while doing firmware upgrade using Download RPC with '1 Firmware Upgrade Image'." "description": "If set to **1**, icwmp will keep the uci setting while doing firmware upgrade using Download RPC with '1 Firmware Upgrade Image'."
},
{
"name": "disable_datatype_check",
"type": "boolean",
"required": "no",
"default": "0",
"description": "If set to **1**, icwmp will skip datatype validation on SPV operations."
} }
] ]
}, },

View file

@ -147,6 +147,7 @@ typedef struct config {
int clock_sync_timeout; int clock_sync_timeout;
bool force_ipv4; bool force_ipv4;
bool fw_upgrade_keep_settings; bool fw_upgrade_keep_settings;
bool cpe_disable_datatype_check;
bool lwn_enable; bool lwn_enable;
int lwn_port; int lwn_port;

View file

@ -719,7 +719,9 @@ int cwmp_set_parameter_value(const char *parameter_name, const char *parameter_v
bb_add_string(&b, "path", inst_path); bb_add_string(&b, "path", inst_path);
bb_add_string(&b, "value", parameter_value); bb_add_string(&b, "value", parameter_value);
if (cwmp_ctx.conf.cpe_disable_datatype_check == false) {
bb_add_string(&b, "datatype", type ? type : ""); bb_add_string(&b, "datatype", type ? type : "");
}
prepare_optional_table(&b); prepare_optional_table(&b);
int e = icwmp_ubus_invoke(BBFDM_OBJECT_NAME, "set", b.head, ubus_set_value_callback, &set_result); int e = icwmp_ubus_invoke(BBFDM_OBJECT_NAME, "set", b.head, ubus_set_value_callback, &set_result);

View file

@ -242,6 +242,7 @@ static void config_get_cpe_elements(struct uci_section *s)
UCI_CPE_CLOCK_SYNC_TIMEOUT, UCI_CPE_CLOCK_SYNC_TIMEOUT,
UCI_CPE_ENABLE, UCI_CPE_ENABLE,
UCI_CPE_USE_CURL_IFNAME, UCI_CPE_USE_CURL_IFNAME,
UCI_CPE_DISABLE_DATATYPE_CHECK,
__MAX_NUM_UCI_CPE_ATTRS, __MAX_NUM_UCI_CPE_ATTRS,
}; };
@ -267,7 +268,8 @@ static void config_get_cpe_elements(struct uci_section *s)
[UCI_CPE_INTERFACE] = { .name = "interface", .type = UCI_TYPE_STRING }, [UCI_CPE_INTERFACE] = { .name = "interface", .type = UCI_TYPE_STRING },
[UCI_CPE_CLOCK_SYNC_TIMEOUT] = { .name = "clock_sync_timeout", .type = UCI_TYPE_STRING }, [UCI_CPE_CLOCK_SYNC_TIMEOUT] = { .name = "clock_sync_timeout", .type = UCI_TYPE_STRING },
[UCI_CPE_ENABLE] = { .name = "enable", .type = UCI_TYPE_STRING }, [UCI_CPE_ENABLE] = { .name = "enable", .type = UCI_TYPE_STRING },
[UCI_CPE_USE_CURL_IFNAME] = { .name = "use_curl_ifname", .type = UCI_TYPE_STRING } [UCI_CPE_USE_CURL_IFNAME] = { .name = "use_curl_ifname", .type = UCI_TYPE_STRING },
[UCI_CPE_DISABLE_DATATYPE_CHECK] = { .name = "disable_datatype_check", .type = UCI_TYPE_STRING }
}; };
struct uci_option *cpe_tb[__MAX_NUM_UCI_CPE_ATTRS]; struct uci_option *cpe_tb[__MAX_NUM_UCI_CPE_ATTRS];
@ -412,6 +414,9 @@ static void config_get_cpe_elements(struct uci_section *s)
} }
CWMP_LOG(DEBUG, "CWMP CONFIG - cpe enable: %d", cwmp_ctx.conf.enable); CWMP_LOG(DEBUG, "CWMP CONFIG - cpe enable: %d", cwmp_ctx.conf.enable);
cwmp_ctx.conf.cpe_disable_datatype_check = str_to_bool(get_value_from_uci_option(cpe_tb[UCI_CPE_DISABLE_DATATYPE_CHECK]));
CWMP_LOG(DEBUG, "CWMP CONFIG - cpe datatype validation: %d", cwmp_ctx.conf.cpe_disable_datatype_check);
} }
static void config_get_lwn_elements(struct uci_section *s) static void config_get_lwn_elements(struct uci_section *s)