1 diff -urN atftp.old/tftp.c atftp.dev/tftp.c
2 --- atftp.old/tftp.c 2006-03-25 16:41:49.000000000 +0100
3 +++ atftp.dev/tftp.c 2006-03-25 18:10:04.000000000 +0100
5 { "tftp-timeout", 1, NULL, 'T'},
6 { "mode", 1, NULL, 'M'},
7 { "option", 1, NULL, 'O'},
8 + { "retry", 1, NULL, 'R'},
10 { "timeout", 1, NULL, 't'},
11 { "blksize", 1, NULL, 'b'},
15 /* Support old argument until 0.8 */
16 - while ((c = getopt_long(argc, argv, /*"gpl:r:Vh"*/ "gpl:r:Vht:b:sm",
17 + while ((c = getopt_long(argc, argv, /*"gpl:r:Vh"*/ "gpl:r:Vht:b:smR:",
18 options, &option_index)) != EOF)
23 + snprintf(string, sizeof(string), "option retry %s", optarg);
24 + make_arg(string, &ac, &av);
25 + process_cmd(ac, av);
29 if ((action == PUT) || (action == MGET))
30 diff -urN atftp.old/tftp_def.c atftp.dev/tftp_def.c
31 --- atftp.old/tftp_def.c 2004-02-13 04:16:09.000000000 +0100
32 +++ atftp.dev/tftp_def.c 2006-03-25 18:10:04.000000000 +0100
34 { "timeout", "5", 0, 1 }, /* 2348, 2349, 2090. */
35 { "blksize", "512", 0, 1 }, /* This is the default option */
36 { "multicast", "", 0, 1 }, /* structure */
37 + { "retry", "5", 0, 1 },
41 diff -urN atftp.old/tftp_def.h atftp.dev/tftp_def.h
42 --- atftp.old/tftp_def.h 2004-02-13 04:16:09.000000000 +0100
43 +++ atftp.dev/tftp_def.h 2006-03-25 17:19:15.000000000 +0100
47 #define OPT_MULTICAST 5
53 #define VAL_SIZE MAXLEN
54 diff -urN atftp.old/tftp_file.c atftp.dev/tftp_file.c
55 --- atftp.old/tftp_file.c 2004-02-13 04:16:09.000000000 +0100
56 +++ atftp.dev/tftp_file.c 2006-03-25 18:10:04.000000000 +0100
58 struct tftphdr *tftphdr = (struct tftphdr *)data->data_buffer;
59 FILE *fp = NULL; /* the local file pointer */
60 int number_of_timeout = 0;
61 + int num_retry = atoi(data->tftp_options[OPT_RETRY].value);
62 int convert = 0; /* if true, do netascii convertion */
64 int oacks = 0; /* count OACK for improved error checking */
67 int prev_block_number = 0; /* needed to support netascii convertion */
73 from.sin_addr.s_addr = 0;
77 fprintf(stderr, "timeout: retrying...\n");
78 - if (number_of_timeout > NB_OF_RETRY)
79 + if ((num_retry > 0) && (number_of_timeout > num_retry))
82 state = timeout_state;
85 fprintf(stderr, "tftp: packet discard <%s:%d>.\n",
86 inet_ntoa(from.sin_addr), ntohs(from.sin_port));
87 - if (number_of_timeout > NB_OF_RETRY)
88 + if ((num_retry > 0) && (number_of_timeout > num_retry))
93 struct tftphdr *tftphdr = (struct tftphdr *)data->data_buffer;
94 FILE *fp; /* the local file pointer */
95 int number_of_timeout = 0;
96 + int num_retry = atoi(data->tftp_options[OPT_RETRY].value);
97 struct stat file_stat;
98 int convert = 0; /* if true, do netascii convertion */
103 fprintf(stderr, "timeout: retrying...\n");
104 - if (number_of_timeout > NB_OF_RETRY)
105 + if ((num_retry > 0) && (number_of_timeout > num_retry))
108 state = timeout_state;
111 fprintf(stderr, "tftp: packet discard <%s:%d>.\n",
112 inet_ntoa(from.sin_addr), ntohs(from.sin_port));
113 - if (number_of_timeout > NB_OF_RETRY)
114 + if ((num_retry > 0) && (number_of_timeout > num_retry))