Buy commercial curl support from WolfSSL. We help you work
out your issues, debug your libcurl applications, use the API, port to new
platforms, add new features and more. With a team lead by the curl founder
himself.
TFTP timeout interval header
- Contemporary messages sorted: [ by date ] [ by thread ] [ by subject ] [ by author ] [ by messages with attachments ]
From: Daniel Belz via curl-users <curl-users_at_lists.haxx.se>
Date: Thu, 9 Dec 2021 21:35:39 +0000 (UTC)
I'm trying to use cURL's tftp client over a cellular connection that can show very long latency sometimes. To avoid timing out the connection, I have to setup the timeout option to a large value - for example, 30 seconds.When using curl client, the TFTP timeout option is calculated based on the parameter --connection-timeout.To get the negotiated timeout to be 30 seconds, I need to set connection timeout to 1500, which causes the the issue that a connection failure to retry 50 times:
# curl -v -T ./Up1M.bin --url tftp://172.16.9.2:79/Up1M.bin --retry 3 --connect-timeout 1500* Trying 172.16.9.2... % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0* Connected to 172.16.9.2 () port 79 (#0)* set timeouts for state 0; Total 1500, retry 30 maxtry 50 0 1024k 0 0 0 0 0 0 --:--:-- 0:00:02 --:--:-- 0
The timeouts are calculated like this:- Total is the drop-dead time for state TFTP_STATE_START, a.k.a connect-timeout parameter.- Retry is the actual timeout value, set in the TFTP options field.- maxtry is the number of times the attempt will be made. Minimum is 3, maximum is 50. Is calculated by dividing the total by 5:
/* Average reposting an ACK after 5 seconds */ state->retry_max = (int)timeout/5;
/* But bound the total number */ if(state->retry_max<3) state->retry_max = 3;
if(state->retry_max>50) state->retry_max = 50;
According to the RFC2349 (https://datatracker.ietf.org/doc/html/rfc2349), timeout option must accept values between 1 and 255.
While this is possible by increasing the value for connect-timeout, to achieve a value of 255, I'd have to set connect-timeout to 12750.
Changing the retry_max calculation to divide by 255 (maximum timeout allowed per RFC) and retry_max lower limit to 1 would solve this specific problem.
Are there any reasons why the ACK repost is 5 seconds, and retry_max lower limit is 3? If not, I can submit a patch to update these values.
Date: Thu, 9 Dec 2021 21:35:39 +0000 (UTC)
I'm trying to use cURL's tftp client over a cellular connection that can show very long latency sometimes. To avoid timing out the connection, I have to setup the timeout option to a large value - for example, 30 seconds.When using curl client, the TFTP timeout option is calculated based on the parameter --connection-timeout.To get the negotiated timeout to be 30 seconds, I need to set connection timeout to 1500, which causes the the issue that a connection failure to retry 50 times:
# curl -v -T ./Up1M.bin --url tftp://172.16.9.2:79/Up1M.bin --retry 3 --connect-timeout 1500* Trying 172.16.9.2... % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0* Connected to 172.16.9.2 () port 79 (#0)* set timeouts for state 0; Total 1500, retry 30 maxtry 50 0 1024k 0 0 0 0 0 0 --:--:-- 0:00:02 --:--:-- 0
The timeouts are calculated like this:- Total is the drop-dead time for state TFTP_STATE_START, a.k.a connect-timeout parameter.- Retry is the actual timeout value, set in the TFTP options field.- maxtry is the number of times the attempt will be made. Minimum is 3, maximum is 50. Is calculated by dividing the total by 5:
/* Average reposting an ACK after 5 seconds */ state->retry_max = (int)timeout/5;
/* But bound the total number */ if(state->retry_max<3) state->retry_max = 3;
if(state->retry_max>50) state->retry_max = 50;
According to the RFC2349 (https://datatracker.ietf.org/doc/html/rfc2349), timeout option must accept values between 1 and 255.
While this is possible by increasing the value for connect-timeout, to achieve a value of 255, I'd have to set connect-timeout to 12750.
Changing the retry_max calculation to divide by 255 (maximum timeout allowed per RFC) and retry_max lower limit to 1 would solve this specific problem.
Are there any reasons why the ACK repost is 5 seconds, and retry_max lower limit is 3? If not, I can submit a patch to update these values.
-- Unsubscribe: https://lists.haxx.se/listinfo/curl-users Etiquette: https://curl.haxx.se/mail/etiquette.htmlReceived on 2021-12-09