From: Libor Peltan Date: Fri, 5 Nov 2021 10:37:11 +0000 (+0100) Subject: kdig: interpret zero timeout as infinity X-Git-Tag: v3.3.dev~282^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f1363bd18fcbdc2fdf673df73f0f4267e28ea1e7;p=thirdparty%2Fknot-dns.git kdig: interpret zero timeout as infinity --- diff --git a/doc/man/kdig.1in b/doc/man/kdig.1in index a6bd0e9cef..defe70eb65 100644 --- a/doc/man/kdig.1in +++ b/doc/man/kdig.1in @@ -315,8 +315,8 @@ Use EDNS version (default is 0). .TP \fB+\fP[\fBno\fP]\fBtimeout\fP=\fIT\fP Set the wait\-for\-reply interval in seconds (default is 5 seconds). This timeout -applies to each query attempt. An attempt to set T to less than 1 will result -in a query timeout of 1 second being applied. +applies to each query attempt. Zero value or \fInotimeout\fP is intepreted as +infinity. .TP \fB+\fP[\fBno\fP]\fBretry\fP=\fIN\fP Set the number (>=0) of UDP retries (default is 2). This doesn\(aqt apply to diff --git a/doc/man_kdig.rst b/doc/man_kdig.rst index d84572ca43..a3aa4d0e53 100644 --- a/doc/man_kdig.rst +++ b/doc/man_kdig.rst @@ -294,8 +294,8 @@ Options **+**\ [\ **no**\ ]\ **timeout**\ =\ *T* Set the wait-for-reply interval in seconds (default is 5 seconds). This timeout - applies to each query attempt. An attempt to set T to less than 1 will result - in a query timeout of 1 second being applied. + applies to each query attempt. Zero value or *notimeout* is intepreted as + infinity. **+**\ [\ **no**\ ]\ **retry**\ =\ *N* Set the number (>=0) of UDP retries (default is 2). This doesn't apply to diff --git a/src/utils/common/params.c b/src/utils/common/params.c index 684a7d11db..6f8396f8dc 100644 --- a/src/utils/common/params.c +++ b/src/utils/common/params.c @@ -333,11 +333,7 @@ int params_parse_wait(const char *value, int32_t *dst) return ret; } - // Check for minimal value. - if (num < 1) { - num = 1; - // Reduce maximal value. Poll takes signed int in milliseconds. - } else if (num > INT32_MAX / 1000) { + if (num < 1 || num > INT32_MAX / 1000) { num = INT32_MAX / 1000; } diff --git a/src/utils/kdig/kdig_params.c b/src/utils/kdig/kdig_params.c index bd3f1b46d2..0528bde2de 100644 --- a/src/utils/kdig/kdig_params.c +++ b/src/utils/kdig/kdig_params.c @@ -1219,7 +1219,7 @@ static int opt_notimeout(const char *arg, void *query) { query_t *q = query; - q->wait = DEFAULT_TIMEOUT_DIG; + (void)params_parse_wait("0", &q->wait); return KNOT_EOK; }