1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
$Id: update-patches 24 2008-08-31 14:56:13Z wbx $
--- atftp-0.7.orig/tftp_file.c 2004-02-13 04:16:09.000000000 +0100
+++ atftp-0.7/tftp_file.c 2008-10-09 11:58:48.000000000 +0200
@@ -123,6 +123,7 @@ int tftp_receive_file(struct client_data
struct tftphdr *tftphdr = (struct tftphdr *)data->data_buffer;
FILE *fp = NULL; /* the local file pointer */
int number_of_timeout = 0;
+ int num_retry = atoi(data->tftp_options[OPT_RETRY].value);
int convert = 0; /* if true, do netascii convertion */
int oacks = 0; /* count OACK for improved error checking */
@@ -141,7 +142,7 @@ int tftp_receive_file(struct client_data
int prev_block_number = 0; /* needed to support netascii convertion */
int temp = 0;
-
+
data->file_size = 0;
tftp_cancel = 0;
from.sin_addr.s_addr = 0;
@@ -288,7 +289,7 @@ int tftp_receive_file(struct client_data
case GET_TIMEOUT:
number_of_timeout++;
fprintf(stderr, "timeout: retrying...\n");
- if (number_of_timeout > NB_OF_RETRY)
+ if ((num_retry > 0) && (number_of_timeout > num_retry))
state = S_ABORT;
else
state = timeout_state;
@@ -325,7 +326,7 @@ int tftp_receive_file(struct client_data
number_of_timeout++;
fprintf(stderr, "tftp: packet discard <%s:%d>.\n",
inet_ntoa(from.sin_addr), ntohs(from.sin_port));
- if (number_of_timeout > NB_OF_RETRY)
+ if ((num_retry > 0) && (number_of_timeout > num_retry))
state = S_ABORT;
break;
case ERR:
@@ -614,6 +615,7 @@ int tftp_send_file(struct client_data *d
struct tftphdr *tftphdr = (struct tftphdr *)data->data_buffer;
FILE *fp; /* the local file pointer */
int number_of_timeout = 0;
+ int num_retry = atoi(data->tftp_options[OPT_RETRY].value);
struct stat file_stat;
int convert = 0; /* if true, do netascii convertion */
char string[MAXLEN];
@@ -751,7 +753,7 @@ int tftp_send_file(struct client_data *d
case GET_TIMEOUT:
number_of_timeout++;
fprintf(stderr, "timeout: retrying...\n");
- if (number_of_timeout > NB_OF_RETRY)
+ if ((num_retry > 0) && (number_of_timeout > num_retry))
state = S_ABORT;
else
state = timeout_state;
@@ -797,7 +799,7 @@ int tftp_send_file(struct client_data *d
number_of_timeout++;
fprintf(stderr, "tftp: packet discard <%s:%d>.\n",
inet_ntoa(from.sin_addr), ntohs(from.sin_port));
- if (number_of_timeout > NB_OF_RETRY)
+ if ((num_retry > 0) && (number_of_timeout > num_retry))
state = S_ABORT;
break;
case ERR:
|