diff options
| author | David M. Syzdek <david.syzdek@acsalaska.com> | 2022-07-21 21:55:37 -0800 |
|---|---|---|
| committer | David M. Syzdek <david.syzdek@acsalaska.com> | 2022-07-21 21:55:37 -0800 |
| commit | 22662845b69d1efcdc7fcd357128db4c42384acd (patch) | |
| tree | 342864006689cc832a04b6318e73cf87be1dc5f5 /src | |
| parent | a3e409ac1d2f5dce8e4bde33ecf4a9911ffa2d3a (diff) | |
| download | akcom-udpecho-22662845b69d1efcdc7fcd357128db4c42384acd.tar.gz akcom-udpecho-22662845b69d1efcdc7fcd357128db4c42384acd.tar.bz2 akcom-udpecho-22662845b69d1efcdc7fcd357128db4c42384acd.tar.xz akcom-udpecho-22662845b69d1efcdc7fcd357128db4c42384acd.zip | |
akcom-udpecho: adding ability to autodetect echoplus
Diffstat (limited to 'src')
| -rw-r--r-- | src/akcom-udpecho.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/akcom-udpecho.c b/src/akcom-udpecho.c index 085f4ca..09ed20c 100644 --- a/src/akcom-udpecho.c +++ b/src/akcom-udpecho.c | |||
| @@ -161,7 +161,7 @@ typedef struct udp_echo_plus | |||
| 161 | static const char * prog_name = PROGRAM_NAME; | 161 | static const char * prog_name = PROGRAM_NAME; |
| 162 | static uint32_t cnf_count = 0; | 162 | static uint32_t cnf_count = 0; |
| 163 | static int cnf_debug = 0; | 163 | static int cnf_debug = 0; |
| 164 | static int cnf_echoplus = 0; | 164 | static int cnf_echoplus = -1; |
| 165 | static int cnf_verbose = 0; | 165 | static int cnf_verbose = 0; |
| 166 | static int cnf_silent = 0; | 166 | static int cnf_silent = 0; |
| 167 | static unsigned long cnf_timeout = 5; | 167 | static unsigned long cnf_timeout = 5; |
| @@ -297,7 +297,7 @@ main( | |||
| 297 | cnf_echoplus = 1; | 297 | cnf_echoplus = 1; |
| 298 | break; | 298 | break; |
| 299 | 299 | ||
| 300 | case 'E': | 300 | case 'r': |
| 301 | cnf_echoplus = 0; | 301 | cnf_echoplus = 0; |
| 302 | break; | 302 | break; |
| 303 | 303 | ||
| @@ -551,6 +551,8 @@ my_loop( | |||
| 551 | stats_max_adj = ( (!(stats_max_adj)) || (pckt_time_adj > stats_max_adj) ) ? pckt_time_adj : stats_max_adj; | 551 | stats_max_adj = ( (!(stats_max_adj)) || (pckt_time_adj > stats_max_adj) ) ? pckt_time_adj : stats_max_adj; |
| 552 | 552 | ||
| 553 | // print packet | 553 | // print packet |
| 554 | if (cnf_echoplus == -1) | ||
| 555 | cnf_echoplus = (((rcvbuff->res_sn)) || ((rcvbuff->recv_time)) || ((rcvbuff->reply_time))) ? 1 : 0; | ||
| 554 | if (!(cnf_echoplus)) | 556 | if (!(cnf_echoplus)) |
| 555 | { | 557 | { |
| 556 | printf("udpecho_seq=%u time=%" PRIu64 ".%" PRIu64 " ms\n", | 558 | printf("udpecho_seq=%u time=%" PRIu64 ".%" PRIu64 " ms\n", |
| @@ -723,10 +725,10 @@ my_usage( | |||
| 723 | printf(" -6 connect via IPv6 only\n"); | 725 | printf(" -6 connect via IPv6 only\n"); |
| 724 | printf(" -c count stop after sending count packets\n"); | 726 | printf(" -c count stop after sending count packets\n"); |
| 725 | printf(" -d, --debug print packet debugging information\n"); | 727 | printf(" -d, --debug print packet debugging information\n"); |
| 726 | printf(" -e, --echoplus expect echo plus response%s\n", ((cnf_echoplus)) ? " (default)" : ""); | 728 | printf(" -e, --echoplus expect echo plus response%s\n", (cnf_echoplus == 1) ? " (default)" : ""); |
| 727 | printf(" -h, --help print this help and exit\n"); | 729 | printf(" -h, --help print this help and exit\n"); |
| 728 | printf(" -i interval interval between packet (default: %lu sec)\n", cnf_interval); | 730 | printf(" -i interval interval between packet (default: %lu sec)\n", cnf_interval); |
| 729 | printf(" -r, --rfc expect RFC compliant echo response%s\n", (!(cnf_echoplus)) ? " (default)" : ""); | 731 | printf(" -r, --rfc expect RFC compliant echo response%s\n", (cnf_echoplus == 0) ? " (default)" : ""); |
| 730 | printf(" -q, --quiet, --silent do not print messages\n"); | 732 | printf(" -q, --quiet, --silent do not print messages\n"); |
| 731 | printf(" -s packetsize size of data bytes to be sent. (default: %zu bytes)\n", cnf_packetsize); | 733 | printf(" -s packetsize size of data bytes to be sent. (default: %zu bytes)\n", cnf_packetsize); |
| 732 | printf(" -t sec response timeout (default: %lu sec)\n", cnf_timeout); | 734 | printf(" -t sec response timeout (default: %lu sec)\n", cnf_timeout); |
