From 3f9767796f556b9774d8ec372846062c98087a0e Mon Sep 17 00:00:00 2001 From: Amin Ben Ramdhane Date: Sat, 2 Jan 2021 23:24:18 +0100 Subject: [PATCH] Diagnostics: proto has no effect after new changes affected in icwmp --- dmdiagnostics.c | 6 +++--- dmdiagnostics.h | 2 +- dmoperate.c | 14 +++++++------- scripts/functions/download_launch | 6 +++--- scripts/functions/ipping_launch | 2 +- scripts/functions/nslookup_launch | 4 ++-- scripts/functions/serverselection_launch | 2 +- scripts/functions/traceroute_launch | 4 ++-- scripts/functions/udpecho_launch | 2 +- scripts/functions/upload_launch | 8 ++++---- 10 files changed, 25 insertions(+), 25 deletions(-) diff --git a/dmdiagnostics.c b/dmdiagnostics.c index 6fb0abe6..ada41959 100644 --- a/dmdiagnostics.c +++ b/dmdiagnostics.c @@ -567,7 +567,7 @@ static char *get_default_gateway_device(void) return device; } -int start_upload_download_diagnostic(int diagnostic_type, char *proto) +int start_upload_download_diagnostic(int diagnostic_type) { char *url, *interface, *device, *size, *status; @@ -594,7 +594,7 @@ int start_upload_download_diagnostic(int diagnostic_type, char *proto) // Commit and Free uci_ctx_bbfdm commit_and_free_uci_ctx_bbfdm(DMMAP_DIAGNOSTIGS); - dmcmd("/bin/sh", 5, DOWNLOAD_DIAGNOSTIC_PATH, "run", proto, url, device); + dmcmd("/bin/sh", 4, DOWNLOAD_DIAGNOSTIC_PATH, "run", url, device); // Allocate uci_ctx_bbfdm dmuci_init_bbfdm(); @@ -613,7 +613,7 @@ int start_upload_download_diagnostic(int diagnostic_type, char *proto) // Commit and Free uci_ctx_bbfdm commit_and_free_uci_ctx_bbfdm(DMMAP_DIAGNOSTIGS); - dmcmd("/bin/sh", 6, UPLOAD_DIAGNOSTIC_PATH, "run", proto, url, device, size); + dmcmd("/bin/sh", 5, UPLOAD_DIAGNOSTIC_PATH, "run", url, device, size); // Allocate uci_ctx_bbfdm dmuci_init_bbfdm(); diff --git a/dmdiagnostics.h b/dmdiagnostics.h index 0d5efcfb..bee013d9 100644 --- a/dmdiagnostics.h +++ b/dmdiagnostics.h @@ -60,7 +60,7 @@ char *get_diagnostics_option_fallback_def(char *sec_name, char *option, char *de void set_diagnostics_option(char *sec_name, char *option, char *value); void init_diagnostics_operation(char *sec_name, char *operation_path); void set_diagnostics_interface_option(struct dmctx *ctx, char *sec_name, char *value); -int start_upload_download_diagnostic(int diagnostic_type, char *proto); +int start_upload_download_diagnostic(int diagnostic_type); int bbf_config_backup(const char *url, const char *username, const char *password, char *config_name); int bbf_config_restore(const char *url, const char *username, const char *password, const char *size); diff --git a/dmoperate.c b/dmoperate.c index a2a7ebe6..e647a53f 100644 --- a/dmoperate.c +++ b/dmoperate.c @@ -345,7 +345,7 @@ static opr_ret_t ip_diagnostics_ipping(struct dmctx *dmctx, char *path, json_obj // Commit and Free uci_ctx_bbfdm commit_and_free_uci_ctx_bbfdm(DMMAP_DIAGNOSTIGS); - dmcmd("/bin/sh", 3, IPPING_PATH, "run", bbfdatamodel_type == BBFDM_CWMP ? "cwmp" : "usp"); + dmcmd("/bin/sh", 2, IPPING_PATH, "run"); // Allocate uci_ctx_bbfdm dmuci_init_bbfdm(); @@ -403,7 +403,7 @@ static opr_ret_t ip_diagnostics_traceroute(struct dmctx *dmctx, char *path, json // Commit and Free uci_ctx_bbfdm commit_and_free_uci_ctx_bbfdm(DMMAP_DIAGNOSTIGS); - dmcmd("/bin/sh", 3, TRACEROUTE_PATH, "run", bbfdatamodel_type == BBFDM_CWMP ? "cwmp" : "usp"); + dmcmd("/bin/sh", 2, TRACEROUTE_PATH, "run"); // Allocate uci_ctx_bbfdm dmuci_init_bbfdm(); @@ -455,7 +455,7 @@ static opr_ret_t ip_diagnostics_download(struct dmctx *dmctx, char *path, json_o set_diagnostics_option("download", "NumberOfConnections", download.num_of_connections); set_diagnostics_option("download", "EnablePerConnection", download.enable_per_connection_results); - if (start_upload_download_diagnostic(DOWNLOAD_DIAGNOSTIC, bbfdatamodel_type == BBFDM_CWMP ? "cwmp" : "usp") == -1) + if (start_upload_download_diagnostic(DOWNLOAD_DIAGNOSTIC) == -1) return FAIL; download.romtime = get_diagnostics_option("download", "ROMtime"); @@ -515,7 +515,7 @@ static opr_ret_t ip_diagnostics_upload(struct dmctx *dmctx, char *path, json_obj set_diagnostics_option("upload", "NumberOfConnections", upload.num_of_connections); set_diagnostics_option("upload", "EnablePerConnection", upload.enable_per_connection_results); - if (start_upload_download_diagnostic(UPLOAD_DIAGNOSTIC, bbfdatamodel_type == BBFDM_CWMP ? "cwmp" : "usp") == -1) + if (start_upload_download_diagnostic(UPLOAD_DIAGNOSTIC) == -1) return FAIL; upload.romtime = get_diagnostics_option("upload", "ROMtime"); @@ -582,7 +582,7 @@ static opr_ret_t ip_diagnostics_udpecho(struct dmctx *dmctx, char *path, json_ob // Commit and Free uci_ctx_bbfdm commit_and_free_uci_ctx_bbfdm(DMMAP_DIAGNOSTIGS); - dmcmd("/bin/sh", 3, UDPECHO_PATH, "run", bbfdatamodel_type == BBFDM_CWMP ? "cwmp" : "usp"); + dmcmd("/bin/sh", 2, UDPECHO_PATH, "run"); // Allocate uci_ctx_bbfdm dmuci_init_bbfdm(); @@ -633,7 +633,7 @@ static opr_ret_t ip_diagnostics_serverselection(struct dmctx *dmctx, char *path, // Commit and Free uci_ctx_bbfdm commit_and_free_uci_ctx_bbfdm(DMMAP_DIAGNOSTIGS); - dmcmd("/bin/sh", 3, SERVERSELECTION_PATH, "run", bbfdatamodel_type == BBFDM_CWMP ? "cwmp" : "usp"); + dmcmd("/bin/sh", 2, SERVERSELECTION_PATH, "run"); // Allocate uci_ctx_bbfdm dmuci_init_bbfdm(); @@ -677,7 +677,7 @@ static opr_ret_t ip_diagnostics_nslookup(struct dmctx *dmctx, char *path, json_o // Commit and Free uci_ctx_bbfdm commit_and_free_uci_ctx_bbfdm(DMMAP_DIAGNOSTIGS); - dmcmd("/bin/sh", 3, NSLOOKUP_PATH, "run", bbfdatamodel_type == BBFDM_CWMP ? "cwmp" : "usp"); + dmcmd("/bin/sh", 2, NSLOOKUP_PATH, "run"); // Allocate uci_ctx_bbfdm dmuci_init_bbfdm(); diff --git a/scripts/functions/download_launch b/scripts/functions/download_launch index 3372bc82..45d7421e 100755 --- a/scripts/functions/download_launch +++ b/scripts/functions/download_launch @@ -19,8 +19,8 @@ download_get() { download_launch() { local proto tx_bytes_before rx_bytes_before time1 tx_bytes_after rx_bytes_after time2 periodtime error_code - local url=$2 - local device=$3 + local url=$1 + local device=$2 [ "$url" = "" ] && { $UCI_SET_BBFDM dmmap_diagnostics.download.DiagnosticState=Error_InitConnectionFailed; $UCI_COMMIT_BBFDM; return; } local protocol=`download_get dmmap_diagnostics.download.ProtocolVersion Any` if [ "$protocol" == "IPv4" ]; then proto="-4"; elif [ "$protocol" == "IPv6" ]; then proto="-6"; else proto=""; fi @@ -89,7 +89,7 @@ download_stop_diagnostic() { } if [ "$1" == "run" ] ; then - download_launch $2 $3 $4 + download_launch $2 $3 elif [ "$1" == "stop" ]; then download_stop_diagnostic else diff --git a/scripts/functions/ipping_launch b/scripts/functions/ipping_launch index d60ddf28..b435739f 100755 --- a/scripts/functions/ipping_launch +++ b/scripts/functions/ipping_launch @@ -113,7 +113,7 @@ ipping_stop_diagnostic() { } if [ "$1" == "run" ]; then - ipping_launch $2 + ipping_launch elif [ "$1" == "stop" ]; then ipping_stop_diagnostic else diff --git a/scripts/functions/nslookup_launch b/scripts/functions/nslookup_launch index 427d730c..79cdae7d 100644 --- a/scripts/functions/nslookup_launch +++ b/scripts/functions/nslookup_launch @@ -80,7 +80,7 @@ nslookup_launch() { done <${LOG_FILE} rm -f ${LOG_FILE} $UCI_SET_BBFDM dmmap_diagnostics.nslookup.SuccessCount=$success_count - [ "$1" == "cwmp" ] && $UCI_SET_BBFDM dmmap_diagnostics.nslookup.DiagnosticState=Complete + $UCI_SET_BBFDM dmmap_diagnostics.nslookup.DiagnosticState=Complete $UCI_COMMIT_BBFDM } @@ -103,7 +103,7 @@ nslookup_stop_diagnostic() { } if [ "$1" == "run" ]; then - nslookup_launch $2 + nslookup_launch elif [ "$1" == "stop" ]; then nslookup_stop_diagnostic else diff --git a/scripts/functions/serverselection_launch b/scripts/functions/serverselection_launch index 7e1087ea..dc463f2f 100644 --- a/scripts/functions/serverselection_launch +++ b/scripts/functions/serverselection_launch @@ -119,7 +119,7 @@ serverselection_stop_diagnostic() { } if [ "$1" == "run" ]; then - serverselection_launch $2 + serverselection_launch elif [ "$1" == "stop" ]; then serverselection_stop_diagnostic else diff --git a/scripts/functions/traceroute_launch b/scripts/functions/traceroute_launch index 9c260317..0d827fcc 100644 --- a/scripts/functions/traceroute_launch +++ b/scripts/functions/traceroute_launch @@ -46,7 +46,7 @@ traceroute_launch() { rm -f /tmp/traceres let i++ - [ "$1" == "cwmp" ] && $UCI_SET_BBFDM dmmap_diagnostics.traceroute.DiagnosticState=Complete + $UCI_SET_BBFDM dmmap_diagnostics.traceroute.DiagnosticState=Complete $UCI_SET_BBFDM dmmap_diagnostics.traceroute.NumberOfHops=$i $UCI_SET_BBFDM dmmap_diagnostics.traceroute.ResponseTime=$($UCI_GET_BBFDM dmmap_diagnostics.@RouteHops[-1].time) $UCI_COMMIT_BBFDM @@ -72,7 +72,7 @@ traceroute_stop() { } if [ "$1" == "run" ]; then - traceroute_launch $2 2>/dev/null + traceroute_launch 2>/dev/null elif [ "$1" == "stop" ]; then traceroute_stop 2>/dev/null else diff --git a/scripts/functions/udpecho_launch b/scripts/functions/udpecho_launch index 9badfa9b..f4073fb1 100644 --- a/scripts/functions/udpecho_launch +++ b/scripts/functions/udpecho_launch @@ -84,7 +84,7 @@ udpecho_stop_diagnostic() { } if [ "$1" == "run" ]; then - udpecho_launch $1 + udpecho_launch elif [ "$1" == "stop" ]; then udpecho_stop_diagnostic else diff --git a/scripts/functions/upload_launch b/scripts/functions/upload_launch index 5ae96345..01a94675 100644 --- a/scripts/functions/upload_launch +++ b/scripts/functions/upload_launch @@ -19,9 +19,9 @@ upload_get() { upload_launch() { local proto tx_bytes_before rx_bytes_before time1 tx_bytes_after rx_bytes_after time2 res ba stc periodtime - local url=$2 - local device=$3 - local size=$4 + local url=$1 + local device=$2 + local size=$3 [ "$url" = "" ] && { $UCI_SET_BBFDM dmmap_diagnostics.upload.DiagnosticState=Error_InitConnectionFailed; $UCI_COMMIT_BBFDM; return; } local protocol=`upload_get dmmap_diagnostics.upload.ProtocolVersion Any` if [ "$protocol" == "IPv4" ]; then proto="-4"; elif [ "$protocol" == "IPv6" ]; then proto="-6"; else proto=""; fi @@ -113,7 +113,7 @@ upload_stop_diagnostic() { } if [ "$1" == "run" ] ; then - upload_launch $2 $3 $4 $5 + upload_launch $2 $3 $4 elif [ "$1" == "stop" ]; then upload_stop_diagnostic else