From 31b63a0d579b8f36fda7aa4de59ae0fcad51750d Mon Sep 17 00:00:00 2001 From: DavidBar-On Date: Fri, 20 Sep 2024 10:55:27 +0300 Subject: [PATCH 1/2] Issue 1770 - not limit omit time --- src/iperf_api.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/iperf_api.c b/src/iperf_api.c index dcf386c30..f5d07084e 100644 --- a/src/iperf_api.c +++ b/src/iperf_api.c @@ -1493,7 +1493,7 @@ iperf_parse_arguments(struct iperf_test *test, int argc, char **argv) break; case 'O': test->omit = atoi(optarg); - if (test->omit < 0 || test->omit > 60) { + if (test->omit < 0 || test->omit > MAX_TIME) { i_errno = IEOMIT; return -1; } From e03c2cc3bf6b1c8f0937e66e56c71bb230006f78 Mon Sep 17 00:00:00 2001 From: DavidBar-On Date: Wed, 20 Nov 2024 08:23:02 +0200 Subject: [PATCH 2/2] Changes per reviewer comments - limit omit time to MAX_OMIT_TIME --- src/iperf.h | 1 + src/iperf_api.c | 2 +- src/iperf_error.c | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/iperf.h b/src/iperf.h index f297587d1..539c4a17c 100644 --- a/src/iperf.h +++ b/src/iperf.h @@ -447,6 +447,7 @@ struct iperf_test #define MIN_INTERVAL 0.1 #define MAX_INTERVAL 60.0 #define MAX_TIME 86400 +#define MAX_OMIT_TIME 600 #define MAX_BURST 1000 #define MAX_MSS (9 * 1024) #define MAX_STREAMS 128 diff --git a/src/iperf_api.c b/src/iperf_api.c index f5d07084e..c5ac43e27 100644 --- a/src/iperf_api.c +++ b/src/iperf_api.c @@ -1493,7 +1493,7 @@ iperf_parse_arguments(struct iperf_test *test, int argc, char **argv) break; case 'O': test->omit = atoi(optarg); - if (test->omit < 0 || test->omit > MAX_TIME) { + if (test->omit < 0 || test->omit > MAX_OMIT_TIME) { i_errno = IEOMIT; return -1; } diff --git a/src/iperf_error.c b/src/iperf_error.c index 3388d376e..e06723ba6 100644 --- a/src/iperf_error.c +++ b/src/iperf_error.c @@ -213,7 +213,7 @@ iperf_strerror(int int_errno) snprintf(errstr, len, "this OS does not support sendfile"); break; case IEOMIT: - snprintf(errstr, len, "bogus value for --omit"); + snprintf(errstr, len, "bogus value for --omit (maximum = %d seconds)", MAX_OMIT_TIME); break; case IEUNIMP: snprintf(errstr, len, "an option you are trying to set is not implemented yet");