Skip to content
Commit 53561e37 authored by Robert Lubos's avatar Robert Lubos Committed by David Leach
Browse files

net: dns: Fix timeout calculation with DNS retransmissions



With recently introduced DNS retransmission mechanism, a certain bug
could occur when calculating query timeout.

If the time until the final DNS timeout (as indicated by
CONFIG_NET_SOCKETS_DNS_TIMEOUT) was less than 1 millisecond, the actual
millisecond timeout value was rounded down, resulting in 0 ms timeout.
This in order was interpreted as invalid argument by dns_get_addr_info()
function, so in result, instead of reporting query timeout, the function
reported invalid argument error.

Fix this by rounding the millisecond timeout up, instead of down, so
that in any case, if the final timeout is not due, we always provide
non-zero timeout to dns_get_addr_info().

Signed-off-by: default avatarRobert Lubos <robert.lubos@nordicsemi.no>
parent 07426a80
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment