1 Index: atftp-0.7/tftp.c
2 ===================================================================
3 --- atftp-0.7.orig/tftp.c 2007-08-02 23:04:23.000000000 +0200
4 +++ atftp-0.7/tftp.c 2007-08-02 23:04:23.000000000 +0200
6 { "tftp-timeout", 1, NULL, 'T'},
7 { "mode", 1, NULL, 'M'},
8 { "option", 1, NULL, 'O'},
9 + { "retry", 1, NULL, 'R'},
11 { "timeout", 1, NULL, 't'},
12 { "blksize", 1, NULL, 'b'},
16 /* Support old argument until 0.8 */
17 - while ((c = getopt_long(argc, argv, /*"gpl:r:Vh"*/ "gpl:r:Vht:b:sm",
18 + while ((c = getopt_long(argc, argv, /*"gpl:r:Vh"*/ "gpl:r:Vht:b:smR:",
19 options, &option_index)) != EOF)
24 + snprintf(string, sizeof(string), "option retry %s", optarg);
25 + make_arg(string, &ac, &av);
26 + process_cmd(ac, av);
30 if ((action == PUT) || (action == MGET))
31 Index: atftp-0.7/tftp_def.c
32 ===================================================================
33 --- atftp-0.7.orig/tftp_def.c 2007-08-02 23:04:23.000000000 +0200
34 +++ atftp-0.7/tftp_def.c 2007-08-02 23:04:23.000000000 +0200
36 { "timeout", "5", 0, 1 }, /* 2348, 2349, 2090. */
37 { "blksize", "512", 0, 1 }, /* This is the default option */
38 { "multicast", "", 0, 1 }, /* structure */
39 + { "retry", "5", 0, 1 },
43 Index: atftp-0.7/tftp_def.h
44 ===================================================================
45 --- atftp-0.7.orig/tftp_def.h 2007-08-02 23:04:23.000000000 +0200
46 +++ atftp-0.7/tftp_def.h 2007-08-02 23:04:23.000000000 +0200
50 #define OPT_MULTICAST 5
56 #define VAL_SIZE MAXLEN
57 Index: atftp-0.7/tftp_file.c
58 ===================================================================
59 --- atftp-0.7.orig/tftp_file.c 2007-08-02 23:04:23.000000000 +0200
60 +++ atftp-0.7/tftp_file.c 2007-08-02 23:04:23.000000000 +0200
62 struct tftphdr *tftphdr = (struct tftphdr *)data->data_buffer;
63 FILE *fp = NULL; /* the local file pointer */
64 int number_of_timeout = 0;
65 + int num_retry = atoi(data->tftp_options[OPT_RETRY].value);
66 int convert = 0; /* if true, do netascii convertion */
68 int oacks = 0; /* count OACK for improved error checking */
71 int prev_block_number = 0; /* needed to support netascii convertion */
77 from.sin_addr.s_addr = 0;
81 fprintf(stderr, "timeout: retrying...\n");
82 - if (number_of_timeout > NB_OF_RETRY)
83 + if ((num_retry > 0) && (number_of_timeout > num_retry))
86 state = timeout_state;
89 fprintf(stderr, "tftp: packet discard <%s:%d>.\n",
90 inet_ntoa(from.sin_addr), ntohs(from.sin_port));
91 - if (number_of_timeout > NB_OF_RETRY)
92 + if ((num_retry > 0) && (number_of_timeout > num_retry))
97 struct tftphdr *tftphdr = (struct tftphdr *)data->data_buffer;
98 FILE *fp; /* the local file pointer */
99 int number_of_timeout = 0;
100 + int num_retry = atoi(data->tftp_options[OPT_RETRY].value);
101 struct stat file_stat;
102 int convert = 0; /* if true, do netascii convertion */
107 fprintf(stderr, "timeout: retrying...\n");
108 - if (number_of_timeout > NB_OF_RETRY)
109 + if ((num_retry > 0) && (number_of_timeout > num_retry))
112 state = timeout_state;
115 fprintf(stderr, "tftp: packet discard <%s:%d>.\n",
116 inet_ntoa(from.sin_addr), ntohs(from.sin_port));
117 - if (number_of_timeout > NB_OF_RETRY)
118 + if ((num_retry > 0) && (number_of_timeout > num_retry))