diff --git a/dmoperate.c b/dmoperate.c index 7b49eaec..c09c1907 100644 --- a/dmoperate.c +++ b/dmoperate.c @@ -285,12 +285,7 @@ static opr_ret_t vendor_conf_backup(struct dmctx *dmctx, char *path, char *input return UBUS_INVALID_ARGUMENTS; fserver.user = dmjson_get_value(json_res, 1, "Username"); - if(fserver.user[0] == '\0') - return UBUS_INVALID_ARGUMENTS; - fserver.pass = dmjson_get_value(json_res, 1, "Password"); - if(fserver.pass[0] == '\0') - return UBUS_INVALID_ARGUMENTS; dmcmd("/bin/sh", 7, ICWMP_SCRIPT, "upload", fserver.url, VCF_FILE_TYPE, fserver.user, fserver.pass, vcf_name); dmfree(vcf_name); @@ -310,13 +305,7 @@ static opr_ret_t vendor_conf_restore(struct dmctx *dmctx, char *path, char *inpu return UBUS_INVALID_ARGUMENTS; fserver.user = dmjson_get_value(json_res, 1, "Username"); - if(fserver.user[0] == '\0') - return UBUS_INVALID_ARGUMENTS; - fserver.pass = dmjson_get_value(json_res, 1, "Password"); - if(fserver.pass[0] == '\0') - return UBUS_INVALID_ARGUMENTS; - file_size = dmjson_get_value(json_res, 1, "FileSize"); dmcmd("/bin/sh", 7, ICWMP_SCRIPT, "download", fserver.url, file_size, VCF_FILE_TYPE, fserver.user, fserver.pass); @@ -740,7 +729,7 @@ static opr_ret_t ip_diagnostics_serverselection(struct dmctx *dmctx, char *path, //Allocate uci_varstate_ctx init_uci_varstate_ctx(); - serverselection.fasthost = get_param_diagnostics("serverselectiondiagnostic", "AverageResponseTimeDetailed"); + serverselection.fasthost = get_param_diagnostics("serverselectiondiagnostic", "FastestHost"); serverselection.average_response_time = get_param_diagnostics("serverselectiondiagnostic", "AverageResponseTime"); serverselection.minimum_response_time = get_param_diagnostics("serverselectiondiagnostic", "MinimumResponseTime"); serverselection.maximum_response_time = get_param_diagnostics("serverselectiondiagnostic", "MaximumResponseTime"); diff --git a/scripts/functions/serverselection_launch b/scripts/functions/serverselection_launch index 4a0cc2f4..c8916507 100644 --- a/scripts/functions/serverselection_launch +++ b/scripts/functions/serverselection_launch @@ -13,7 +13,8 @@ serverselection_get() { } serverselection_launch() { - local i res ba stc times sc1 success_count min_time avg_time max_time avg_time_sum min max fasthost micros + local i res ba stc times sc1 success_count min_time avg_time max_time avg_time_sum min max micros + local fasthost avg_time_host min_time_host max_time_host [ "$1" == "cwmp" ] && [ "`$UCI_GET_VARSTATE cwmp.@serverselectiondiagnostic[0].DiagnosticState`" != "Requested" ] && return local hostlist=`serverselection_get cwmp.@serverselectiondiagnostic[0].HostList` local cnt=`serverselection_get cwmp.@serverselectiondiagnostic[0].NumberOfRepetitions 3` @@ -95,7 +96,7 @@ serverselection_launch() { done fi [ $success_count -gt 0 ] && avg_time=$((avg_time_sum/success_count)) || avg_time=0 - [[ "$avg_time" != "0" && $avg_time -lt $avg_time_host ]] && avg_time_host=$avg_time && min_time=$min && max_time=$max && fasthost=$host + [[ "$avg_time" != "0" && $avg_time -lt $avg_time_host ]] && avg_time_host=$avg_time && min_time_host=$min && max_time_host=$max && fasthost=$host success_count=0 avg_time_sum=0 min=9999999 @@ -105,8 +106,8 @@ serverselection_launch() { $UCI_SET_VARSTATE cwmp.@serverselectiondiagnostic[0].DiagnosticState=Complete $UCI_SET_VARSTATE cwmp.@serverselectiondiagnostic[0].FastestHost=$fasthost $UCI_SET_VARSTATE cwmp.@serverselectiondiagnostic[0].AverageResponseTime=$avg_time_host - $UCI_SET_VARSTATE cwmp.@serverselectiondiagnostic[0].MinimumResponseTime=$min_time - $UCI_SET_VARSTATE cwmp.@serverselectiondiagnostic[0].MaximumResponseTime=$max_time + $UCI_SET_VARSTATE cwmp.@serverselectiondiagnostic[0].MinimumResponseTime=$min_time_host + $UCI_SET_VARSTATE cwmp.@serverselectiondiagnostic[0].MaximumResponseTime=$max_time_host [ "$1" == "cwmp" ] && event_dignostic }